From 5f71b411b151117cef8ac21a5b590c59eb86558d Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 4 Aug 2015 10:14:23 +0200 Subject: [PATCH] Made it so that, in the advanced ESD, both filters filter for both pulling and putting --- .../java/ellpeck/actuallyadditions/PLANNED.txt | 3 +++ .../tile/TileEntityInputter.java | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/PLANNED.txt b/src/main/java/ellpeck/actuallyadditions/PLANNED.txt index c48dce756..34ce4d18d 100644 --- a/src/main/java/ellpeck/actuallyadditions/PLANNED.txt +++ b/src/main/java/ellpeck/actuallyadditions/PLANNED.txt @@ -124,3 +124,6 @@ -Only move when you don't look -Teleport you away +-ESD Change + -Have a Button in the ESD that toggles if its slot is getting used or if the Items are just moved directly + -Makes it so that if you have multiple Items to be moved, one can't get stuck in the slot blocking the others diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java index 06c471191..ffbb343f4 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java @@ -165,7 +165,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt else maxSize = this.getInventoryStackLimit(); } //If ESD has enough Space & Item in question is on whitelist - if(tempStack != null && (this.slots[0] == null || (tempStack.isItemEqual(this.slots[0]) && this.slots[0].stackSize < maxSize)) && this.checkFilters(tempStack, true, isPullWhitelist)){ + if(tempStack != null && (this.slots[0] == null || (tempStack.isItemEqual(this.slots[0]) && this.slots[0].stackSize < maxSize)) && this.checkBothFilters(tempStack)){ //Deal with ISided if(theSided != null){ //Check if Item can be inserted from any Side (Because Sidedness gets ignored!) @@ -240,7 +240,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt if(tempStack.getMaxStackSize() < theInventory.getInventoryStackLimit()) maxSize = tempStack.getMaxStackSize(); else maxSize = theInventory.getInventoryStackLimit(); } - if(theInventory.isItemValidForSlot(i, this.slots[0]) && (tempStack == null || (tempStack.isItemEqual(this.slots[0]) && tempStack.stackSize < maxSize)) && this.checkFilters(this.slots[0], false, isPutWhitelist)){ + if(theInventory.isItemValidForSlot(i, this.slots[0]) && (tempStack == null || (tempStack.isItemEqual(this.slots[0]) && tempStack.stackSize < maxSize)) && this.checkBothFilters(this.slots[0])){ if(theSided != null){ for(int j = 0; j < 5; j++){ if(theSided.canInsertItem(i, this.slots[0], j)){ @@ -284,6 +284,16 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt } } + /** + * Checks if one of the filters contains the ItemStack + * (Whitelist or empty Blacklist in one of them always lets the Item through!) + * @param stack The ItemStack + * @return If the Item is filtered correctly + */ + private boolean checkBothFilters(ItemStack stack){ + return this.checkFilter(stack, true, isPullWhitelist) || this.checkFilter(stack, false, isPutWhitelist); + } + /** * Checks the Whitelist/Blacklist to see if Item fits * @param stack The Stack to check for @@ -291,7 +301,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt * @param isWhitelist If it's set to white- or Blacklist * @return Is Item on White-/Blacklist? */ - public boolean checkFilters(ItemStack stack, boolean isPull, boolean isWhitelist){ + private boolean checkFilter(ItemStack stack, boolean isPull, boolean isWhitelist){ if(!this.isAdvanced) return true; int slotStart = isPull ? PULL_FILTER_START : PUT_FILTER_START;