speed upgrades on interface
This commit is contained in:
@@ -9,6 +9,7 @@ import refinedstorage.container.slot.SlotFiltered;
|
||||
import refinedstorage.container.slot.SlotOutput;
|
||||
import refinedstorage.container.slot.SlotSpecimen;
|
||||
import refinedstorage.item.ItemPattern;
|
||||
import refinedstorage.item.ItemUpgrade;
|
||||
import refinedstorage.tile.TileInterface;
|
||||
|
||||
public class ContainerInterface extends ContainerBase {
|
||||
@@ -27,16 +28,16 @@ public class ContainerInterface extends ContainerBase {
|
||||
addSlotToContainer(new SlotOutput(tile, i, 8 + (18 * (i - 18)), 100));
|
||||
}
|
||||
|
||||
for (int i = 27; i < 27 + 9; ++i) {
|
||||
addSlotToContainer(new SlotFiltered(tile, i, 8 + (18 * (i - 27)), 134, new IItemValidator() {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
addSlotToContainer(new SlotFiltered(tile.getUpgradesInventory(), i, 187, 6 + (i * 18), new IItemValidator() {
|
||||
@Override
|
||||
public boolean isValid(ItemStack stack) {
|
||||
return stack.getItem() == RefinedStorageItems.PATTERN && ItemPattern.hasResult(stack);
|
||||
return stack.getItem() == RefinedStorageItems.UPGRADE && stack.getMetadata() == ItemUpgrade.TYPE_SPEED;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
addPlayerInventory(8, 168);
|
||||
addPlayerInventory(8, 134);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -10,7 +10,7 @@ public class GuiInterface extends GuiBase {
|
||||
private TileInterface tile;
|
||||
|
||||
public GuiInterface(ContainerInterface container, TileInterface tile) {
|
||||
super(container, 176, 250);
|
||||
super(container, 211, 217);
|
||||
|
||||
this.tile = tile;
|
||||
}
|
||||
@@ -38,7 +38,6 @@ public class GuiInterface extends GuiBase {
|
||||
public void drawForeground(int mouseX, int mouseY) {
|
||||
drawString(7, 7, t("gui.refinedstorage:interface.import"));
|
||||
drawString(7, 42, t("gui.refinedstorage:interface.export"));
|
||||
drawString(7, 122, t("gui.refinedstorage:interface.patterns"));
|
||||
drawString(7, 156, t("container.inventory"));
|
||||
drawString(7, 122, t("container.inventory"));
|
||||
}
|
||||
}
|
||||
|
@@ -243,20 +243,6 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
||||
public List<ItemStack> getPatterns() {
|
||||
List<ItemStack> patterns = new ArrayList<ItemStack>();
|
||||
|
||||
for (TileMachine machine : machines) {
|
||||
if (machine instanceof TileInterface) {
|
||||
TileInterface tile = (TileInterface) machine;
|
||||
|
||||
for (int i = 27; i < 27 + 9; ++i) {
|
||||
ItemStack pattern = tile.getStackInSlot(i);
|
||||
|
||||
if (pattern != null) {
|
||||
patterns.add(pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return patterns;
|
||||
}
|
||||
|
||||
|
@@ -17,8 +17,6 @@ import refinedstorage.util.InventoryUtils;
|
||||
public class TileInterface extends TileMachine implements ICompareConfig, ISidedInventory {
|
||||
public static final String NBT_COMPARE = "Compare";
|
||||
|
||||
public static final int SPEED = 3;
|
||||
|
||||
public static final int[] FACES = new int[]{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8
|
||||
};
|
||||
@@ -26,7 +24,8 @@ public class TileInterface extends TileMachine implements ICompareConfig, ISided
|
||||
18, 19, 20, 21, 22, 23, 24, 25, 26
|
||||
};
|
||||
|
||||
private InventorySimple inventory = new InventorySimple("interface", 9 * 4, this);
|
||||
private InventorySimple inventory = new InventorySimple("interface", 9 * 3, this);
|
||||
private InventorySimple upgradesInventory = new InventorySimple("upgrades", 4, this);
|
||||
|
||||
private int compare = 0;
|
||||
|
||||
@@ -37,6 +36,18 @@ public class TileInterface extends TileMachine implements ICompareConfig, ISided
|
||||
return 4;
|
||||
}
|
||||
|
||||
public int getSpeed() {
|
||||
int upgrades = 0;
|
||||
|
||||
for (int i = 0; i < upgradesInventory.getSizeInventory(); ++i) {
|
||||
if (upgradesInventory.getStackInSlot(i) != null) {
|
||||
upgrades++;
|
||||
}
|
||||
}
|
||||
|
||||
return 9 - (upgrades * 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMachine() {
|
||||
if (currentSlot > 8) {
|
||||
@@ -48,7 +59,7 @@ public class TileInterface extends TileMachine implements ICompareConfig, ISided
|
||||
if (slot == null) {
|
||||
currentSlot++;
|
||||
} else {
|
||||
if (ticks % SPEED == 0) {
|
||||
if (ticks % getSpeed() == 0) {
|
||||
ItemStack toPush = slot.copy();
|
||||
toPush.stackSize = 1;
|
||||
|
||||
@@ -108,6 +119,7 @@ public class TileInterface extends TileMachine implements ICompareConfig, ISided
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
InventoryUtils.restoreInventory(this, 0, nbt);
|
||||
InventoryUtils.restoreInventory(upgradesInventory, 1, nbt);
|
||||
|
||||
if (nbt.hasKey(NBT_COMPARE)) {
|
||||
compare = nbt.getInteger(NBT_COMPARE);
|
||||
@@ -119,10 +131,15 @@ public class TileInterface extends TileMachine implements ICompareConfig, ISided
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
InventoryUtils.saveInventory(this, 0, nbt);
|
||||
InventoryUtils.saveInventory(upgradesInventory, 1, nbt);
|
||||
|
||||
nbt.setInteger(NBT_COMPARE, compare);
|
||||
}
|
||||
|
||||
public InventorySimple getUpgradesInventory() {
|
||||
return upgradesInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveContainerData(ByteBuf buf) {
|
||||
super.receiveContainerData(buf);
|
||||
@@ -227,17 +244,6 @@ public class TileInterface extends TileMachine implements ICompareConfig, ISided
|
||||
return inventory.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getDroppedInventory() {
|
||||
InventorySimple dummy = new InventorySimple("dummy", 9);
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
dummy.setInventorySlotContents(i, inventory.getStackInSlot(18 + i));
|
||||
}
|
||||
|
||||
return dummy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
return side == EnumFacing.DOWN ? FACES_DOWN : FACES;
|
||||
|
@@ -20,7 +20,6 @@ gui.refinedstorage:constructor=Constructor
|
||||
gui.refinedstorage:relay=Relay
|
||||
gui.refinedstorage:interface.import=Interface Import
|
||||
gui.refinedstorage:interface.export=Interface Export
|
||||
gui.refinedstorage:interface.patterns=Patterns
|
||||
gui.refinedstorage:crafting_monitor=Crafting Monitor
|
||||
gui.refinedstorage:wireless_transmitter=Wireless Transmitter
|
||||
gui.refinedstorage:wireless_transmitter.distance=%d blocks
|
||||
|
@@ -20,7 +20,6 @@ gui.refinedstorage:constructor=Constructor
|
||||
gui.refinedstorage:relay=Relais
|
||||
gui.refinedstorage:interface.import=Interface Import
|
||||
gui.refinedstorage:interface.export=Interface Export
|
||||
gui.refinedstorage:interface.patterns=Patronen
|
||||
gui.refinedstorage:crafting_monitor=Crafting Monitor
|
||||
gui.refinedstorage:wireless_transmitter=Draadloze Zender
|
||||
gui.refinedstorage:wireless_transmitter.distance=%d blokken
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.0 KiB |
Reference in New Issue
Block a user