diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/core/gui')
24 files changed, 338 insertions, 292 deletions
diff --git a/src/main/java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java b/src/main/java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java index d36de4bf28..601f91b3e9 100644 --- a/src/main/java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java +++ b/src/main/java/gtPlusPlus/core/gui/beta/Gui_ID_Registry.java @@ -1,13 +1,14 @@ package gtPlusPlus.core.gui.beta; -import gtPlusPlus.core.interfaces.IGuiManagerMiscUtils; import java.util.HashMap; import java.util.List; import java.util.Map; +import gtPlusPlus.core.interfaces.IGuiManagerMiscUtils; + public class Gui_ID_Registry { - private static final Map<Class<? extends IGuiManagerMiscUtils>, MU_GuiId> classMap = - new HashMap<Class<? extends IGuiManagerMiscUtils>, MU_GuiId>(); + + private static final Map<Class<? extends IGuiManagerMiscUtils>, MU_GuiId> classMap = new HashMap<Class<? extends IGuiManagerMiscUtils>, MU_GuiId>(); private static final Map<Integer, MU_GuiId> idMap = new HashMap<Integer, MU_GuiId>(); private static int nextId = 0; @@ -21,8 +22,8 @@ public class Gui_ID_Registry { // EntityMinecartBeehouse.class })); } - private static void registerGuiHandlers( - final Gui_Types MU_GuiType, final List<Class<? extends IGuiManagerMiscUtils>> guiHandlerClasses) { + 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(nextId++, MU_GuiType, tileGuiHandlerClass); classMap.put(tileGuiHandlerClass, guiId); @@ -34,8 +35,8 @@ public class Gui_ID_Registry { final Class<? extends IGuiManagerMiscUtils> guiHandlerClass = guiHandler.getClass(); MU_GuiId guiId = classMap.get(guiHandlerClass); if (guiId == null) { - for (final 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 = classGuiIdEntry.getValue(); break; diff --git a/src/main/java/gtPlusPlus/core/gui/beta/Gui_Types.java b/src/main/java/gtPlusPlus/core/gui/beta/Gui_Types.java index bb095e74c0..f0bf946b23 100644 --- a/src/main/java/gtPlusPlus/core/gui/beta/Gui_Types.java +++ b/src/main/java/gtPlusPlus/core/gui/beta/Gui_Types.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.gui.beta; public enum Gui_Types { + Item, Tile, Entity; diff --git a/src/main/java/gtPlusPlus/core/gui/beta/MU_GuiId.java b/src/main/java/gtPlusPlus/core/gui/beta/MU_GuiId.java index faf823fdcf..8b15f5b937 100644 --- a/src/main/java/gtPlusPlus/core/gui/beta/MU_GuiId.java +++ b/src/main/java/gtPlusPlus/core/gui/beta/MU_GuiId.java @@ -3,6 +3,7 @@ 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; diff --git a/src/main/java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java b/src/main/java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java index ebd26d1f26..fa7ade3b97 100644 --- a/src/main/java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java +++ b/src/main/java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java @@ -1,8 +1,5 @@ package gtPlusPlus.core.gui.item; -import gtPlusPlus.core.container.Container_BackpackBase; -import gtPlusPlus.core.inventories.BaseInventoryBackpack; -import gtPlusPlus.core.lib.CORE; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.OpenGlHelper; @@ -10,12 +7,20 @@ import net.minecraft.client.renderer.RenderHelper; 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; +import gtPlusPlus.core.container.Container_BackpackBase; +import gtPlusPlus.core.inventories.BaseInventoryBackpack; +import gtPlusPlus.core.lib.CORE; + 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. */ + + /** + * 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; @@ -23,14 +28,15 @@ public class GuiBaseBackpack extends GuiContainer { /** The FontRenderer used by GuiScreen */ protected FontRenderer fontRenderer; - /** ResourceLocation takes 2 parameters: ModId, path to texture at the location: - * "src/minecraft/assets/modid/" + /** + * 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/ + * 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"); + private static final ResourceLocation iconLocation = new ResourceLocation( + CORE.MODID, + "textures/gui/itemBackpack.png"); /** The inventory to render on screen */ private final BaseInventoryBackpack inventory; @@ -55,8 +61,7 @@ public class GuiBaseBackpack extends GuiContainer { */ @Override protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - final String s = this.inventory.hasCustomInventoryName() - ? 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); @@ -80,12 +85,7 @@ public class GuiBaseBackpack extends GuiContainer { * 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, + 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(); diff --git a/src/main/java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java b/src/main/java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java index fd8a8ed7b1..3bb4d1f5e6 100644 --- a/src/main/java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java +++ b/src/main/java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java @@ -1,19 +1,8 @@ package gtPlusPlus.core.gui.item; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.container.Container_Grindle; -import gtPlusPlus.core.inventories.BaseInventoryGrindle; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import java.util.LinkedHashSet; import java.util.Set; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; @@ -23,10 +12,24 @@ import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; + import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.container.Container_Grindle; +import gtPlusPlus.core.inventories.BaseInventoryGrindle; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; + public class GuiBaseGrindle extends GuiContainer { /** The FontRenderer used by GuiScreen */ @@ -37,8 +40,9 @@ public class GuiBaseGrindle extends GuiContainer { private String[][] mPageDataArray; private short mCurrentPage = 0; - private static final ResourceLocation iconLocation = - new ResourceLocation(CORE.MODID, "textures/gui/itemGrindle.png"); + private static final ResourceLocation iconLocation = new ResourceLocation( + CORE.MODID, + "textures/gui/itemGrindle.png"); /** The inventory to render on screen */ private final BaseInventoryGrindle inventory; @@ -58,8 +62,7 @@ public class GuiBaseGrindle extends GuiContainer { } /** - * Draw the foreground layer for the GuiContainer (everything in front of the - * items) + * Draw the foreground layer for the GuiContainer (everything in front of the items) */ @Override protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { @@ -83,8 +86,8 @@ public class GuiBaseGrindle extends GuiContainer { // Debug NBT Information // NBTUtils.tryIterateNBTData(aStack); - this.fontRendererObj.drawString( - I18n.format(aDataCurrent.mTitle), 10, 8, Utils.rgbtoHexValue(125, 255, 125)); + this.fontRendererObj + .drawString(I18n.format(aDataCurrent.mTitle), 10, 8, Utils.rgbtoHexValue(125, 255, 125)); int tTier = aDataCurrent.mExtraInformation; if (tTier >= 0) { @@ -118,8 +121,8 @@ public class GuiBaseGrindle extends GuiContainer { int posOuter = 0; int posInner = 0; - mPageDataArray = new String - [MathUtils.roundToClosestInt(Math.ceil(aDataCurrent.mListData.size() / 9.00))][9]; + mPageDataArray = new String[MathUtils + .roundToClosestInt(Math.ceil(aDataCurrent.mListData.size() / 9.00))][9]; for (String e : aDataCurrent.mListData) { if (e != null) { mPageDataArray[posInner][posOuter] = e; @@ -189,12 +192,11 @@ public class GuiBaseGrindle extends GuiContainer { 35, Utils.rgbtoHexValue(125, 125, 255)); int aLastYUsed = 41; - /*for (int i=0;i<aDataCurrent.mListData.size();i++) { - if ((aLastYUsed + 9) <= (68 + 56)) { - this.fontRendererObj.drawString(I18n.format(aDataCurrent.mListData.get(i), new Object[0]), 10, aLastYUsed, Utils.rgbtoHexValue(125, 255, 125)); - aLastYUsed = aLastYUsed + 9; - } - } */ + /* + * for (int i=0;i<aDataCurrent.mListData.size();i++) { if ((aLastYUsed + 9) <= (68 + 56)) { + * this.fontRendererObj.drawString(I18n.format(aDataCurrent.mListData.get(i), new Object[0]), + * 10, aLastYUsed, Utils.rgbtoHexValue(125, 255, 125)); aLastYUsed = aLastYUsed + 9; } } + */ } } else { this.fontRendererObj.drawStringWithShadow( @@ -210,13 +212,16 @@ public class GuiBaseGrindle extends GuiContainer { 10, 8, Utils.rgbtoHexValue(255, 125, 125)); - this.mPageDataArray = new String[][] {{}}; + this.mPageDataArray = new String[][] { {} }; this.mCurrentPage = 0; } // Inventory Label this.fontRendererObj.drawStringWithShadow( - I18n.format("container.inventory", new Object[0]), 8, 131, Utils.rgbtoHexValue(255, 255, 255)); + I18n.format("container.inventory", new Object[0]), + 8, + 131, + Utils.rgbtoHexValue(255, 255, 255)); } catch (Throwable t) { Logger.INFO("GUI CRASH - " + t); @@ -310,37 +315,23 @@ public class GuiBaseGrindle extends GuiContainer { super.handleMouseInput(); int i = Mouse.getEventDWheel(); /* - * if (i != 0) { - * - * - * this.currentScroll = (float) ((double) this.currentScroll - (double) i / - * (double) j); - * - * if (this.currentScroll < 0.0F) { this.currentScroll = 0.0F; } - * - * if (this.currentScroll > 1.0F) { this.currentScroll = 1.0F; } - * - * this.scrollTo(this.currentScroll); } + * if (i != 0) { this.currentScroll = (float) ((double) this.currentScroll - (double) i / (double) j); if + * (this.currentScroll < 0.0F) { this.currentScroll = 0.0F; } if (this.currentScroll > 1.0F) { + * this.currentScroll = 1.0F; } this.scrollTo(this.currentScroll); } */ } /** - * Called when the mouse is moved or a mouse button is released. Signature: - * (mouseX, mouseY, which) which==-1 is mouseMove, which==0 or which==1 is - * mouseUp + * Called when the mouse is moved or a mouse button is released. Signature: (mouseX, mouseY, which) which==-1 is + * mouseMove, which==0 or which==1 is mouseUp */ @Override protected void mouseMovedOrUp(int p_146286_1_, int p_146286_2_, int p_146286_3_) { /* - * if (p_146286_3_ == 0) { int l = p_146286_1_ - this.guiLeft; int i1 = - * p_146286_2_ - this.guiTop; CreativeTabs[] acreativetabs = - * CreativeTabs.creativeTabArray; int j1 = acreativetabs.length; - * - * for (int k1 = 0; k1 < j1; ++k1) { CreativeTabs creativetabs = - * acreativetabs[k1]; - * - * if (creativetabs != null && this.func_147049_a(creativetabs, l, i1)) { - * this.setCurrentCreativeTab(creativetabs); return; } } } + * if (p_146286_3_ == 0) { int l = p_146286_1_ - this.guiLeft; int i1 = p_146286_2_ - this.guiTop; + * CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray; int j1 = acreativetabs.length; for (int k1 = 0; + * k1 < j1; ++k1) { CreativeTabs creativetabs = acreativetabs[k1]; if (creativetabs != null && + * this.func_147049_a(creativetabs, l, i1)) { this.setCurrentCreativeTab(creativetabs); return; } } } */ super.mouseMovedOrUp(p_146286_1_, p_146286_2_, p_146286_3_); @@ -365,8 +356,7 @@ public class GuiBaseGrindle extends GuiContainer { static { ResourceLocation r; try { - r = (ResourceLocation) ReflectionUtils.getField(GuiScreenBook.class, "bookGuiTextures") - .get(null); + r = (ResourceLocation) ReflectionUtils.getField(GuiScreenBook.class, "bookGuiTextures").get(null); } catch (IllegalArgumentException | IllegalAccessException e) { r = new ResourceLocation("textures/gui/book.png"); @@ -390,8 +380,7 @@ public class GuiBaseGrindle extends GuiContainer { */ public void drawButton(Minecraft aGame, int aX, int aY) { if (this.visible) { - boolean flag = aX >= this.xPosition - && aY >= this.yPosition + boolean flag = aX >= this.xPosition && aY >= this.yPosition && aX < this.xPosition + this.width && aY < this.yPosition + this.height; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -415,8 +404,10 @@ public class GuiBaseGrindle extends GuiContainer { public static class GrindleData { public static enum GrindleMode { + PROSPECTING(0), ELEMENT(1); + private final int aModeID; private GrindleMode(final int aMode) { @@ -465,8 +456,7 @@ public class GuiBaseGrindle extends GuiContainer { tNBT = new NBTTagCompound(); } - mTitle = tNBT.hasKey("title") - ? tNBT.getString("title") + mTitle = tNBT.hasKey("title") ? tNBT.getString("title") : (aType == 0 ? "Empty Data Stick" : (aType == 1 ? "Empty Data Orb" : "Unknown Item")); if (mTitle.toLowerCase().contains("raw prospection data")) { isProspecting = true; diff --git a/src/main/java/gtPlusPlus/core/gui/item/GuiScreenGrindle.java b/src/main/java/gtPlusPlus/core/gui/item/GuiScreenGrindle.java index f9b0e8c161..de218fe880 100644 --- a/src/main/java/gtPlusPlus/core/gui/item/GuiScreenGrindle.java +++ b/src/main/java/gtPlusPlus/core/gui/item/GuiScreenGrindle.java @@ -1,15 +1,5 @@ package gtPlusPlus.core.gui.item; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.container.Container_Grindle; -import gtPlusPlus.core.inventories.BaseInventoryGrindle; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -25,13 +15,26 @@ import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraft.util.ChatAllowedCharacters; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.container.Container_Grindle; +import gtPlusPlus.core.inventories.BaseInventoryGrindle; +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.NBTUtils; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + @SideOnly(Side.CLIENT) public class GuiScreenGrindle extends GuiContainer { + private static final Logger logger = LogManager.getLogger(); private static final ResourceLocation bookGuiTextures = new ResourceLocation("textures/gui/book.png"); /** The player editing the book */ @@ -62,8 +65,9 @@ public class GuiScreenGrindle extends GuiContainer { private GuiButton buttonCancel; // Texture - private static final ResourceLocation iconLocation = - new ResourceLocation(CORE.MODID, "textures/gui/itemGrindle.png"); + private static final ResourceLocation iconLocation = new ResourceLocation( + CORE.MODID, + "textures/gui/itemGrindle.png"); /** The inventory to render on screen */ private final BaseInventoryGrindle inventory; @@ -168,8 +172,7 @@ public class GuiScreenGrindle extends GuiContainer { } /** - * Called when the screen is unloaded. Used to disable keyboard repeat - * events + * Called when the screen is unloaded. Used to disable keyboard repeat events */ @Override public void onGuiClosed() { @@ -177,8 +180,8 @@ public class GuiScreenGrindle extends GuiContainer { } private void updateButtons() { - this.buttonNextPage.visible = - !this.field_146480_s && ((this.currPage < (this.bookTotalPages - 1)) || this.bookIsUnsigned); + this.buttonNextPage.visible = !this.field_146480_s + && ((this.currPage < (this.bookTotalPages - 1)) || this.bookIsUnsigned); this.buttonPreviousPage.visible = !this.field_146480_s && (this.currPage > 0); this.buttonDone.visible = !this.bookIsUnsigned || !this.field_146480_s; @@ -277,8 +280,7 @@ public class GuiScreenGrindle extends GuiContainer { } /** - * Fired when a key is typed. This is the equivalent of - * KeyListener.keyTyped(KeyEvent e). + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). */ @Override protected void keyTyped(final char p_73869_1_, final int p_73869_2_) { @@ -388,7 +390,7 @@ public class GuiScreenGrindle extends GuiContainer { // this.mc.getTextureManager().bindTexture(iconLocation); // final int k = (this.width - this.bookImageWidth) / 2; // this.drawTexturedModalRect(k, b0, 0, 0, this.bookImageWidth, - // this.bookImageHeight); + // this.bookImageHeight); String s; String s1; @@ -419,16 +421,16 @@ public class GuiScreenGrindle extends GuiContainer { this.fontRendererObj.drawString(s1, k + 36 + ((116 - l) / 2), b0 + 16 + 16, 0); final int i1 = this.fontRendererObj.getStringWidth(s); this.fontRendererObj.drawString(s, k + 36 + ((116 - i1) / 2), b0 + 48, 0); - final String s2 = I18n.format("book.byAuthor", new Object[] {this.editingPlayer.getCommandSenderName()}); + final String s2 = I18n.format("book.byAuthor", new Object[] { this.editingPlayer.getCommandSenderName() }); final int j1 = this.fontRendererObj.getStringWidth(s2); - this.fontRendererObj.drawString( - EnumChatFormatting.DARK_GRAY + s2, k + 36 + ((116 - j1) / 2), b0 + 48 + 10, 0); + this.fontRendererObj + .drawString(EnumChatFormatting.DARK_GRAY + s2, k + 36 + ((116 - j1) / 2), b0 + 48 + 10, 0); final String s3 = I18n.format("book.finalizeWarning", new Object[0]); this.fontRendererObj.drawSplitString(s3, k + 36, b0 + 80, 116, 0); } else { s = I18n.format( "book.pageIndicator", - new Object[] {Integer.valueOf(this.currPage + 1), Integer.valueOf(this.bookTotalPages)}); + new Object[] { Integer.valueOf(this.currPage + 1), Integer.valueOf(this.bookTotalPages) }); s1 = ""; if ((this.bookPages != null) && (this.currPage >= 0) && (this.currPage < this.bookPages.tagCount())) { @@ -457,10 +459,11 @@ public class GuiScreenGrindle extends GuiContainer { @SideOnly(Side.CLIENT) static class NextPageButton extends GuiButton { + private final boolean field_146151_o; - public NextPageButton( - final int p_i1079_1_, final int p_i1079_2_, final int p_i1079_3_, final boolean p_i1079_4_) { + public NextPageButton(final int p_i1079_1_, final int p_i1079_2_, final int p_i1079_3_, + final boolean p_i1079_4_) { super(p_i1079_1_, p_i1079_2_, p_i1079_3_, 23, 13, ""); this.field_146151_o = p_i1079_4_; } @@ -471,8 +474,7 @@ public class GuiScreenGrindle extends GuiContainer { @Override public void drawButton(final Minecraft p_146112_1_, final int p_146112_2_, final int p_146112_3_) { if (this.visible) { - final boolean flag = (p_146112_2_ >= this.xPosition) - && (p_146112_3_ >= this.yPosition) + final boolean flag = (p_146112_2_ >= this.xPosition) && (p_146112_3_ >= this.yPosition) && (p_146112_2_ < (this.xPosition + this.width)) && (p_146112_3_ < (this.yPosition + this.height)); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -494,8 +496,7 @@ public class GuiScreenGrindle extends GuiContainer { } /** - * Draw the background layer for the GuiContainer (everything behind the - * items) + * Draw the background layer for the GuiContainer (everything behind the items) */ @Override protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { diff --git a/src/main/java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java b/src/main/java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java index 575419857d..a3319d48b7 100644 --- a/src/main/java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java +++ b/src/main/java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java @@ -1,7 +1,5 @@ package gtPlusPlus.core.gui.item.box; -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; -import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; @@ -9,24 +7,28 @@ import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.resources.I18n; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; +import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; +import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; + public class GuiBaseBox 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. + * 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; /** - * ResourceLocation takes 2 parameters: ModId, path to texture at the location: - * "src/minecraft/assets/modid/" + * 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/ + * I have provided a sample texture file that works with this tutorial. Download it from + * Forge_Tutorials/textures/gui/ */ private final ResourceLocation iconLocation; @@ -49,12 +51,10 @@ public class GuiBaseBox extends GuiContainer { } /** - * Draw the foreground layer for the GuiContainer (everything in front of the - * items) + * Draw the foreground layer for the GuiContainer (everything in front of the items) */ protected void drawGuiContainerForegroundLayer(int par1, int par2) { - String s = this.inventory.hasCustomInventoryName() - ? this.inventory.getInventoryName() + String s = this.inventory.hasCustomInventoryName() ? this.inventory.getInventoryName() : I18n.format(this.inventory.getInventoryName()); this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 0, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory"), 26, this.ySize - 96 + 4, 4210752); @@ -80,9 +80,8 @@ public class GuiBaseBox extends GuiContainer { } /** - * 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) { GL11.glEnable(GL11.GL_COLOR_MATERIAL); diff --git a/src/main/java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java b/src/main/java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java index 0b8d76a6b4..328276fe6f 100644 --- a/src/main/java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java +++ b/src/main/java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java @@ -1,10 +1,12 @@ package gtPlusPlus.core.gui.item.box; +import net.minecraft.util.ResourceLocation; + import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; import gtPlusPlus.core.lib.CORE; -import net.minecraft.util.ResourceLocation; public class LunchBoxGui extends GuiBaseBox { + public LunchBoxGui(ContainerBoxBase containerItem) { super(containerItem, new ResourceLocation(CORE.MODID, "textures/gui/schematic_rocket_GS1.png")); } diff --git a/src/main/java/gtPlusPlus/core/gui/item/box/MagicBagGui.java b/src/main/java/gtPlusPlus/core/gui/item/box/MagicBagGui.java index c2665d2bf0..ff3b59b4e6 100644 --- a/src/main/java/gtPlusPlus/core/gui/item/box/MagicBagGui.java +++ b/src/main/java/gtPlusPlus/core/gui/item/box/MagicBagGui.java @@ -1,10 +1,12 @@ package gtPlusPlus.core.gui.item.box; +import net.minecraft.util.ResourceLocation; + import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; import gtPlusPlus.core.lib.CORE; -import net.minecraft.util.ResourceLocation; public class MagicBagGui extends GuiBaseBox { + public MagicBagGui(ContainerBoxBase containerItem) { super(containerItem, new ResourceLocation(CORE.MODID, "textures/gui/schematic_rocket_GS1.png")); } diff --git a/src/main/java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java b/src/main/java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java index 01e3a38b4d..6d4d43ad65 100644 --- a/src/main/java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java +++ b/src/main/java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java @@ -1,10 +1,12 @@ package gtPlusPlus.core.gui.item.box; +import net.minecraft.util.ResourceLocation; + import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; import gtPlusPlus.core.lib.CORE; -import net.minecraft.util.ResourceLocation; public class ToolBoxGui extends GuiBaseBox { + public ToolBoxGui(ContainerBoxBase containerItem) { |
