diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/gui')
8 files changed, 264 insertions, 258 deletions
diff --git a/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java b/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java index 89ac13b697..c59d26a1fa 100644 --- a/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java +++ b/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java @@ -4,38 +4,35 @@ import java.util.*; import gtPlusPlus.core.interfaces.IGuiManagerMiscUtils; -public class Gui_ID_Registry -{ - private static final Map<Class<? extends IGuiManagerMiscUtils>, MU_GuiId> classMap = new HashMap(); - private static final Map<Integer, MU_GuiId> idMap = new HashMap(); - private static int nextId = 0; - - static - { - //registerGuiHandlers(Gui_Types.Tile, Arrays.asList(new Class[] {TileAlveary.class})); - //registerGuiHandlers(MU_GuiType.Item, Arrays.asList(new Class[] { ItemBackpack.class, ItemBackpackNaturalist.class, ItemBeealyzer.class, ItemCatalogue.class, ItemFlutterlyzer.class, ItemHabitatLocator.class, ItemImprinter.class, ItemInfuser.class, ItemLetter.class, ItemSolderingIron.class, ItemTreealyzer.class })); - //registerGuiHandlers(MU_GuiType.Entity, Arrays.asList(new Class[] { EntityMinecartApiary.class, EntityMinecartBeehouse.class })); +public class Gui_ID_Registry { + private static final Map<Class<? extends IGuiManagerMiscUtils>, MU_GuiId> classMap = new HashMap(); + private static final Map<Integer, MU_GuiId> idMap = new HashMap(); + private static int nextId = 0; + + static { + // registerGuiHandlers(Gui_Types.Tile, Arrays.asList(new Class[] + // {TileAlveary.class})); + // registerGuiHandlers(MU_GuiType.Item, Arrays.asList(new Class[] { + // ItemBackpack.class, ItemBackpackNaturalist.class, + // ItemBeealyzer.class, ItemCatalogue.class, ItemFlutterlyzer.class, + // ItemHabitatLocator.class, ItemImprinter.class, ItemInfuser.class, + // ItemLetter.class, ItemSolderingIron.class, ItemTreealyzer.class })); + // registerGuiHandlers(MU_GuiType.Entity, Arrays.asList(new Class[] { + // EntityMinecartApiary.class, EntityMinecartBeehouse.class })); } - private static void registerGuiHandlers(Gui_Types MU_GuiType, List<Class<? extends IGuiManagerMiscUtils>> guiHandlerClasses) - { - for (Class<? extends IGuiManagerMiscUtils> tileGuiHandlerClass : guiHandlerClasses) - { - MU_GuiId guiId = new MU_GuiId(nextId++, MU_GuiType, tileGuiHandlerClass); - classMap.put(tileGuiHandlerClass, guiId); - idMap.put(Integer.valueOf(guiId.getId()), guiId); - } + public static MU_GuiId getGuiId(final int id) { + return Gui_ID_Registry.idMap.get(Integer.valueOf(id)); } - public static MU_GuiId getGuiIdForGuiHandler(IGuiManagerMiscUtils guiHandler) - { - Class<? extends IGuiManagerMiscUtils> guiHandlerClass = guiHandler.getClass(); - MU_GuiId guiId = (MU_GuiId)classMap.get(guiHandlerClass); + public static MU_GuiId getGuiIdForGuiHandler(final IGuiManagerMiscUtils guiHandler) { + final Class<? extends IGuiManagerMiscUtils> guiHandlerClass = guiHandler.getClass(); + MU_GuiId guiId = Gui_ID_Registry.classMap.get(guiHandlerClass); if (guiId == null) { - for (Map.Entry<Class<? extends IGuiManagerMiscUtils>, MU_GuiId> classGuiIdEntry : classMap.entrySet()) { - if (((Class)classGuiIdEntry.getKey()).isAssignableFrom(guiHandlerClass)) - { - guiId = (MU_GuiId)classGuiIdEntry.getValue(); + for (final Map.Entry<Class<? extends IGuiManagerMiscUtils>, MU_GuiId> classGuiIdEntry : Gui_ID_Registry.classMap + .entrySet()) { + if (((Class) classGuiIdEntry.getKey()).isAssignableFrom(guiHandlerClass)) { + guiId = classGuiIdEntry.getValue(); break; } } @@ -46,9 +43,13 @@ public class Gui_ID_Registry return guiId; } - public static MU_GuiId getGuiId(int id) - { - return (MU_GuiId)idMap.get(Integer.valueOf(id)); + private static void registerGuiHandlers(final Gui_Types MU_GuiType, + final List<Class<? extends IGuiManagerMiscUtils>> guiHandlerClasses) { + for (final Class<? extends IGuiManagerMiscUtils> tileGuiHandlerClass : guiHandlerClasses) { + final MU_GuiId guiId = new MU_GuiId(Gui_ID_Registry.nextId++, MU_GuiType, tileGuiHandlerClass); + Gui_ID_Registry.classMap.put(tileGuiHandlerClass, guiId); + Gui_ID_Registry.idMap.put(Integer.valueOf(guiId.getId()), guiId); + } } } diff --git a/src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java b/src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java index 428cae93d5..5bf5bc3018 100644 --- a/src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java +++ b/src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java @@ -1,8 +1,8 @@ package gtPlusPlus.core.gui.beta; -public enum Gui_Types - { - Item, Tile, Entity; - - private Gui_Types() {} - }
\ No newline at end of file +public enum Gui_Types { + Item, Tile, Entity; + + private Gui_Types() { + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java b/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java index 7d17870743..0e1f47d456 100644 --- a/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java +++ b/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java @@ -1,32 +1,27 @@ package gtPlusPlus.core.gui.beta; + import gtPlusPlus.core.interfaces.IGuiManagerMiscUtils; -public class MU_GuiId - { - private final int id; - private final Gui_Types MU_GuiType; - private final Class<? extends IGuiManagerMiscUtils> guiHandlerClass; - - MU_GuiId(int id, Gui_Types MU_GuiType, Class<? extends IGuiManagerMiscUtils> guiHandlerClass) - { - this.id = id; - this.MU_GuiType = MU_GuiType; - this.guiHandlerClass = guiHandlerClass; - } - - public Gui_Types getGuiType() - { - return this.MU_GuiType; - } - - public Class<? extends IGuiManagerMiscUtils> getGuiHandlerClass() - { - return this.guiHandlerClass; - } - - public int getId() - { - return this.id; - } - } +public class MU_GuiId { + private final int id; + private final Gui_Types MU_GuiType; + private final Class<? extends IGuiManagerMiscUtils> guiHandlerClass; + + MU_GuiId(final int id, final Gui_Types MU_GuiType, final Class<? extends IGuiManagerMiscUtils> guiHandlerClass) { + this.id = id; + this.MU_GuiType = MU_GuiType; + this.guiHandlerClass = guiHandlerClass; + } + + public Class<? extends IGuiManagerMiscUtils> getGuiHandlerClass() { + return this.guiHandlerClass; + } + + public Gui_Types getGuiType() { + return this.MU_GuiType; + } + public int getId() { + return this.id; + } +} diff --git a/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java b/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java index 263e9d58fa..75bc38a57c 100644 --- a/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java +++ b/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java @@ -14,85 +14,33 @@ import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; -public class GuiBaseBackpack extends GuiContainer -{ - /** x and y size of the inventory window in pixels. Defined as float, passed as int - * These are used for drawing the player model. */ - private float xSize_lo; - private float ySize_lo; - - /** The FontRenderer used by GuiScreen */ - protected FontRenderer fontRenderer; - - /** ResourceLocation takes 2 parameters: ModId, path to texture at the location: - * "src/minecraft/assets/modid/" - * - * I have provided a sample texture file that works with this tutorial. Download it - * from Forge_Tutorials/textures/gui/ - */ - private static final ResourceLocation iconLocation = new ResourceLocation(CORE.MODID, "textures/gui/itemBackpack.png"); - - /** The inventory to render on screen */ - private final BaseInventoryBackpack inventory; - - public GuiBaseBackpack(Container_BackpackBase containerItem) - { - super(containerItem); - this.inventory = containerItem.inventory; - } - - /** - * Draws the screen and all the components in it. - */ - @Override - public void drawScreen(int par1, int par2, float par3) - { - super.drawScreen(par1, par2, par3); - this.xSize_lo = (float)par1; - this.ySize_lo = (float)par2; - } - - /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) - */ - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { - String s = this.inventory.hasCustomInventoryName() ? this.inventory.getInventoryName() : this.inventory.getInventoryName(); - //this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 0, 4210752); - //this.fontRenderer.drawString(I18n.translate("container.inventory"), 26, this.ySize - 96 + 4, 4210752); - } - +public class GuiBaseBackpack extends GuiContainer { /** - * Draw the background layer for the GuiContainer (everything behind the items) + * ResourceLocation takes 2 parameters: ModId, path to texture at the + * location: "src/minecraft/assets/modid/" + * + * I have provided a sample texture file that works with this tutorial. + * Download it from Forge_Tutorials/textures/gui/ */ - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(iconLocation); - int k = (this.width - this.xSize) / 2; - int l = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - int i1; - drawPlayerModel(k + 51, l + 75, 30, (float)(k + 51) - this.xSize_lo, (float)(l + 75 - 50) - this.ySize_lo, this.mc.thePlayer); - } - + private static final ResourceLocation iconLocation = new ResourceLocation(CORE.MODID, + "textures/gui/itemBackpack.png"); /** - * This renders the player model in standard inventory position (in later versions of Minecraft / Forge, you can - * simply call GuiInventory.drawEntityOnScreen directly instead of copying this code) + * This renders the player model in standard inventory position (in later + * versions of Minecraft / Forge, you can simply call + * GuiInventory.drawEntityOnScreen directly instead of copying this code) */ - public static void drawPlayerModel(int x, int y, int scale, float yaw, float pitch, EntityLivingBase entity) { + public static void drawPlayerModel(final int x, final int y, final int scale, final float yaw, final float pitch, + final EntityLivingBase entity) { GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix(); GL11.glTranslatef(x, y, 50.0F); GL11.glScalef(-scale, scale, scale); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - float f2 = entity.renderYawOffset; - float f3 = entity.rotationYaw; - float f4 = entity.rotationPitch; - float f5 = entity.prevRotationYawHead; - float f6 = entity.rotationYawHead; + final float f2 = entity.renderYawOffset; + final float f3 = entity.rotationYaw; + final float f4 = entity.rotationPitch; + final float f5 = entity.prevRotationYawHead; + final float f6 = entity.rotationYawHead; GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); @@ -117,4 +65,63 @@ public class GuiBaseBackpack extends GuiContainer GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); } + + /** + * x and y size of the inventory window in pixels. Defined as float, passed + * as int These are used for drawing the player model. + */ + private float xSize_lo; + + private float ySize_lo; + + /** The FontRenderer used by GuiScreen */ + protected FontRenderer fontRenderer; + + /** The inventory to render on screen */ + private final BaseInventoryBackpack inventory; + + public GuiBaseBackpack(final Container_BackpackBase containerItem) { + super(containerItem); + this.inventory = containerItem.inventory; + } + + /** + * Draw the background layer for the GuiContainer (everything behind the + * items) + */ + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(GuiBaseBackpack.iconLocation); + final int k = (this.width - this.xSize) / 2; + final int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + final int i1; + GuiBaseBackpack.drawPlayerModel(k + 51, l + 75, 30, k + 51 - this.xSize_lo, l + 75 - 50 - this.ySize_lo, + this.mc.thePlayer); + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of + * the items) + */ + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + final String s = this.inventory.hasCustomInventoryName() ? this.inventory.getInventoryName() + : this.inventory.getInventoryName(); + // this.fontRenderer.drawString(s, this.xSize / 2 - + // this.fontRenderer.getStringWidth(s) / 2, 0, 4210752); + // this.fontRenderer.drawString(I18n.translate("container.inventory"), + // 26, this.ySize - 96 + 4, 4210752); + } + + /** + * Draws the screen and all the components in it. + */ + @Override + public void drawScreen(final int par1, final int par2, final float par3) { + super.drawScreen(par1, par2, par3); + this.xSize_lo = par1; + this.ySize_lo = par2; + } } diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_Charger.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_Charger.java index 27f0dc5c04..62e2da7420 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_Charger.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_Charger.java @@ -12,39 +12,40 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; -public class GUI_Charger extends GuiContainer -{ - private ResourceLocation texture = new ResourceLocation(CORE.MODID, "textures/gui/machine_Charger.png"); - - private InventoryPlayer inventory; - private TileEntityCharger te; - - public GUI_Charger(TileEntityCharger te, EntityPlayer player) - { - super(new Container_Charger(te, player)); - inventory = player.inventory; - this.te = te; - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { - Minecraft.getMinecraft().renderEngine.bindTexture(texture); - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { - fontRendererObj.drawString(I18n.format(te.getInventoryName()), (xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2), 6, 4210752, false); - //fontRendererObj.drawString(I18n.format(inventory.getInventoryName()), 8, ySize - 96 + 2, 4210752); - fontRendererObj.drawString(I18n.format("Charge:"+te.getCharge()+"~"), 8, ySize - 96 + 2, 4210752); - fontRendererObj.drawString(I18n.format("Progress:"+te.getProgress()+"ticks"), 80, ySize - 96 + 2, 4210752); - } +public class GUI_Charger extends GuiContainer { + private final ResourceLocation texture = new ResourceLocation(CORE.MODID, "textures/gui/machine_Charger.png"); + + private final InventoryPlayer inventory; + private final TileEntityCharger te; + + public GUI_Charger(final TileEntityCharger te, final EntityPlayer player) { + super(new Container_Charger(te, player)); + this.inventory = player.inventory; + this.te = te; + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + Minecraft.getMinecraft().renderEngine.bindTexture(this.texture); + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + 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); + } + + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.fontRendererObj.drawString(I18n.format(this.te.getInventoryName()), + this.xSize / 2 - this.fontRendererObj.getStringWidth(I18n.format(this.te.getInventoryName())) / 2, 6, + 4210752, false); + // fontRendererObj.drawString(I18n.format(inventory.getInventoryName()), + // 8, ySize - 96 + 2, 4210752); + this.fontRendererObj.drawString(I18n.format("Charge:" + this.te.getCharge() + "~"), 8, this.ySize - 96 + 2, + 4210752); + this.fontRendererObj.drawString(I18n.format("Progress:" + this.te.getProgress() + "ticks"), 80, + this.ySize - 96 + 2, 4210752); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_NHG.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_NHG.java index acfe8fcc3b..f9346886fd 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_NHG.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_NHG.java @@ -12,39 +12,41 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; -public class GUI_NHG extends GuiContainer -{ - private ResourceLocation texture = new ResourceLocation(CORE.MODID, "textures/gui/helium_collector_gui_12.png"); - - private InventoryPlayer inventory; - private TileEntityNHG te; - - public GUI_NHG(TileEntityNHG te, EntityPlayer player) - { - super(new Container_NHG(te, player)); - inventory = player.inventory; - this.te = te; - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { - Minecraft.getMinecraft().renderEngine.bindTexture(texture); - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { - fontRendererObj.drawString(I18n.format(te.getInventoryName()), (xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2), 6, 4210752, false); - //fontRendererObj.drawString(I18n.format(inventory.getInventoryName()), 8, ySize - 96 + 2, 4210752); - fontRendererObj.drawString(I18n.format("CoreTemp:"+te.getCoreTemp()+"K"), 8, ySize - 96 + 2, 4210752); - fontRendererObj.drawString(I18n.format("Progress:"+te.getProgress()+"ticks"), 80, ySize - 96 + 2, 4210752); - } +public class GUI_NHG extends GuiContainer { + private final ResourceLocation texture = new ResourceLocation(CORE.MODID, + "textures/gui/helium_collector_gui_12.png"); + + private final InventoryPlayer inventory; + private final TileEntityNHG te; + + public GUI_NHG(final TileEntityNHG te, final EntityPlayer player) { + super(new Container_NHG(te, player)); + this.inventory = player.inventory; + this.te = te; + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + Minecraft.getMinecraft().renderEngine.bindTexture(this.texture); + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + 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); + } + + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.fontRendererObj.drawString(I18n.format(this.te.getInventoryName()), + this.xSize / 2 - this.fontRendererObj.getStringWidth(I18n.format(this.te.getInventoryName())) / 2, 6, + 4210752, false); + // fontRendererObj.drawString(I18n.format(inventory.getInventoryName()), + // 8, ySize - 96 + 2, 4210752); + this.fontRendererObj.drawString(I18n.format("CoreTemp:" + this.te.getCoreTemp() + "K"), 8, this.ySize - 96 + 2, + 4210752); + this.fontRendererObj.drawString(I18n.format("Progress:" + this.te.getProgress() + "ticks"), 80, + this.ySize - 96 + 2, 4210752); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java index 6c108312b4..ed092f14d8 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java @@ -15,65 +15,64 @@ import net.minecraft.util.ResourceLocation; @SideOnly(Side.CLIENT) public class GUI_Workbench extends GuiContainer { - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/BronzeCraftingTable.png"); - - public boolean moveItemsToChest = false; - public boolean moveItemsToCrafting = false; + private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, + "textures/gui/BronzeCraftingTable.png"); - public GUI_Workbench(InventoryPlayer player_inventory, TileEntityWorkbench tile){ + public boolean moveItemsToChest = false; + public boolean moveItemsToCrafting = false; + + public GUI_Workbench(final InventoryPlayer player_inventory, final TileEntityWorkbench 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); + protected void actionPerformed(final 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(); + } } - @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); + protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j) { + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.mc.renderEngine.bindTexture(GUI_Workbench.craftingTableGuiTextures); + 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); } - - //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! + protected void drawGuiContainerForegroundLayer(final int i, final 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); - //Add any other buttons here too! } + // This method is called when the Gui is first called! @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(); - } + 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! } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java index 34b5472f32..3b24ccb02c 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java @@ -14,27 +14,28 @@ import net.minecraft.util.ResourceLocation; @SideOnly(Side.CLIENT) public class GUI_WorkbenchAdvanced extends GuiContainer { - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/AdvancedCraftingTable.png"); + private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, + "textures/gui/AdvancedCraftingTable.png"); - public GUI_WorkbenchAdvanced(InventoryPlayer player_inventory, TileEntityWorkbenchAdvanced tile){ + public GUI_WorkbenchAdvanced(final InventoryPlayer player_inventory, final TileEntityWorkbenchAdvanced tile) { super(new Container_WorkbenchAdvanced(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); + protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j) { + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.mc.renderEngine.bindTexture(GUI_WorkbenchAdvanced.craftingTableGuiTextures); + 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); } - @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); + protected void drawGuiContainerForegroundLayer(final int i, final 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); } }
\ No newline at end of file |
