diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java index 5f6d2fc92..d586d4b19 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java @@ -172,8 +172,8 @@ public class GuiInputter extends GuiContainer{ this.mc.getTextureManager().bindTexture(this.isAdvanced ? resLocAdvanced : resLoc); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93+(this.isAdvanced ? OFFSET_ADVANCED : 0)); - this.fontRendererObj.drawString(StringUtil.localize("info."+ModUtil.MOD_ID+".gui.pull"), this.guiLeft+22+3, this.guiTop+32+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); - this.fontRendererObj.drawString(StringUtil.localize("info."+ModUtil.MOD_ID+".gui.put"), this.guiLeft+107+3, this.guiTop+32+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); + this.fontRendererObj.drawString("INBOUND", this.guiLeft+23+3, this.guiTop+32+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); + this.fontRendererObj.drawString("OUTBOUND", this.guiLeft+104+3, this.guiTop+32+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); this.fontRendererObj.drawString(sideString[this.tileInputter.sideToPull+1], this.guiLeft+24+1, this.guiTop+45+3+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); this.fontRendererObj.drawString(sideString[this.tileInputter.sideToPut+1], this.guiLeft+109+1, this.guiTop+45+3+(this.isAdvanced ? OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java index c084879e7..4cab85831 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiLaserRelayItemWhitelist.java @@ -55,11 +55,13 @@ public class GuiLaserRelayItemWhitelist extends GuiContainer{ this.whitelistLeft = new SmallerButton(0, this.guiLeft+3, this.guiTop+16, ""); this.whitelistRight = new SmallerButton(1, this.guiLeft+157, this.guiTop+16, ""); - SmallerButton smartWhitelist = new SmallerButton(2, this.guiLeft+80, this.guiTop+33, "S"); + SmallerButton smartWhitelistLeft = new SmallerButton(2, this.guiLeft+3, this.guiTop+34, "S"); + SmallerButton smartWhitelistRight = new SmallerButton(3, this.guiLeft+157, this.guiTop+34, "S"); this.buttonList.add(this.whitelistLeft); this.buttonList.add(this.whitelistRight); - this.buttonList.add(smartWhitelist); + this.buttonList.add(smartWhitelistLeft); + this.buttonList.add(smartWhitelistRight); } @Override @@ -90,7 +92,7 @@ public class GuiLaserRelayItemWhitelist extends GuiContainer{ list.addAll(infoList); this.drawHoveringText(list, x, y); } - if(x >= this.guiLeft+80 && y >= this.guiTop+33 && x <= this.guiLeft+95 && y <= this.guiTop+46){ + if(((x >= this.guiLeft+3 && x <= this.guiLeft+3+15) || (x >= this.guiLeft+157 && x <= this.guiLeft+157+15)) && y <= this.guiTop+34+15 && y >= this.guiTop+34){ List list = new ArrayList(); list.add(TextFormatting.BOLD+StringUtil.localize("info."+ModUtil.MOD_ID+".gui.smart")); list.addAll(this.fontRendererObj.listFormattedStringToWidth(StringUtil.localize("info."+ModUtil.MOD_ID+".gui.smartInfo"), 200)); @@ -101,6 +103,11 @@ public class GuiLaserRelayItemWhitelist extends GuiContainer{ @Override public void drawGuiContainerForegroundLayer(int x, int y){ AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tile.name); + + String s1 = "INBOUND"; + String s2 = "OUTBOUND"; + this.fontRendererObj.drawString(s1, 46-this.fontRendererObj.getStringWidth(s1)/2, 80, StringUtil.DECIMAL_COLOR_GRAY_TEXT); + this.fontRendererObj.drawString(s2, 131-this.fontRendererObj.getStringWidth(s2)/2, 80, StringUtil.DECIMAL_COLOR_GRAY_TEXT); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java index fcd91c5b8..cd8d15711 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInputter.java @@ -114,7 +114,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt } } //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.checkBothFilters(tempStack)){ + if(tempStack != null && (this.slots[0] == null || (tempStack.isItemEqual(this.slots[0]) && this.slots[0].stackSize < maxSize)) && this.checkBothFilters(tempStack, false)){ //Deal with ISided if(theSided != null){ //Check if Item can be inserted from any Side (Because Sidedness gets ignored!) @@ -203,7 +203,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt maxSize = theInventory.getInventoryStackLimit(); } } - if(theInventory.isItemValidForSlot(i, this.slots[0]) && (tempStack == null || (tempStack.isItemEqual(this.slots[0]) && tempStack.stackSize < maxSize)) && this.checkBothFilters(this.slots[0])){ + if(theInventory.isItemValidForSlot(i, this.slots[0]) && (tempStack == null || (tempStack.isItemEqual(this.slots[0]) && tempStack.stackSize < maxSize)) && this.checkBothFilters(this.slots[0], true)){ if(theSided != null){ for(int j = 0; j <= 5; j++){ if(theSided.canInsertItem(i, this.slots[0], EnumFacing.values()[j])){ @@ -260,13 +260,12 @@ 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, this.isPullWhitelist) || this.checkFilter(stack, false, this.isPutWhitelist); + private boolean checkBothFilters(ItemStack stack, boolean output){ + return this.checkFilter(stack, !output, output ? this.isPutWhitelist : this.isPullWhitelist); } /** diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java index e58cad08f..a480a4697 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityItemViewer.java @@ -91,7 +91,7 @@ public class TileEntityItemViewer extends TileEntityInventoryBase{ public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction){ SpecificItemHandlerInfo handler = this.getSwitchedIndexHandler(index); if(handler != null){ - if(this.isWhitelisted(handler, stack)){ + if(this.isWhitelisted(handler, stack, true)){ if(ItemStack.areItemsEqual(handler.handler.getStackInSlot(handler.switchedIndex), stack)){ ItemStack gaveBack = handler.handler.extractItem(handler.switchedIndex, stack.stackSize, true); return gaveBack != null; @@ -101,11 +101,11 @@ public class TileEntityItemViewer extends TileEntityInventoryBase{ return false; } - private boolean isWhitelisted(SpecificItemHandlerInfo handler, ItemStack stack){ - boolean whitelisted = handler.relayInQuestion.isWhitelisted(stack); + private boolean isWhitelisted(SpecificItemHandlerInfo handler, ItemStack stack, boolean output){ + boolean whitelisted = handler.relayInQuestion.isWhitelisted(stack, output); TileEntityLaserRelayItem connected = this.getConnectedRelay(); if(connected != null && connected != handler.relayInQuestion){ - return whitelisted && connected.isWhitelisted(stack); + return whitelisted && connected.isWhitelisted(stack, !output); } else{ return whitelisted; @@ -116,7 +116,7 @@ public class TileEntityItemViewer extends TileEntityInventoryBase{ public boolean isItemValidForSlot(int index, ItemStack stack){ SpecificItemHandlerInfo handler = this.getSwitchedIndexHandler(index); if(handler != null){ - if(this.isWhitelisted(handler, stack)){ + if(this.isWhitelisted(handler, stack, false)){ ItemStack gaveBack = handler.handler.insertItem(handler.switchedIndex, stack, true); return !ItemStack.areItemStacksEqual(gaveBack, stack); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java index 7f9d5d87b..3663f7d49 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItem.java @@ -32,7 +32,7 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay{ this("laserRelayItem"); } - public boolean isWhitelisted(ItemStack stack){ + public boolean isWhitelisted(ItemStack stack, boolean output){ return true; } 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 324c62a8d..c8226572e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayItemWhitelist.java @@ -20,6 +20,7 @@ import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.items.IItemHandler; +import java.util.Arrays; import java.util.List; public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem implements IButtonReactor{ @@ -162,8 +163,8 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem } @Override - public boolean isWhitelisted(ItemStack stack){ - return this.checkFilter(stack, true, this.isLeftWhitelist) || this.checkFilter(stack, false, this.isRightWhitelist); + public boolean isWhitelisted(ItemStack stack, boolean output){ + return this.checkFilter(stack, !output, output ? this.isRightWhitelist : this.isLeftWhitelist); } private boolean checkFilter(ItemStack stack, boolean left, boolean isWhitelist){ @@ -207,18 +208,24 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem this.isRightWhitelist = !this.isRightWhitelist; } else if(buttonID == 2){ - this.addWhitelistSmart(); + this.addWhitelistSmart(false); + } + else if(buttonID == 3){ + this.addWhitelistSmart(true); } } - private void addWhitelistSmart(){ + private void addWhitelistSmart(boolean output){ + int slotStart = output ? 12 : 0; + int slotStop = slotStart+12; + List handlers = this.getAllHandlersAround(); for(IItemHandler handler : handlers){ for(int i = 0; i < handler.getSlots(); i++){ ItemStack stack = handler.getStackInSlot(i); if(stack != null){ - if(!ItemUtil.contains(this.slots, stack, false)){ - for(int j = 0; j < this.slots.length; j++){ + if(!ItemUtil.contains(Arrays.copyOfRange(this.slots, slotStart, slotStop), stack, false)){ + for(int j = slotStart; j < slotStop; j++){ if(this.slots[j] == null || this.slots[j].stackSize <= 0){ ItemStack whitelistStack = stack.copy(); whitelistStack.stackSize = 1; diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 47948f748..7f83ae618 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -541,10 +541,10 @@ 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 the white- and blacklist. First, the left side will be completely filled, and if there's more items, they will go to the right side. +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. 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=This applies for this part of the white-/blacklist. The other side applies as well, so you can have some Items whitelisted and some blacklisted. Note that, if you have an empty blacklist or an item whitelisted on at least one side, it will always go through. +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 in the slots. info.actuallyadditions.noLens=No Lens info.actuallyadditions.booklet.manualName.1=Actually Additions info.actuallyadditions.booklet.manualName.2=Manual