Make interface slower as well

This commit is contained in:
Raoul Van den Berge
2016-03-27 10:19:20 +02:00
parent 32b4085d70
commit ca12a9c464

View File

@@ -15,6 +15,15 @@ import refinedstorage.util.InventoryUtils;
public class TileInterface extends TileMachine implements ICompareSetting, ISidedInventory { public class TileInterface extends TileMachine implements ICompareSetting, ISidedInventory {
public static final String NBT_COMPARE = "Compare"; 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
};
public static final int[] FACES_DOWN = new int[]{
18, 19, 20, 21, 22, 23, 24, 25, 26
};
private InventorySimple inventory = new InventorySimple("interface", 9 * 3); private InventorySimple inventory = new InventorySimple("interface", 9 * 3);
private int compare = 0; private int compare = 0;
@@ -28,27 +37,22 @@ public class TileInterface extends TileMachine implements ICompareSetting, ISide
@Override @Override
public void updateMachine() { public void updateMachine() {
if (ticks % 5 == 0) { if (currentSlot > 8) {
ItemStack slot; currentSlot = 0;
}
while ((slot = inventory.getStackInSlot(currentSlot)) == null) { ItemStack slot = getStackInSlot(currentSlot);
currentSlot++;
if (currentSlot > 8) {
break;
}
}
if (slot != null) {
if (getController().push(slot)) {
inventory.setInventorySlotContents(currentSlot, null);
}
}
if (slot == null) {
currentSlot++; currentSlot++;
} else {
if (ticks % SPEED == 0) {
ItemStack toPush = slot.copy();
toPush.stackSize = 1;
if (currentSlot > 8) { if (getController().push(toPush)) {
currentSlot = 0; decrStackSize(currentSlot, 1);
}
} }
} }
@@ -229,17 +233,7 @@ public class TileInterface extends TileMachine implements ICompareSetting, ISide
@Override @Override
public int[] getSlotsForFace(EnumFacing side) { public int[] getSlotsForFace(EnumFacing side) {
if (side == EnumFacing.DOWN) { return side == EnumFacing.DOWN ? FACES_DOWN : FACES;
return new int[]
{
18, 19, 20, 21, 22, 23, 24, 25, 26
};
}
return new int[]
{
0, 1, 2, 3, 4, 5, 6, 7, 8
};
} }
@Override @Override