From 6b0f5931f685459ad83f26e0d19b648b9fa08b50 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 29 May 2018 15:03:44 +1000 Subject: $ Fixed GUI issue with new super buffers. --- .../api/gui/CONTAINER_ThreadedSuperBuffer.java | 82 ++++++++++++++++++++++ .../gregtech/api/gui/GUI_ThreadedSuperBuffer.java | 19 +++++ 2 files changed, 101 insertions(+) create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_ThreadedSuperBuffer.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_ThreadedSuperBuffer.java (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_ThreadedSuperBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_ThreadedSuperBuffer.java new file mode 100644 index 0000000000..2151e5a109 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_ThreadedSuperBuffer.java @@ -0,0 +1,82 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.util.GT_Utility; +import gregtech.common.tileentities.automation.GT_MetaTileEntity_ChestBuffer; + +import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_ThreadedChestBuffer; + +import net.minecraft.item.ItemStack; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.inventory.IInventory; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; + +public class CONTAINER_ThreadedSuperBuffer extends GT_ContainerMetaTile_Machine { + public CONTAINER_ThreadedSuperBuffer(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(final InventoryPlayer aInventoryPlayer) { + this.addSlotToContainer((Slot) new GT_Slot_Holo((IInventory) this.mTileEntity, 256, 8, 63, false, true, 1)); + this.addSlotToContainer((Slot) new GT_Slot_Holo((IInventory) this.mTileEntity, 256, 26, 63, false, true, 1)); + this.addSlotToContainer((Slot) new GT_Slot_Holo((IInventory) this.mTileEntity, 256, 44, 63, false, true, 1)); + } + + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, + final EntityPlayer aPlayer) { + if (aSlotIndex < 0) { + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + final Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); + if (tSlot != null) { + if (this.mTileEntity.getMetaTileEntity() == null) { + return null; + } + if (aSlotIndex == 0) { + ((GT_MetaTileEntity_ChestBuffer) this.mTileEntity + .getMetaTileEntity()).bOutput = !((GT_MetaTileEntity_ThreadedChestBuffer) this.mTileEntity + .getMetaTileEntity()).bOutput; + if (((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bOutput) { + GT_Utility.sendChatToPlayer(aPlayer, this.trans("116", "Emit Energy to Outputside")); + } else { + GT_Utility.sendChatToPlayer(aPlayer, this.trans("117", "Don't emit Energy")); + } + return null; + } + if (aSlotIndex == 1) { + ((GT_MetaTileEntity_ChestBuffer) this.mTileEntity + .getMetaTileEntity()).bRedstoneIfFull = !((GT_MetaTileEntity_ThreadedChestBuffer) this.mTileEntity + .getMetaTileEntity()).bRedstoneIfFull; + if (((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull) { + GT_Utility.sendChatToPlayer(aPlayer, this.trans("118", "Emit Redstone if no Slot is free")); + } else { + GT_Utility.sendChatToPlayer(aPlayer, this.trans("119", "Don't emit Redstone")); + } + return null; + } + if (aSlotIndex == 2) { + ((GT_MetaTileEntity_ChestBuffer) this.mTileEntity + .getMetaTileEntity()).bInvert = !((GT_MetaTileEntity_ThreadedChestBuffer) this.mTileEntity + .getMetaTileEntity()).bInvert; + if (((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bInvert) { + GT_Utility.sendChatToPlayer(aPlayer, this.trans("120", "Invert Redstone")); + } else { + GT_Utility.sendChatToPlayer(aPlayer, this.trans("121", "Don't invert Redstone")); + } + return null; + } + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + public int getSlotCount() { + return 0; + } + + public int getShiftClickSlotCount() { + return 0; + } +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_ThreadedSuperBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_ThreadedSuperBuffer.java new file mode 100644 index 0000000000..83e96cd85b --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_ThreadedSuperBuffer.java @@ -0,0 +1,19 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; + +public class GUI_ThreadedSuperBuffer extends GT_GUIContainerMetaTile_Machine { + public GUI_ThreadedSuperBuffer(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super((GT_ContainerMetaTile_Machine) new CONTAINER_ThreadedSuperBuffer(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/SuperBuffer.png"); + } + + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } +} \ No newline at end of file -- cgit