This PR is meant to fix the voiding bug seen in #2548 where conveyors with the round robin with priority IO mode voids items.
Implementation Details
The root cause of the bug is explained here, which is essentially that we don't keep track of how much space is left in a machine/inventory when we do a dry run, so sequential dry runs think that they can insert more than they actually can (which results in us extracting/voiding the excess amount.)
Outcome
The initial version of this MR opts to keep track of what we are inserting during a dry run via a simulatedRemainingCapacityRoundRobin, which is a Object2IntMap<FacingPos>. I also updated some variable names to better show what they do.
This initial implementation does not fully work - I was hoping to push it and get some feedback/assistance as I'm new to the repo/modding GT in general, so am not sure about certain standards/etc...
The main question I have is: What is the best way to get the free input inventory space in a machine/block/chest/etc...?
currently I am doing this via:
int freeInventoryInSubRoute = 0;
int slots = routePath.getHandler().getSlots();
for (int i = 0; i < slots; i++) {
int slotLimit = routePath.getHandler().getSlotLimit(i);
ItemStack testStackToInsert = stack.copy();
testStackToInsert.setCount(slotLimit);
ItemStack insertedTest = routePath.getHandler().insertItem(i, testStackToInsert, true);
ItemStack stackInSlot = routePath.getHandler().getStackInSlot(i);
freeInventoryInSubRoute += slotLimit - insertedTest.getCount();
}
but this feels hacky? not sure if there is a better way (I was looking around the code, but wasn't finding anything)
Still TODO (in addition to the above questions ^), want to finish these before this PR is fully "ready to go" (not a WIP)
[ ] fix niche cases
[ ] fully comment code
[ ] create tests
[ ] break certain blocks of code out into smaller functions
What
This PR is meant to fix the voiding bug seen in #2548 where conveyors with the
round robin with priority
IO mode voids items.Implementation Details
The root cause of the bug is explained here, which is essentially that we don't keep track of how much space is left in a machine/inventory when we do a dry run, so sequential dry runs think that they can insert more than they actually can (which results in us extracting/voiding the excess amount.)
Outcome
The initial version of this MR opts to keep track of what we are inserting during a dry run via a
simulatedRemainingCapacityRoundRobin
, which is aObject2IntMap<FacingPos>
. I also updated some variable names to better show what they do.This initial implementation does not fully work - I was hoping to push it and get some feedback/assistance as I'm new to the repo/modding GT in general, so am not sure about certain standards/etc...
The main question I have is: What is the best way to get the free input inventory space in a machine/block/chest/etc...?
currently I am doing this via:
but this feels hacky? not sure if there is a better way (I was looking around the code, but wasn't finding anything)
Still TODO (in addition to the above questions ^), want to finish these before this PR is fully "ready to go" (not a WIP)