From 1b40bd3568b7981f139738da6d6245fd8e74c59c Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 10 Jun 2016 17:53:11 +0200 Subject: [PATCH] Only add things to smart item laser relay whitelist when they aren't on it yet --- .../TileEntityLaserRelayItemWhitelist.java | 53 ++++++++----------- .../assets/actuallyadditions/lang/en_US.lang | 2 +- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java index 62e14241d..1c0910207 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java @@ -233,17 +233,6 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem int slotStart = output ? 12 : 0; int slotStop = slotStart+12; - for(int i = slotStart; i < slotStop; i++){ - if(this.slots[i] != null){ - if(this.slots[i].getItem() instanceof ItemFilter){ - ItemDrill.writeSlotsToNBT(new ItemStack[ContainerFilter.SLOT_AMOUNT], this.slots[i]); - } - else{ - this.slots[i] = null; - } - } - } - List handlers = this.getAllHandlersAround(); for(IItemHandler handler : handlers){ for(int i = 0; i < handler.getSlots(); i++){ @@ -252,32 +241,34 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem ItemStack copy = stack.copy(); copy.stackSize = 1; - for(int k = slotStart; k < slotStop; k++){ - if(this.slots[k] != null){ - if(this.slots[k].getItem() instanceof ItemFilter){ - ItemStack[] filterSlots = new ItemStack[ContainerFilter.SLOT_AMOUNT]; - ItemDrill.loadSlotsFromNBT(filterSlots, this.slots[k]); + if(!checkFilter(copy, true, this.slots, slotStart, slotStop)){ + for(int k = slotStart; k < slotStop; k++){ + if(this.slots[k] != null){ + if(this.slots[k].getItem() instanceof ItemFilter){ + ItemStack[] filterSlots = new ItemStack[ContainerFilter.SLOT_AMOUNT]; + ItemDrill.loadSlotsFromNBT(filterSlots, this.slots[k]); - boolean did = false; - if(filterSlots != null && filterSlots.length > 0){ - for(int j = 0; j < filterSlots.length; j++){ - if(filterSlots[j] == null || filterSlots[j].stackSize <= 0){ - filterSlots[j] = copy; - did = true; - break; + boolean did = false; + if(filterSlots != null && filterSlots.length > 0){ + for(int j = 0; j < filterSlots.length; j++){ + if(filterSlots[j] == null || filterSlots[j].stackSize <= 0){ + filterSlots[j] = copy; + did = true; + break; + } } } - } - if(did){ - ItemDrill.writeSlotsToNBT(filterSlots, this.slots[k]); - break; + if(did){ + ItemDrill.writeSlotsToNBT(filterSlots, this.slots[k]); + break; + } } } - } - else{ - this.slots[k] = copy; - break; + else{ + this.slots[k] = copy; + break; + } } } } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 436e1cf78..ab1a733ea 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -543,7 +543,7 @@ info.actuallyadditions.gui.coffee=Coffee info.actuallyadditions.gui.ok=Ok info.actuallyadditions.gui.the=the info.actuallyadditions.gui.smart=Smart Whitelist -info.actuallyadditions.gui.smartInfo=When pressing this, all items from inventories adjacent to this relay will be added to this part of the white- or blacklist. Adding Item Filters to the list before will cause them to also be filled. Caution: Non-Item Filters previously added to the list will be removed and Item Filters will be cleared! +info.actuallyadditions.gui.smartInfo=When pressing this, all items from inventories adjacent to this relay will be added to this part of the white- or blacklist. Adding Item Filters to the list before will cause them to also be filled. info.actuallyadditions.inputter.info.1=This is the first Slot in the connected Inventory to

at. info.actuallyadditions.inputter.info.2=This is the slot after the last Slot in the connected Inventory to

at. What that means: If you, for example, write 2 in the field to the left and 5 in this one, it will

at Slot 2, 3, and 4. info.actuallyadditions.inputter.whitelistInfo=When pressing this, this side's whitelist mode will be changed. To let all items through, an empty blacklist can be used, to let no items through, an empty whitelist can be used. To configure certain items, place them or configured Item Filters in the slots.