diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/gui')
7 files changed, 106 insertions, 109 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 af3c8a226e..cf1811781a 100644 --- a/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java +++ b/src/Java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java @@ -1,9 +1,9 @@ package gtPlusPlus.core.gui.beta; -import gtPlusPlus.core.interfaces.IGuiManagerMiscUtils; - 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(); @@ -17,25 +17,25 @@ public class Gui_ID_Registry //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) + private static void registerGuiHandlers(final Gui_Types MU_GuiType, final List<Class<? extends IGuiManagerMiscUtils>> guiHandlerClasses) { - for (Class<? extends IGuiManagerMiscUtils> tileGuiHandlerClass : guiHandlerClasses) + for (final Class<? extends IGuiManagerMiscUtils> tileGuiHandlerClass : guiHandlerClasses) { - MU_GuiId guiId = new MU_GuiId(nextId++, MU_GuiType, tileGuiHandlerClass); + final 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(IGuiManagerMiscUtils guiHandler) + public static MU_GuiId getGuiIdForGuiHandler(final IGuiManagerMiscUtils guiHandler) { - Class<? extends IGuiManagerMiscUtils> guiHandlerClass = guiHandler.getClass(); - MU_GuiId guiId = (MU_GuiId)classMap.get(guiHandlerClass); + final Class<? extends IGuiManagerMiscUtils> guiHandlerClass = guiHandler.getClass(); + MU_GuiId guiId = classMap.get(guiHandlerClass); if (guiId == null) { - for (Map.Entry<Class<? extends IGuiManagerMiscUtils>, MU_GuiId> classGuiIdEntry : classMap.entrySet()) { + for (final Map.Entry<Class<? extends IGuiManagerMiscUtils>, MU_GuiId> classGuiIdEntry : classMap.entrySet()) { if (((Class)classGuiIdEntry.getKey()).isAssignableFrom(guiHandlerClass)) { - guiId = (MU_GuiId)classGuiIdEntry.getValue(); + guiId = classGuiIdEntry.getValue(); break; } } @@ -46,9 +46,9 @@ public class Gui_ID_Registry return guiId; } - public static MU_GuiId getGuiId(int id) + public static MU_GuiId getGuiId(final int id) { - return (MU_GuiId)idMap.get(Integer.valueOf(id)); + return 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 428cae93d5..9348f40c9c 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 +{ + 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..116ad48480 100644 --- a/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java +++ b/src/Java/gtPlusPlus/core/gui/beta/MU_GuiId.java @@ -2,31 +2,31 @@ 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; - } - } +{ + 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 Gui_Types getGuiType() + { + return this.MU_GuiType; + } + + public Class<? extends IGuiManagerMiscUtils> getGuiHandlerClass() + { + return this.guiHandlerClass; + } + + 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 cd7b141bd4..fb42cd7cf5 100644 --- a/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java +++ b/src/Java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java @@ -1,5 +1,8 @@ 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; @@ -11,22 +14,19 @@ import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; -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; + + /** 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/ */ @@ -35,7 +35,7 @@ public class GuiBaseBackpack extends GuiContainer /** The inventory to render on screen */ private final BaseInventoryBackpack inventory; - public GuiBaseBackpack(Container_BackpackBase containerItem) + public GuiBaseBackpack(final Container_BackpackBase containerItem) { super(containerItem); this.inventory = containerItem.inventory; @@ -45,20 +45,20 @@ public class GuiBaseBackpack extends GuiContainer * Draws the screen and all the components in it. */ @Override - public void drawScreen(int par1, int par2, float par3) + public void drawScreen(final int par1, final int par2, final float par3) { super.drawScreen(par1, par2, par3); - this.xSize_lo = (float)par1; - this.ySize_lo = (float)par2; + this.xSize_lo = par1; + this.ySize_lo = par2; } /** * Draw the foreground layer for the GuiContainer (everything in front of the items) */ @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - String s = this.inventory.hasCustomInventoryName() ? this.inventory.getInventoryName() : this.inventory.getInventoryName(); + 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); } @@ -67,32 +67,32 @@ public class GuiBaseBackpack extends GuiContainer * Draw the background layer for the GuiContainer (everything behind the items) */ @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + 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(iconLocation); - int k = (this.width - this.xSize) / 2; - int l = (this.height - this.ySize) / 2; + 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); - int i1; - drawPlayerModel(k + 51, l + 75, 30, (float)(k + 51) - this.xSize_lo, (float)(l + 75 - 50) - this.ySize_lo, this.mc.thePlayer); + final int i1; + drawPlayerModel(k + 51, l + 75, 30, k + 51 - this.xSize_lo, (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) */ - 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); diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_FishTrap.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_FishTrap.java index 81a37d2751..ed2fc204f0 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_FishTrap.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_FishTrap.java @@ -1,5 +1,9 @@ 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_FishTrap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; @@ -7,23 +11,18 @@ 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_FishTrap extends GuiContainer { private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/FishTrap.png"); - public GUI_FishTrap(InventoryPlayer player_inventory, TileEntityFishTrap te){ + public GUI_FishTrap(final InventoryPlayer player_inventory, final TileEntityFishTrap te){ super(new Container_FishTrap(player_inventory, te)); } @Override - protected void drawGuiContainerForegroundLayer(int i, int j){ + 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); @@ -31,12 +30,12 @@ public class GUI_FishTrap extends GuiContainer { @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(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); } diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java index 86388a2632..54ff675411 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java @@ -1,5 +1,9 @@ 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; @@ -8,26 +12,21 @@ 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"); - + public boolean moveItemsToChest = false; public boolean moveItemsToCrafting = false; - public GUI_Workbench(InventoryPlayer player_inventory, TileEntityWorkbench tile){ + 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){ + 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); @@ -35,12 +34,12 @@ public class GUI_Workbench extends GuiContainer { @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(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); } @@ -60,7 +59,7 @@ public class GUI_Workbench extends GuiContainer { } @Override - protected void actionPerformed(GuiButton B) + 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){ diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java index 5c04acf13b..eec2fa4b35 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java @@ -1,5 +1,9 @@ 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; @@ -7,35 +11,30 @@ 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"); - 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){ + 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); } @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(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); } }
\ No newline at end of file |