mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-28 07:55:41 +00:00
Inventory size can change over time
This commit is contained in:
1 parent
59ef37759a
commit
180287ef22
1 file changed
+4
-8
@@ -137,7 +137,6 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit> {
|
||||
List<Target> sendPriority = new ArrayList<Target>();
|
||||
|
||||
private int extractFromSlot = -1;
|
||||
private int numSlots;
|
||||
|
||||
int tickDeficit;
|
||||
|
||||
@@ -145,7 +144,6 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit> {
|
||||
this.inv = inv;
|
||||
|
||||
inventorySide = conDir.getOpposite().ordinal();
|
||||
numSlots = inv.getSizeInventory();
|
||||
|
||||
this.con = con;
|
||||
this.conDir = conDir;
|
||||
@@ -153,7 +151,6 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit> {
|
||||
|
||||
if(inv instanceof ISidedInventory) {
|
||||
sidedInv = (ISidedInventory) inv;
|
||||
numSlots = sidedInv.getAccessibleSlotsFromSide(inventorySide).length;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -196,7 +193,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit> {
|
||||
return true;
|
||||
}
|
||||
|
||||
private int nextSlot() {
|
||||
private int nextSlot(int numSlots) {
|
||||
++extractFromSlot;
|
||||
if(extractFromSlot >= numSlots || extractFromSlot < 0) {
|
||||
extractFromSlot = 0;
|
||||
@@ -205,7 +202,6 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit> {
|
||||
}
|
||||
|
||||
private boolean tranfserItems() {
|
||||
int size = inv.getSizeInventory();
|
||||
int numSlots = inv.getSizeInventory();
|
||||
ItemStack extractItem = null;
|
||||
|
||||
@@ -213,7 +209,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit> {
|
||||
int slot = -1;
|
||||
int slotChecksPerTick = Math.min(numSlots, MAX_SLOT_CHECK_PER_TICK);
|
||||
for (int i = 0; i < slotChecksPerTick; i++) {
|
||||
int index = nextSlot();
|
||||
int index = nextSlot(numSlots);
|
||||
ItemStack item = inv.getStackInSlot(index);
|
||||
if(canExtractItem(item)) {
|
||||
extractItem = item.copy();
|
||||
@@ -234,15 +230,15 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit> {
|
||||
|
||||
private boolean transferItemsSided() {
|
||||
|
||||
int size = sidedInv.getSizeInventory();
|
||||
int[] slotIndices = sidedInv.getAccessibleSlotsFromSide(inventorySide);
|
||||
int numSlots = slotIndices.length;
|
||||
ItemStack extractItem = null;
|
||||
int maxExtracted = con.getMaximumExtracted();
|
||||
|
||||
int slot = -1;
|
||||
int slotChecksPerTick = Math.min(numSlots, MAX_SLOT_CHECK_PER_TICK);
|
||||
for (int i = 0; i < slotChecksPerTick; i++) {
|
||||
int index = nextSlot();
|
||||
int index = nextSlot(numSlots);
|
||||
slot = slotIndices[index];
|
||||
ItemStack item = sidedInv.getStackInSlot(slot);
|
||||
if(canExtractItem(item)) {
|
||||
|
||||
Reference in new issue
Block a user