From bf3e00c9e92a726eb87682c369298e94ad4dd3fd Mon Sep 17 00:00:00 2001 From: mezz Date: Mon, 23 May 2016 00:30:15 -0700 Subject: [PATCH] Add icons for liquid input and output slots --- .../gui/ContainerAlvearyHygroregulator.java | 4 ++-- .../java/forestry/core/gui/ContainerAnalyzer.java | 3 ++- .../core/gui/slots/SlotEmptyLiquidContainerIn.java | 12 ++++++++++++ .../java/forestry/core/gui/slots/SlotFiltered.java | 10 +++++++++- .../java/forestry/core/gui/slots/SlotLiquidIn.java | 12 ++++++++++++ .../forestry/energy/gui/ContainerEngineBiogas.java | 4 ++-- .../java/forestry/energy/gui/ContainerGenerator.java | 4 ++-- .../java/forestry/factory/gui/ContainerBottler.java | 7 ++++--- .../forestry/factory/gui/ContainerCarpenter.java | 3 ++- .../forestry/factory/gui/ContainerFermenter.java | 6 ++++-- .../java/forestry/factory/gui/ContainerRaintank.java | 4 ++-- .../java/forestry/factory/gui/ContainerSqueezer.java | 3 ++- .../java/forestry/factory/gui/ContainerStill.java | 7 ++++--- .../java/forestry/farming/gui/ContainerFarm.java | 3 ++- 14 files changed, 61 insertions(+), 21 deletions(-) create mode 100644 src/main/java/forestry/core/gui/slots/SlotEmptyLiquidContainerIn.java create mode 100644 src/main/java/forestry/core/gui/slots/SlotLiquidIn.java diff --git a/src/main/java/forestry/apiculture/gui/ContainerAlvearyHygroregulator.java b/src/main/java/forestry/apiculture/gui/ContainerAlvearyHygroregulator.java index 4292cc6dc..87d639bdc 100755 --- a/src/main/java/forestry/apiculture/gui/ContainerAlvearyHygroregulator.java +++ b/src/main/java/forestry/apiculture/gui/ContainerAlvearyHygroregulator.java @@ -15,14 +15,14 @@ import net.minecraft.entity.player.InventoryPlayer; import forestry.apiculture.inventory.InventoryHygroregulator; import forestry.apiculture.multiblock.TileAlvearyHygroregulator; import forestry.core.gui.ContainerLiquidTanks; -import forestry.core.gui.slots.SlotFiltered; +import forestry.core.gui.slots.SlotLiquidIn; public class ContainerAlvearyHygroregulator extends ContainerLiquidTanks { public ContainerAlvearyHygroregulator(InventoryPlayer playerInventory, TileAlvearyHygroregulator tile) { super(tile, playerInventory, 8, 84); - this.addSlotToContainer(new SlotFiltered(tile, InventoryHygroregulator.SLOT_INPUT, 56, 38)); + this.addSlotToContainer(new SlotLiquidIn(tile, InventoryHygroregulator.SLOT_INPUT, 56, 38)); } } diff --git a/src/main/java/forestry/core/gui/ContainerAnalyzer.java b/src/main/java/forestry/core/gui/ContainerAnalyzer.java index cc942d58c..8fc01ecd1 100755 --- a/src/main/java/forestry/core/gui/ContainerAnalyzer.java +++ b/src/main/java/forestry/core/gui/ContainerAnalyzer.java @@ -13,6 +13,7 @@ package forestry.core.gui; import net.minecraft.entity.player.InventoryPlayer; import forestry.core.gui.slots.SlotFiltered; +import forestry.core.gui.slots.SlotLiquidIn; import forestry.core.gui.slots.SlotOutput; import forestry.core.gui.slots.SlotWorking; import forestry.core.inventory.InventoryAnalyzer; @@ -34,7 +35,7 @@ public class ContainerAnalyzer extends ContainerLiquidTanks { addSlotToContainer(new SlotWorking(tile, InventoryAnalyzer.SLOT_ANALYZE, 73, 59)); // Can slot - addSlotToContainer(new SlotFiltered(tile, InventoryAnalyzer.SLOT_CAN, 143, 24)); + addSlotToContainer(new SlotLiquidIn(tile, InventoryAnalyzer.SLOT_CAN, 143, 24)); // Output buffer for (int i = 0; i < 2; i++) { diff --git a/src/main/java/forestry/core/gui/slots/SlotEmptyLiquidContainerIn.java b/src/main/java/forestry/core/gui/slots/SlotEmptyLiquidContainerIn.java new file mode 100644 index 000000000..9071a93a4 --- /dev/null +++ b/src/main/java/forestry/core/gui/slots/SlotEmptyLiquidContainerIn.java @@ -0,0 +1,12 @@ +package forestry.core.gui.slots; + +import net.minecraft.inventory.IInventory; + +import forestry.core.tiles.IFilterSlotDelegate; + +public class SlotEmptyLiquidContainerIn extends SlotFiltered { + public SlotEmptyLiquidContainerIn(T inventory, int slotIndex, int xPos, int yPos) { + super(inventory, slotIndex, xPos, yPos); + setBackgroundTexture("slots/container"); + } +} diff --git a/src/main/java/forestry/core/gui/slots/SlotFiltered.java b/src/main/java/forestry/core/gui/slots/SlotFiltered.java index 83f171b44..cc41c58dd 100644 --- a/src/main/java/forestry/core/gui/slots/SlotFiltered.java +++ b/src/main/java/forestry/core/gui/slots/SlotFiltered.java @@ -24,8 +24,9 @@ import forestry.core.tiles.IFilterSlotDelegate; * Slot which only takes specific items, specified by the IFilterSlotDelegate. */ public class SlotFiltered extends SlotWatched { - private String blockedTexture = "slots/blocked"; private final IFilterSlotDelegate filterSlotDelegate; + private String backgroundTexture = null; + private String blockedTexture = "slots/blocked"; public SlotFiltered(T inventory, int slotIndex, int xPos, int yPos) { super(inventory, slotIndex, xPos, yPos); @@ -49,12 +50,19 @@ public class SlotFiltered extends SlotWatched { return this; } + public SlotFiltered setBackgroundTexture(String backgroundTexture) { + this.backgroundTexture = backgroundTexture; + return this; + } + @SideOnly(Side.CLIENT) @Override public TextureAtlasSprite getBackgroundSprite() { ItemStack stack = getStack(); if (!isItemValid(stack)) { return TextureManager.getInstance().getDefault(blockedTexture); + } else if (backgroundTexture != null) { + return TextureManager.getInstance().getDefault(backgroundTexture); } else { return null; } diff --git a/src/main/java/forestry/core/gui/slots/SlotLiquidIn.java b/src/main/java/forestry/core/gui/slots/SlotLiquidIn.java new file mode 100644 index 000000000..ddb12b1db --- /dev/null +++ b/src/main/java/forestry/core/gui/slots/SlotLiquidIn.java @@ -0,0 +1,12 @@ +package forestry.core.gui.slots; + +import net.minecraft.inventory.IInventory; + +import forestry.core.tiles.IFilterSlotDelegate; + +public class SlotLiquidIn extends SlotFiltered { + public SlotLiquidIn(T inventory, int slotIndex, int xPos, int yPos) { + super(inventory, slotIndex, xPos, yPos); + setBackgroundTexture("slots/liquid"); + } +} diff --git a/src/main/java/forestry/energy/gui/ContainerEngineBiogas.java b/src/main/java/forestry/energy/gui/ContainerEngineBiogas.java index e8f615167..1ef1d4bb6 100644 --- a/src/main/java/forestry/energy/gui/ContainerEngineBiogas.java +++ b/src/main/java/forestry/energy/gui/ContainerEngineBiogas.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; import forestry.core.gui.ContainerLiquidTanks; -import forestry.core.gui.slots.SlotFiltered; +import forestry.core.gui.slots.SlotLiquidIn; import forestry.energy.inventory.InventoryEngineBiogas; import forestry.energy.tiles.TileEngineBiogas; @@ -23,7 +23,7 @@ public class ContainerEngineBiogas extends ContainerLiquidTanks { public ContainerGenerator(InventoryPlayer player, TileEuGenerator tile) { super(tile, player, 8, 84); - this.addSlotToContainer(new SlotFiltered(tile, InventoryGenerator.SLOT_CAN, 22, 38)); + this.addSlotToContainer(new SlotLiquidIn(tile, InventoryGenerator.SLOT_CAN, 22, 38)); } @Override diff --git a/src/main/java/forestry/factory/gui/ContainerBottler.java b/src/main/java/forestry/factory/gui/ContainerBottler.java index a04323ad7..0a423cc49 100755 --- a/src/main/java/forestry/factory/gui/ContainerBottler.java +++ b/src/main/java/forestry/factory/gui/ContainerBottler.java @@ -13,7 +13,8 @@ package forestry.factory.gui; import net.minecraft.entity.player.InventoryPlayer; import forestry.core.gui.ContainerLiquidTanks; -import forestry.core.gui.slots.SlotFiltered; +import forestry.core.gui.slots.SlotEmptyLiquidContainerIn; +import forestry.core.gui.slots.SlotLiquidIn; import forestry.core.gui.slots.SlotOutput; import forestry.factory.inventory.InventoryBottler; import forestry.factory.tiles.TileBottler; @@ -23,8 +24,8 @@ public class ContainerBottler extends ContainerLiquidTanks { public ContainerBottler(InventoryPlayer player, TileBottler tile) { super(tile, player, 8, 84); - this.addSlotToContainer(new SlotFiltered(tile, InventoryBottler.SLOT_INPUT_EMPTY_CAN, 116, 19)); + this.addSlotToContainer(new SlotEmptyLiquidContainerIn(tile, InventoryBottler.SLOT_INPUT_EMPTY_CAN, 116, 19)); this.addSlotToContainer(new SlotOutput(tile, InventoryBottler.SLOT_OUTPUT, 116, 55)); - this.addSlotToContainer(new SlotFiltered(tile, InventoryBottler.SLOT_INPUT_FULL_CAN, 26, 38)); + this.addSlotToContainer(new SlotLiquidIn(tile, InventoryBottler.SLOT_INPUT_FULL_CAN, 26, 38)); } } diff --git a/src/main/java/forestry/factory/gui/ContainerCarpenter.java b/src/main/java/forestry/factory/gui/ContainerCarpenter.java index c9791ab4d..ee5d405cb 100755 --- a/src/main/java/forestry/factory/gui/ContainerCarpenter.java +++ b/src/main/java/forestry/factory/gui/ContainerCarpenter.java @@ -19,6 +19,7 @@ import forestry.core.gui.ContainerLiquidTanks; import forestry.core.gui.IContainerCrafting; import forestry.core.gui.slots.SlotCraftMatrix; import forestry.core.gui.slots.SlotFiltered; +import forestry.core.gui.slots.SlotLiquidIn; import forestry.core.gui.slots.SlotLocked; import forestry.core.gui.slots.SlotOutput; import forestry.core.network.packets.PacketItemStackDisplay; @@ -38,7 +39,7 @@ public class ContainerCarpenter extends ContainerLiquidTanks impl } // Liquid Input - this.addSlotToContainer(new SlotFiltered(tile, InventoryCarpenter.SLOT_CAN_INPUT, 120, 20)); + this.addSlotToContainer(new SlotLiquidIn(tile, InventoryCarpenter.SLOT_CAN_INPUT, 120, 20)); // Boxes this.addSlotToContainer(new SlotFiltered(tile, InventoryCarpenter.SLOT_BOX, 83, 20)); // Product diff --git a/src/main/java/forestry/factory/gui/ContainerFermenter.java b/src/main/java/forestry/factory/gui/ContainerFermenter.java index 6e61d7d0c..5fcfb1c48 100755 --- a/src/main/java/forestry/factory/gui/ContainerFermenter.java +++ b/src/main/java/forestry/factory/gui/ContainerFermenter.java @@ -14,7 +14,9 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; import forestry.core.gui.ContainerLiquidTanks; +import forestry.core.gui.slots.SlotEmptyLiquidContainerIn; import forestry.core.gui.slots.SlotFiltered; +import forestry.core.gui.slots.SlotLiquidIn; import forestry.core.gui.slots.SlotOutput; import forestry.factory.inventory.InventoryFermenter; import forestry.factory.tiles.TileFermenter; @@ -27,8 +29,8 @@ public class ContainerFermenter extends ContainerLiquidTanks { this.addSlotToContainer(new SlotFiltered(fermenter, InventoryFermenter.SLOT_RESOURCE, 85, 23)); this.addSlotToContainer(new SlotFiltered(fermenter, InventoryFermenter.SLOT_FUEL, 75, 57)); this.addSlotToContainer(new SlotOutput(fermenter, InventoryFermenter.SLOT_CAN_OUTPUT, 150, 58)); - this.addSlotToContainer(new SlotFiltered(fermenter, InventoryFermenter.SLOT_CAN_INPUT, 150, 22)); - this.addSlotToContainer(new SlotFiltered(fermenter, InventoryFermenter.SLOT_INPUT, 10, 40)); + this.addSlotToContainer(new SlotEmptyLiquidContainerIn(fermenter, InventoryFermenter.SLOT_CAN_INPUT, 150, 22)); + this.addSlotToContainer(new SlotLiquidIn(fermenter, InventoryFermenter.SLOT_INPUT, 10, 40)); } @Override diff --git a/src/main/java/forestry/factory/gui/ContainerRaintank.java b/src/main/java/forestry/factory/gui/ContainerRaintank.java index e61ea0968..5e3153ebc 100755 --- a/src/main/java/forestry/factory/gui/ContainerRaintank.java +++ b/src/main/java/forestry/factory/gui/ContainerRaintank.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; import forestry.core.gui.ContainerLiquidTanks; -import forestry.core.gui.slots.SlotFiltered; +import forestry.core.gui.slots.SlotEmptyLiquidContainerIn; import forestry.core.gui.slots.SlotOutput; import forestry.factory.inventory.InventoryRaintank; import forestry.factory.tiles.TileRaintank; @@ -24,7 +24,7 @@ public class ContainerRaintank extends ContainerLiquidTanks { public ContainerRaintank(InventoryPlayer player, TileRaintank tile) { super(tile, player, 8, 84); - this.addSlotToContainer(new SlotFiltered(tile, InventoryRaintank.SLOT_RESOURCE, 116, 19)); + this.addSlotToContainer(new SlotEmptyLiquidContainerIn(tile, InventoryRaintank.SLOT_RESOURCE, 116, 19)); this.addSlotToContainer(new SlotOutput(tile, InventoryRaintank.SLOT_PRODUCT, 116, 55)); } diff --git a/src/main/java/forestry/factory/gui/ContainerSqueezer.java b/src/main/java/forestry/factory/gui/ContainerSqueezer.java index 1ff7180e8..1c02def00 100755 --- a/src/main/java/forestry/factory/gui/ContainerSqueezer.java +++ b/src/main/java/forestry/factory/gui/ContainerSqueezer.java @@ -14,6 +14,7 @@ import net.minecraft.entity.player.InventoryPlayer; import forestry.core.gui.ContainerLiquidTanksSocketed; import forestry.core.gui.slots.SlotFiltered; +import forestry.core.gui.slots.SlotLiquidIn; import forestry.core.gui.slots.SlotOutput; import forestry.factory.inventory.InventorySqueezer; import forestry.factory.tiles.TileSqueezer; @@ -34,7 +35,7 @@ public class ContainerSqueezer extends ContainerLiquidTanksSocketed { super(tile, player, 8, 84); this.addSlotToContainer(new SlotOutput(tile, InventoryStill.SLOT_PRODUCT, 150, 54)); - this.addSlotToContainer(new SlotFiltered(tile, InventoryStill.SLOT_RESOURCE, 150, 18)); - this.addSlotToContainer(new SlotFiltered(tile, InventoryStill.SLOT_CAN, 10, 36)); + this.addSlotToContainer(new SlotEmptyLiquidContainerIn(tile, InventoryStill.SLOT_RESOURCE, 150, 18)); + this.addSlotToContainer(new SlotLiquidIn(tile, InventoryStill.SLOT_CAN, 10, 36)); } } diff --git a/src/main/java/forestry/farming/gui/ContainerFarm.java b/src/main/java/forestry/farming/gui/ContainerFarm.java index 13d34e3a9..52911661f 100755 --- a/src/main/java/forestry/farming/gui/ContainerFarm.java +++ b/src/main/java/forestry/farming/gui/ContainerFarm.java @@ -16,6 +16,7 @@ import net.minecraftforge.fluids.IFluidTank; import forestry.core.gui.ContainerSocketed; import forestry.core.gui.slots.SlotFiltered; +import forestry.core.gui.slots.SlotLiquidIn; import forestry.core.gui.slots.SlotOutput; import forestry.core.network.packets.PacketGuiUpdate; import forestry.farming.multiblock.InventoryFarm; @@ -57,7 +58,7 @@ public class ContainerFarm extends ContainerSocketed { // Fertilizer addSlotToContainer(new SlotFiltered(tile, InventoryFarm.SLOT_FERTILIZER, 63, 95)); // Can Slot - addSlotToContainer(new SlotFiltered(tile, InventoryFarm.SLOT_CAN, 15, 95)); + addSlotToContainer(new SlotLiquidIn(tile, InventoryFarm.SLOT_CAN, 15, 95)); } @Override