fix ESD not working with the lower bound being something else than 0

Closes #786
This commit is contained in:
Ellpeck 2017-05-28 01:26:08 +02:00
parent ffef81fdaa
commit d84a1b7ba2
2 changed files with 7 additions and 7 deletions

View file

@ -85,7 +85,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
private boolean newPulling(){
for(EnumFacing side : this.placeToPull.keySet()){
WorldUtil.doItemInteraction(this.placeToPull.get(side), this.wrapper, Integer.MAX_VALUE, this.slotToPullStart, this.slotToPullEnd, !this.isAdvanced ? null : this.leftFilter);
WorldUtil.doItemInteraction(this.placeToPull.get(side), this.wrapper, Integer.MAX_VALUE, this.slotToPullStart, this.slotToPullEnd, 0, 1, !this.isAdvanced ? null : this.leftFilter);
if(this.placeToPull instanceof TileEntityItemViewer){
break;
@ -97,7 +97,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
private boolean newPutting(){
if(!this.isAdvanced || this.rightFilter.check(this.slots.getStackInSlot(0))){
for(EnumFacing side : this.placeToPut.keySet()){
WorldUtil.doItemInteraction(this.wrapper, this.placeToPut.get(side), Integer.MAX_VALUE, this.slotToPutStart, this.slotToPutEnd, null);
WorldUtil.doItemInteraction(this.wrapper, this.placeToPut.get(side), Integer.MAX_VALUE, 0, 1, this.slotToPutStart, this.slotToPutEnd, null);
if(this.placeToPut instanceof TileEntityItemViewer){
break;

View file

@ -63,16 +63,16 @@ public final class WorldUtil{
}
public static boolean doItemInteraction(SlotlessableItemHandlerWrapper extractWrapper, SlotlessableItemHandlerWrapper insertWrapper, int maxExtract, FilterSettings filter){
return doItemInteraction(extractWrapper, insertWrapper, maxExtract, 0, Integer.MAX_VALUE, filter);
return doItemInteraction(extractWrapper, insertWrapper, maxExtract, 0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, filter);
}
public static boolean doItemInteraction(SlotlessableItemHandlerWrapper extractWrapper, SlotlessableItemHandlerWrapper insertWrapper, int maxExtract, int slotStart, int slotEnd, FilterSettings filter){
ItemStack theoreticalExtract = extractItem(extractWrapper, maxExtract, true, slotStart, slotEnd, filter);
public static boolean doItemInteraction(SlotlessableItemHandlerWrapper extractWrapper, SlotlessableItemHandlerWrapper insertWrapper, int maxExtract, int extractSlotStart, int extractSlotEnd, int insertSlotStart, int insertSlotEnd, FilterSettings filter){
ItemStack theoreticalExtract = extractItem(extractWrapper, maxExtract, true, extractSlotStart, extractSlotEnd, filter);
if(StackUtil.isValid(theoreticalExtract)){
ItemStack remaining = insertItem(insertWrapper, theoreticalExtract, false, slotStart, slotEnd);
ItemStack remaining = insertItem(insertWrapper, theoreticalExtract, false, insertSlotStart, insertSlotEnd);
if(!ItemStack.areItemStacksEqual(remaining, theoreticalExtract)){
int toExtract = !StackUtil.isValid(remaining) ? StackUtil.getStackSize(theoreticalExtract) : StackUtil.getStackSize(theoreticalExtract)-StackUtil.getStackSize(remaining);
extractItem(extractWrapper, toExtract, false, slotStart, slotEnd, filter);
extractItem(extractWrapper, toExtract, false, extractSlotStart, extractSlotEnd, filter);
return true;
}
}