Only add things to smart item laser relay whitelist when they aren't on it yet

This commit is contained in:
Ellpeck 2016-06-10 17:53:11 +02:00
parent a26db02ebe
commit 1b40bd3568
2 changed files with 23 additions and 32 deletions

View file

@ -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<IItemHandler> 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;
}
}
}
}

View file

@ -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 <p> at.
info.actuallyadditions.inputter.info.2=This is the slot after the last Slot in the connected Inventory to <p> at. What that means: If you, for example, write 2 in the field to the left and 5 in this one, it will <p> 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.