From cbe0e497be8e466c380a5b4fa781b314ede9ada3 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Sun, 6 Nov 2016 19:32:27 +1000 Subject: Revert "$ Cleaned up the entire project." This reverts commit 0669f5eb9d5029a8b94ec552171b0837605f7747. # Conflicts: # src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java # src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java Revert "% Cleaned up Imports." This reverts commit 3654052fb63a571c5eaca7f20714b87c17f7e966. --- .../gtPlusPlus/core/gui/beta/Gui_ID_Registry.java | 67 ++++----- src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java | 12 +- src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java | 51 +++---- .../gtPlusPlus/core/gui/item/GuiBaseBackpack.java | 153 ++++++++++----------- .../gtPlusPlus/core/gui/machine/GUI_Charger.java | 73 +++++----- src/Java/gtPlusPlus/core/gui/machine/GUI_NHG.java | 74 +++++----- .../gtPlusPlus/core/gui/machine/GUI_Workbench.java | 90 ++++++------ .../core/gui/machine/GUI_WorkbenchAdvanced.java | 36 ++--- 8 files changed, 277 insertions(+), 279 deletions(-) (limited to 'src/Java/gtPlusPlus/core/gui') 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 c59d26a1fa..b3531ceb3e 100644 --- a/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java +++ b/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java @@ -1,38 +1,43 @@ package gtPlusPlus.core.gui.beta; -import java.util.*; - import gtPlusPlus.core.interfaces.IGuiManagerMiscUtils; -public class Gui_ID_Registry { - private static final Map, MU_GuiId> classMap = new HashMap(); - private static final Map 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 })); +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class Gui_ID_Registry +{ + private static final Map, MU_GuiId> classMap = new HashMap(); + private static final Map 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 static MU_GuiId getGuiId(final int id) { - return Gui_ID_Registry.idMap.get(Integer.valueOf(id)); + private static void registerGuiHandlers(Gui_Types MU_GuiType, List> guiHandlerClasses) + { + for (Class 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 getGuiIdForGuiHandler(final IGuiManagerMiscUtils guiHandler) { - final Class guiHandlerClass = guiHandler.getClass(); - MU_GuiId guiId = Gui_ID_Registry.classMap.get(guiHandlerClass); + public static MU_GuiId getGuiIdForGuiHandler(IGuiManagerMiscUtils guiHandler) + { + Class guiHandlerClass = guiHandler.getClass(); + MU_GuiId guiId = (MU_GuiId)classMap.get(guiHandlerClass); if (guiId == null) { - for (final Map.Entry, MU_GuiId> classGuiIdEntry : Gui_ID_Registry.classMap - .entrySet()) { - if (((Class) classGuiIdEntry.getKey()).isAssignableFrom(guiHandlerClass)) { - guiId = classGuiIdEntry.getValue(); + for (Map.Entry, MU_GuiId> classGuiIdEntry : classMap.entrySet()) { + if (((Class)classGuiIdEntry.getKey()).isAssignableFrom(guiHandlerClass)) + { + guiId = (MU_GuiId)classGuiIdEntry.getValue(); break; } } @@ -43,13 +48,9 @@ public class Gui_ID_Registry { return guiId; } - private static void registerGuiHandlers(final Gui_Types MU_GuiType, - final List> guiHandlerClasses) { - for (final Class 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); - } + public static MU_GuiId getGuiId(int id) + { + return (MU_GuiId)idMap.get(Integer.valueOf(id)); } } diff --git a/src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java b/src/Java/gtPlusPlus/core/gui/beta/Gui_Types.java index 5bf5bc3018..428cae93d5 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 0e1f47d456..7d17870743 100644 --- a/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java +++ b/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java @@ -1,27 +1,32 @@ 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 guiHandlerClass; - - MU_GuiId(final int id, final Gui_Types MU_GuiType, final Class guiHandlerClass) { - this.id = id; - this.MU_GuiType = MU_GuiType; - this.guiHandlerClass = guiHandlerClass; - } - - public Class getGuiHandlerClass() { - return this.guiHandlerClass; - } - - public Gui_Types getGuiType() { - return this.MU_GuiType; - } +public class MU_GuiId + { + private final int id; + private final Gui_Types MU_GuiType; + private final Class guiHandlerClass; + + MU_GuiId(int id, Gui_Types MU_GuiType, Class guiHandlerClass) + { + this.id = id; + this.MU_GuiType = MU_GuiType; + this.guiHandlerClass = guiHandlerClass; + } + + public Gui_Types getGuiType() + { + return this.MU_GuiType; + } + + public Class getGuiHandlerClass() + { + return this.guiHandlerClass; + } + + public int getId() + { + return this.id; + } + } - 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 75bc38a57c..cd7b141bd4 100644 --- a/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java +++ b/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java @@ -1,8 +1,5 @@ package gtPlusPlus.core.gui.item; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - import gtPlusPlus.core.container.Container_BackpackBase; import gtPlusPlus.core.inventories.BaseInventoryBackpack; import gtPlusPlus.core.lib.CORE; @@ -14,33 +11,88 @@ import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; -public class GuiBaseBackpack extends GuiContainer { +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +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; + } + /** - * 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/ + * Draws the screen and all the components in it. */ - private static final ResourceLocation iconLocation = new ResourceLocation(CORE.MODID, - "textures/gui/itemBackpack.png"); + @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); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + @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); + } + /** - * 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(final int x, final int y, final int scale, final float yaw, final float pitch, - final EntityLivingBase entity) { + public static void drawPlayerModel(int x, int y, int scale, float yaw, float pitch, 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); - 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; + float f2 = entity.renderYawOffset; + float f3 = entity.rotationYaw; + float f4 = entity.rotationPitch; + float f5 = entity.prevRotationYawHead; + 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); @@ -65,63 +117,4 @@ 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 62e2da7420..c1f687c554 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_Charger.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_Charger.java @@ -1,7 +1,5 @@ package gtPlusPlus.core.gui.machine; -import org.lwjgl.opengl.GL11; - import gtPlusPlus.core.container.Container_Charger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.machines.TileEntityCharger; @@ -12,40 +10,41 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; -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); - } +import org.lwjgl.opengl.GL11; - @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); - } +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); + } } \ 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 f9346886fd..09b2ee93d8 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_NHG.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_NHG.java @@ -1,7 +1,5 @@ package gtPlusPlus.core.gui.machine; -import org.lwjgl.opengl.GL11; - import gtPlusPlus.core.container.Container_NHG; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.machines.TileEntityNHG; @@ -12,41 +10,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 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); - } +import org.lwjgl.opengl.GL11; - @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); - } +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); + } } \ 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 ed092f14d8..86388a2632 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java @@ -1,9 +1,5 @@ package gtPlusPlus.core.gui.machine; -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.container.Container_Workbench; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; @@ -12,67 +8,73 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +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/BronzeCraftingTable.png"); + private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/BronzeCraftingTable.png"); + + public boolean moveItemsToChest = false; + public boolean moveItemsToCrafting = false; - public boolean moveItemsToChest = false; - public boolean moveItemsToCrafting = false; - - public GUI_Workbench(final InventoryPlayer player_inventory, final TileEntityWorkbench tile) { + public GUI_Workbench(InventoryPlayer player_inventory, TileEntityWorkbench tile){ super(new Container_Workbench(player_inventory, tile)); } + @Override - 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(); - } + 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); } + @Override - 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); + 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); } + + //This method is called when the Gui is first called! @Override - 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); + 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! } - // 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(); + 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(); + } - // 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 3b24ccb02c..5c04acf13b 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java @@ -1,9 +1,5 @@ package gtPlusPlus.core.gui.machine; -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.container.Container_WorkbenchAdvanced; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; @@ -11,31 +7,35 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + @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(final InventoryPlayer player_inventory, final TileEntityWorkbenchAdvanced tile) { + public GUI_WorkbenchAdvanced(InventoryPlayer player_inventory, TileEntityWorkbenchAdvanced tile){ super(new Container_WorkbenchAdvanced(player_inventory, tile)); } + @Override - 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); + 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); } + @Override - 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); + 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); } } \ No newline at end of file -- cgit