From bdb6fc4a5410d68cf517dbe90fa49cec45bbda5a Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Mon, 3 Oct 2016 18:08:43 +1000 Subject: % Gotta Re-merge these Changes with those made on my laptop. --- .../gtPlusPlus/core/gui/machine/GUI_Workbench.java | 61 ++++++++++++++++++---- 1 file changed, 50 insertions(+), 11 deletions(-) (limited to 'src/Java/gtPlusPlus/core/gui/machine') diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java index c1b6904cb4..2da4c7bc7c 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java @@ -3,6 +3,7 @@ package gtPlusPlus.core.gui.machine; import gtPlusPlus.core.container.Container_Workbench; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; +import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; @@ -14,28 +15,66 @@ import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GUI_Workbench extends GuiContainer { - + private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/Workbench.png"); - + + public boolean moveItemsToChest = false; + public boolean moveItemsToCrafting = false; + public GUI_Workbench(InventoryPlayer player_inventory, TileEntityWorkbench tile){ - super(new Container_Workbench(player_inventory, tile)); -} + super(new Container_Workbench(player_inventory, tile)); + } @Override protected void drawGuiContainerForegroundLayer(int i, int j){ //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752); - //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); - + //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); + } @Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.mc.renderEngine.bindTexture(craftingTableGuiTextures); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + } + + + //This method is called when the Gui is first called! + @Override + public void initGui() + { + //You have to add this line for the Gui to function properly! + super.initGui(); + + //The parameters of GuiButton are(id, x, y, width, height, text); + this.buttonList.add(new GuiButton( 1, 367, 132, 18, 18, "X")); + this.buttonList.add(new GuiButton( 2, 385, 132, 18, 18, "Y")); + //NOTE: the id always has to be different or else it might get called twice or never! + + //Add any other buttons here too! } + + @Override + protected void actionPerformed(GuiButton B) + { + //If the button id is different, or you have mrs buttons, create another if block for that too! + if(B.id == 1){ + System.out.println("Trying to empty crafting grid to the storage compartment."); + moveItemsToChest = true; + ((Container_Workbench) this.inventorySlots).moveCraftingToChest(); + } + else if(B.id == 2){ + System.out.println("Trying to move items into the crafting grid."); + moveItemsToCrafting = true; + ((Container_Workbench) this.inventorySlots).moveChestToCrafting(); + } + + + } + } \ No newline at end of file -- cgit