From 7d1f51a8937e0a86486267437d444696e81e8aa0 Mon Sep 17 00:00:00 2001 From: Jakub <53441451+kuba6000@users.noreply.github.com> Date: Mon, 29 Aug 2022 16:04:28 +0200 Subject: Buildscript + Spotless (#318) * Convert AES.java to readable class * Buildscript * Spotless --- .../gtPlusPlus/core/gui/GUI_Base_Tile_Entity.java | 11 +- .../gtPlusPlus/core/gui/beta/Gui_ID_Registry.java | 96 +- .../java/gtPlusPlus/core/gui/beta/Gui_Types.java | 11 +- .../java/gtPlusPlus/core/gui/beta/MU_GuiId.java | 43 +- .../gtPlusPlus/core/gui/item/GuiBaseBackpack.java | 205 ++-- .../gtPlusPlus/core/gui/item/GuiBaseGrindle.java | 1125 ++++++++++---------- .../gtPlusPlus/core/gui/item/GuiScreenGrindle.java | 957 +++++++++-------- .../gtPlusPlus/core/gui/item/box/GuiBaseBox.java | 198 ++-- .../gtPlusPlus/core/gui/item/box/LunchBoxGui.java | 6 +- .../gtPlusPlus/core/gui/item/box/MagicBagGui.java | 6 +- .../gtPlusPlus/core/gui/item/box/ToolBoxGui.java | 6 +- .../core/gui/machine/GUI_CircuitProgrammer.java | 64 +- .../core/gui/machine/GUI_DecayablesChest.java | 90 +- .../gtPlusPlus/core/gui/machine/GUI_EggBox.java | 89 +- .../gtPlusPlus/core/gui/machine/GUI_FishTrap.java | 90 +- .../core/gui/machine/GUI_HeliumGenerator.java | 53 +- .../core/gui/machine/GUI_ModularityTable.java | 132 ++- .../core/gui/machine/GUI_PestKiller.java | 257 +++-- .../core/gui/machine/GUI_ProjectTable.java | 98 +- .../core/gui/machine/GUI_RoundRobinator.java | 201 ++-- .../core/gui/machine/GUI_ScrollTest.java | 146 ++- .../core/gui/machine/GUI_SuperJukebox.java | 135 ++- .../core/gui/machine/GUI_TradeTable.java | 75 +- .../gui/machine/GUI_VolumetricFlaskSetter.java | 473 ++++---- .../gtPlusPlus/core/gui/widget/GuiValueField.java | 172 +-- 25 files changed, 2346 insertions(+), 2393 deletions(-) (limited to 'src/main/java/gtPlusPlus/core/gui') diff --git a/src/main/java/gtPlusPlus/core/gui/GUI_Base_Tile_Entity.java b/src/main/java/gtPlusPlus/core/gui/GUI_Base_Tile_Entity.java index aa10363e7c..379827a1db 100644 --- a/src/main/java/gtPlusPlus/core/gui/GUI_Base_Tile_Entity.java +++ b/src/main/java/gtPlusPlus/core/gui/GUI_Base_Tile_Entity.java @@ -5,11 +5,10 @@ import net.minecraft.inventory.Container; public abstract class GUI_Base_Tile_Entity extends GuiContainer { - public final Container mContainer; - - public GUI_Base_Tile_Entity(Container aContainer) { - super(aContainer); - mContainer = aContainer; - } + public final Container mContainer; + public GUI_Base_Tile_Entity(Container aContainer) { + super(aContainer); + mContainer = aContainer; + } } 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 1212054f01..d36de4bf28 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,56 +1,54 @@ 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, MU_GuiId> classMap = new HashMap, MU_GuiId>(); - 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 })); - } - - private static void registerGuiHandlers(final Gui_Types MU_GuiType, final List> guiHandlerClasses) - { - for (final Class tileGuiHandlerClass : guiHandlerClasses) - { - 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(final IGuiManagerMiscUtils guiHandler) - { - final Class guiHandlerClass = guiHandler.getClass(); - MU_GuiId guiId = classMap.get(guiHandlerClass); - if (guiId == null) { - for (final Map.Entry, MU_GuiId> classGuiIdEntry : classMap.entrySet()) { - if (((Class)classGuiIdEntry.getKey()).isAssignableFrom(guiHandlerClass)) - { - guiId = classGuiIdEntry.getValue(); - break; - } - } - } - if (guiId == null) { - throw new IllegalStateException("No gui ID for gui handler: " + guiHandler); - } - return guiId; - } - - public static MU_GuiId getGuiId(final int id) - { - return idMap.get(Integer.valueOf(id)); - } - +public class Gui_ID_Registry { + private static final Map, MU_GuiId> classMap = + new HashMap, MU_GuiId>(); + 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 })); + } + + private static void registerGuiHandlers( + final Gui_Types MU_GuiType, final List> guiHandlerClasses) { + for (final Class tileGuiHandlerClass : guiHandlerClasses) { + 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(final IGuiManagerMiscUtils guiHandler) { + final Class guiHandlerClass = guiHandler.getClass(); + MU_GuiId guiId = classMap.get(guiHandlerClass); + if (guiId == null) { + for (final Map.Entry, MU_GuiId> classGuiIdEntry : + classMap.entrySet()) { + if (((Class) classGuiIdEntry.getKey()).isAssignableFrom(guiHandlerClass)) { + guiId = classGuiIdEntry.getValue(); + break; + } + } + } + if (guiId == null) { + throw new IllegalStateException("No gui ID for gui handler: " + guiHandler); + } + return guiId; + } + + public static MU_GuiId getGuiId(final int id) { + return idMap.get(Integer.valueOf(id)); + } } 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 9348f40c9c..bb095e74c0 100644 --- a/src/main/java/gtPlusPlus/core/gui/beta/Gui_Types.java +++ b/src/main/java/gtPlusPlus/core/gui/beta/Gui_Types.java @@ -1,8 +1,9 @@ package gtPlusPlus.core.gui.beta; -public enum Gui_Types -{ - Item, Tile, Entity; +public enum Gui_Types { + Item, + Tile, + Entity; - private Gui_Types() {} -} \ No newline at end of file + private Gui_Types() {} +} 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 116ad48480..faf823fdcf 100644 --- a/src/main/java/gtPlusPlus/core/gui/beta/MU_GuiId.java +++ b/src/main/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 guiHandlerClass; +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; - } + 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 Gui_Types getGuiType() - { - return this.MU_GuiType; - } + public Gui_Types getGuiType() { + return this.MU_GuiType; + } - public Class getGuiHandlerClass() - { - return this.guiHandlerClass; - } + public Class getGuiHandlerClass() { + return this.guiHandlerClass; + } - public int getId() - { - return this.id; - } + public int getId() { + return this.id; + } } - diff --git a/src/main/java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java b/src/main/java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java index 0ad4b9b51f..ebd26d1f26 100644 --- a/src/main/java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java +++ b/src/main/java/gtPlusPlus/core/gui/item/GuiBaseBackpack.java @@ -1,8 +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; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.OpenGlHelper; @@ -10,112 +10,115 @@ 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. */ + private float xSize_lo; -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; + 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/ - */ - private static final ResourceLocation iconLocation = new ResourceLocation(CORE.MODID, "textures/gui/itemBackpack.png"); + /** 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; + /** The inventory to render on screen */ + private final BaseInventoryBackpack inventory; - public GuiBaseBackpack(final Container_BackpackBase containerItem) - { - super(containerItem); - this.inventory = containerItem.inventory; - } + public GuiBaseBackpack(final Container_BackpackBase containerItem) { + super(containerItem); + this.inventory = containerItem.inventory; + } - /** - * 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; - } + /** + * 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; + } - /** - * 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); - } + /** + * 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); + } - /** - * 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(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; - drawPlayerModel(k + 51, l + 75, 30, k + 51 - this.xSize_lo, (l + 75) - 50 - this.ySize_lo, this.mc.thePlayer); - } + /** + * 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(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; + 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(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); - 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); - GL11.glRotatef(-((float) Math.atan(pitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F); - entity.renderYawOffset = (float) Math.atan(yaw / 40.0F) * 20.0F; - entity.rotationYaw = (float) Math.atan(yaw / 40.0F) * 40.0F; - entity.rotationPitch = -((float) Math.atan(pitch / 40.0F)) * 20.0F; - entity.rotationYawHead = entity.rotationYaw; - entity.prevRotationYawHead = entity.rotationYaw; - GL11.glTranslatef(0.0F, entity.yOffset, 0.0F); - RenderManager.instance.playerViewY = 180.0F; - RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); - entity.renderYawOffset = f2; - entity.rotationYaw = f3; - entity.rotationPitch = f4; - entity.prevRotationYawHead = f5; - entity.rotationYawHead = f6; - GL11.glPopMatrix(); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GL11.glDisable(GL11.GL_TEXTURE_2D); - OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); - } + /** + * 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) { + 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; + GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-((float) Math.atan(pitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F); + entity.renderYawOffset = (float) Math.atan(yaw / 40.0F) * 20.0F; + entity.rotationYaw = (float) Math.atan(yaw / 40.0F) * 40.0F; + entity.rotationPitch = -((float) Math.atan(pitch / 40.0F)) * 20.0F; + entity.rotationYawHead = entity.rotationYaw; + entity.prevRotationYawHead = entity.rotationYaw; + GL11.glTranslatef(0.0F, entity.yOffset, 0.0F); + RenderManager.instance.playerViewY = 180.0F; + RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + entity.renderYawOffset = f2; + entity.rotationYaw = f3; + entity.rotationPitch = f4; + entity.prevRotationYawHead = f5; + entity.rotationYawHead = f6; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + } } diff --git a/src/main/java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java b/src/main/java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java index ed347e8d30..fd8a8ed7b1 100644 --- a/src/main/java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java +++ b/src/main/java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java @@ -1,23 +1,7 @@ package gtPlusPlus.core.gui.item; -import java.util.LinkedHashSet; -import java.util.Set; - -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 net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreenBook; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ResourceLocation; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; @@ -28,537 +12,586 @@ 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; +import net.minecraft.client.gui.GuiScreenBook; +import net.minecraft.client.gui.inventory.GuiContainer; +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; public class GuiBaseGrindle extends GuiContainer { - /** The FontRenderer used by GuiScreen */ - protected FontRenderer fontRenderer; - - private GrindleGuiButton mButtonNextPage; - private GrindleGuiButton mButtonPreviousPage; - private String[][] mPageDataArray; - private short mCurrentPage = 0; - - private static final ResourceLocation iconLocation = new ResourceLocation(CORE.MODID, "textures/gui/itemGrindle.png"); - - /** The inventory to render on screen */ - private final BaseInventoryGrindle inventory; - - public GuiBaseGrindle(final Container_Grindle containerItem) { - super(containerItem); - this.inventory = containerItem.inventory; - } - - /** - * 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.updateButtons(); - } - - /** - * Draw the foreground layer for the GuiContainer (everything in front of the - * items) - */ - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - - try { - - // Title - this.fontRendererObj.drawStringWithShadow(I18n.format("Gregtech Information Transponder", new Object[0]), 0, - -12, Utils.rgbtoHexValue(255, 255, 255)); - ItemStack aStack = this.inventory.getStackInSlot(0); - - if (aStack != null) { - - GrindleData aDataCurrent = new GrindleData(aStack); - - if (aDataCurrent.mValid) { - - // Debug NBT Information - //NBTUtils.tryIterateNBTData(aStack); - - this.fontRendererObj.drawString(I18n.format(aDataCurrent.mTitle), 10, 8, Utils.rgbtoHexValue(125, 255, 125)); - - int tTier = aDataCurrent.mExtraInformation; - if (tTier >= 0) { - //Draw the GUI - // List prospection - this.fontRendererObj.drawString(I18n.format(aDataCurrent.mTierDim+" | Page: "+this.mCurrentPage, new Object[0]), 10, 18, Utils.rgbtoHexValue(125, 255, 125)); - // Divider - this.fontRendererObj.drawString(I18n.format("-------------------", new Object[0]), 10, 23, Utils.rgbtoHexValue(125, 125, 255)); - // Pos data - this.fontRendererObj.drawString(I18n.format(aDataCurrent.mPosInfo, new Object[0]), 10, 29, Utils.rgbtoHexValue(125, 125, 255)); - // Divider - this.fontRendererObj.drawString(I18n.format("-------------------", new Object[0]), 10, 35, Utils.rgbtoHexValue(125, 125, 255)); - int aLastYUsed = 41; - - int posOuter = 0; - int posInner = 0; - - 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; - if (posOuter < 8) { - posOuter++; - } - else { - posOuter = 0; - posInner++; - } - } - else { - continue; - } - } - - String[] aCurrentPage = mPageDataArray[this.mCurrentPage]; - - if (aCurrentPage != null) { - //Logger.INFO("valid Current page " + this.mCurrentPage); - if (aCurrentPage.length > 0) { - for (int i=0;i 0) { - if (!aCP.toLowerCase().contains("empty") && !aCP.toLowerCase().contains("null")) { - this.fontRendererObj.drawString(I18n.format(aCP), 10, aLastYUsed, Utils.rgbtoHexValue(125, 255, 125)); - aLastYUsed += 9; - } - } - } - } - } - } - - - - - } - - //Non-Prospecting Data - else { - //Draw the GUI - // List prospection - this.fontRendererObj.drawString(I18n.format(aDataCurrent.mTierDim, new Object[0]), 10, 18, Utils.rgbtoHexValue(125, 255, 125)); - // Divider - this.fontRendererObj.drawString(I18n.format("-------------------", new Object[0]), 10, 23, Utils.rgbtoHexValue(125, 125, 255)); - // Pos data - this.fontRendererObj.drawString(I18n.format(aDataCurrent.mPosInfo, new Object[0]), 10, 29, Utils.rgbtoHexValue(125, 125, 255)); - // Divider - this.fontRendererObj.drawString(I18n.format("-------------------", new Object[0]), 10, 35, Utils.rgbtoHexValue(125, 125, 255)); - int aLastYUsed = 41; - /*for (int i=0;i= 0) { - if (this.mPageDataArray != null) { - if (this.mCurrentPage < (this.mPageDataArray.length - 1)) { - this.mButtonNextPage.visible = true; - } else { - this.mButtonNextPage.visible = false; - } - } else { - this.mButtonNextPage.visible = false; - } - } - if (this.mCurrentPage > 0) { - this.mButtonPreviousPage.visible = true; - } - else { - this.mButtonPreviousPage.visible = false; - } - } - - - /** - * Scrolling Related - */ - @Override - protected void actionPerformed(GuiButton aButton) { - if (aButton.enabled && aButton.visible) { - if (aButton.id == 1) { - if (this.mCurrentPage < this.mPageDataArray.length - 1) { - ++this.mCurrentPage; - } - } else if (aButton.id == 2) { - if (this.mCurrentPage > 0) { - --this.mCurrentPage; - } - } - this.updateButtons(); - } - } - - /** - * Handles mouse input. - */ - @Override - public void handleMouseInput() { - 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); } - */ - } - - /** - * 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; } } } - */ - - super.mouseMovedOrUp(p_146286_1_, p_146286_2_, p_146286_3_); - } - - /** - * Allows Mouseover Tooltips - */ - @Override - protected void renderToolTip(ItemStack aStack, int p_146285_2_, int p_146285_3_) { - super.renderToolTip(aStack, p_146285_2_, p_146285_3_); - } - - /** - * Custom Buttons - */ - - @SideOnly(Side.CLIENT) - static class GrindleGuiButton extends GuiButton { - - public static final ResourceLocation mBookTexture; - - static { - ResourceLocation r; - try { - r = (ResourceLocation) ReflectionUtils.getField(GuiScreenBook.class, "bookGuiTextures").get(null); - - } catch (IllegalArgumentException | IllegalAccessException e) { - r = new ResourceLocation("textures/gui/book.png"); - } - mBookTexture = r; - } - - private final boolean aPageForward; - - public GrindleGuiButton(int aID, int aX, int aY, boolean aForwards) { - this(aID, aX, aY, 20, 12, aForwards); - } - - public GrindleGuiButton(int aID, int aX, int aY, int aWidth, int aHeight, boolean aForwards) { - super(aID, aX, aY, aWidth, aHeight, ""); - this.aPageForward = aForwards; - } - - /** - * Draws this button to the screen. - */ - public void drawButton(Minecraft aGame, int aX, int aY) { - if (this.visible) { - 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); - aGame.getTextureManager().bindTexture(iconLocation); - int k = 0; - int l = 192; - - if (flag) { - k += 23; - } - - if (!this.aPageForward) { - l += 13; - } - - this.drawTexturedModalRect(this.xPosition, this.yPosition, k, l, 22, 12); - } - } - } - - - public static class GrindleData { - - public static enum GrindleMode { - PROSPECTING(0), - ELEMENT(1); - private final int aModeID; - private GrindleMode (final int aMode) - { - this.aModeID = aMode; - } - - public int getMode() { - return this.aModeID; - } - } - - final boolean mValid; - final ItemStack mStack; - final String mTitle, mPosInfo, mTierDim; - final AutoMap mListData; - final GrindleMode mMode; - final int mExtraInformation; - - - public GrindleData(ItemStack iStack) { - - if (iStack == null) { - mValid = false; - mStack = null; - mTitle = null; - mListData = null; - mMode = null; - mExtraInformation = 0; - this.mTierDim = ""; - this.mPosInfo = ""; - } else { - - this.mStack = iStack; - - int aType = -1; - boolean isProspecting = false; - - // If Input stack is a Data stick/Orb, set a valid type. - if (GT_Utility.areStacksEqual(iStack, CI.getDataStick(), true)) { - aType = 0; - } else if (GT_Utility.areStacksEqual(iStack, CI.getDataOrb(), true)) { - aType = 1; - } - - NBTTagCompound tNBT = iStack.getTagCompound(); - if (tNBT == null) { - tNBT = new NBTTagCompound(); - } - - 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; - } - - byte tTier = -1; - if (isProspecting) { - if (!tNBT.hasKey("prospection_tier") && tNBT.hasKey("prospection")) { - tTier = 0; - } else if (tNBT.hasKey("prospection_tier") && !tNBT.hasKey("prospection")) { - tTier = tNBT.getByte("prospection_tier"); - } - } - - mExtraInformation = isProspecting ? tTier : -1; - - if (tTier >= 0) { - String xPos, yPos, zPos, aDim; - String aPositionString, aInfoString; - Set aOreTypes = new LinkedHashSet(); - Set aOilTypes = new LinkedHashSet(); - - // Set variables that are shared between prospection types. - if (tTier == 0) { - String tData = tNBT.getString("prospection"); - String[] tDataArray = tData.split(","); - xPos = tDataArray[0]; - yPos = tDataArray[1]; - zPos = tDataArray[2]; - aDim = tDataArray[3]; - aOilTypes.add("Oil Type: " + tDataArray[5]); - aOilTypes.add("--------------------"); - aOreTypes.add("Ore Types: "); - for (int i = 6; tDataArray.length > i; i++) { - aOreTypes.add("-" + tDataArray[i]); - } - } else { - String tPos = tNBT.getString("prospection_pos"); - String[] tPosData = tPos.split(" "); - xPos = tPosData[1]; - yPos = tPosData[3]; - zPos = tPosData[5]; - aDim = tPosData[7]; - // Oil - String tOil = tNBT.getString("prospection_oils"); - String[] tOilData = tOil.split("\\|"); - if (tOilData.length > 0) { - aOilTypes.add("Oil Types:"); - for (String s : tOilData) { - if (s != null) { - aOilTypes.add(s); - } - } - aOilTypes.add("--------------------"); - } - - // Near - String tOresNear = tNBT.getString("prospection_near"); - String[] tOresNearData = tOresNear.split("\\|"); - // Middle - String tOresMid = tNBT.getString("prospection_middle"); - String[] tOresMidData = tOresMid.split("\\|"); - // Far - String tOresFar = tNBT.getString("prospection_far"); - String[] tOresFarData = tOresFar.split("\\|"); - - if ((tOresNearData.length + tOresMidData.length + tOresFarData.length) > 0) { - aOreTypes.add("Ore Types:"); - if (tOresNearData.length > 0) { - for (String s : tOresNearData) { - if (s != null) { - aOreTypes.add("-" + s + " - Near"); - } - } - } - if (tOresMidData.length > 0) { - for (String s : tOresMidData) { - if (s != null) { - aOreTypes.add("-" + s + " - Mid"); - } - } - } - if (tOresFarData.length > 0) { - for (String s : tOresFarData) { - if (s != null) { - aOreTypes.add("-" + s + " - Far"); - } - } - } - } - } - - mListData = new AutoMap(); - if (aOilTypes.size() > 0) { - for (String aOils : aOilTypes) { - if (aOils != null && aOils.length() > 0) { - mListData.put(aOils); - } - } - } - - if (aOreTypes.size() > 0) { - for (String aOres : aOreTypes) { - if (aOres != null && aOres.length() > 0) { - mListData.put(aOres); - } - } - } - - // Set Types - mMode = GrindleMode.PROSPECTING; - this.mTierDim = (aInfoString = "Tier: " + tTier + " | Dim: " + aDim); - this.mPosInfo = (aPositionString = "X:" + xPos + ", Y:" + yPos + ", Z:" + zPos); - this.mValid = true; - } - - // Non-Prospectic Data - else { - mValid = true; - mListData = null; - mMode = GrindleMode.ELEMENT; - this.mTierDim = "PLACEHOLDER"; - this.mPosInfo = "PLACEHOLDER"; - } - - } - - } - - } - - + /** The FontRenderer used by GuiScreen */ + protected FontRenderer fontRenderer; + + private GrindleGuiButton mButtonNextPage; + private GrindleGuiButton mButtonPreviousPage; + private String[][] mPageDataArray; + private short mCurrentPage = 0; + + private static final ResourceLocation iconLocation = + new ResourceLocation(CORE.MODID, "textures/gui/itemGrindle.png"); + + /** The inventory to render on screen */ + private final BaseInventoryGrindle inventory; + + public GuiBaseGrindle(final Container_Grindle containerItem) { + super(containerItem); + this.inventory = containerItem.inventory; + } + + /** + * 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.updateButtons(); + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the + * items) + */ + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + + try { + + // Title + this.fontRendererObj.drawStringWithShadow( + I18n.format("Gregtech Information Transponder", new Object[0]), + 0, + -12, + Utils.rgbtoHexValue(255, 255, 255)); + ItemStack aStack = this.inventory.getStackInSlot(0); + + if (aStack != null) { + + GrindleData aDataCurrent = new GrindleData(aStack); + + if (aDataCurrent.mValid) { + + // Debug NBT Information + // NBTUtils.tryIterateNBTData(aStack); + + this.fontRendererObj.drawString( + I18n.format(aDataCurrent.mTitle), 10, 8, Utils.rgbtoHexValue(125, 255, 125)); + + int tTier = aDataCurrent.mExtraInformation; + if (tTier >= 0) { + // Draw the GUI + // List prospection + this.fontRendererObj.drawString( + I18n.format(aDataCurrent.mTierDim + " | Page: " + this.mCurrentPage, new Object[0]), + 10, + 18, + Utils.rgbtoHexValue(125, 255, 125)); + // Divider + this.fontRendererObj.drawString( + I18n.format("-------------------", new Object[0]), + 10, + 23, + Utils.rgbtoHexValue(125, 125, 255)); + // Pos data + this.fontRendererObj.drawString( + I18n.format(aDataCurrent.mPosInfo, new Object[0]), + 10, + 29, + Utils.rgbtoHexValue(125, 125, 255)); + // Divider + this.fontRendererObj.drawString( + I18n.format("-------------------", new Object[0]), + 10, + 35, + Utils.rgbtoHexValue(125, 125, 255)); + int aLastYUsed = 41; + + int posOuter = 0; + int posInner = 0; + + 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; + if (posOuter < 8) { + posOuter++; + } else { + posOuter = 0; + posInner++; + } + } else { + continue; + } + } + + String[] aCurrentPage = mPageDataArray[this.mCurrentPage]; + + if (aCurrentPage != null) { + // Logger.INFO("valid Current page " + this.mCurrentPage); + if (aCurrentPage.length > 0) { + for (int i = 0; i < aCurrentPage.length; i++) { + if ((aLastYUsed + 9) <= (68 + 56)) { + String aCP = aCurrentPage[i]; + // Logger.INFO("Printing "+aCP); + if (aCP != null && aCP.length() > 0) { + if (!aCP.toLowerCase().contains("empty") + && !aCP.toLowerCase().contains("null")) { + this.fontRendererObj.drawString( + I18n.format(aCP), + 10, + aLastYUsed, + Utils.rgbtoHexValue(125, 255, 125)); + aLastYUsed += 9; + } + } + } + } + } + } + + } + + // Non-Prospecting Data + else { + // Draw the GUI + // List prospection + this.fontRendererObj.drawString( + I18n.format(aDataCurrent.mTierDim, new Object[0]), + 10, + 18, + Utils.rgbtoHexValue(125, 255, 125)); + // Divider + this.fontRendererObj.drawString( + I18n.format("-------------------", new Object[0]), + 10, + 23, + Utils.rgbtoHexValue(125, 125, 255)); + // Pos data + this.fontRendererObj.drawString( + I18n.format(aDataCurrent.mPosInfo, new Object[0]), + 10, + 29, + Utils.rgbtoHexValue(125, 125, 255)); + // Divider + this.fontRendererObj.drawString( + I18n.format("-------------------", new Object[0]), + 10, + 35, + Utils.rgbtoHexValue(125, 125, 255)); + int aLastYUsed = 41; + /*for (int i=0;i= 0) { + if (this.mPageDataArray != null) { + if (this.mCurrentPage < (this.mPageDataArray.length - 1)) { + this.mButtonNextPage.visible = true; + } else { + this.mButtonNextPage.visible = false; + } + } else { + this.mButtonNextPage.visible = false; + } + } + if (this.mCurrentPage > 0) { + this.mButtonPreviousPage.visible = true; + } else { + this.mButtonPreviousPage.visible = false; + } + } + + /** + * Scrolling Related + */ + @Override + protected void actionPerformed(GuiButton aButton) { + if (aButton.enabled && aButton.visible) { + if (aButton.id == 1) { + if (this.mCurrentPage < this.mPageDataArray.length - 1) { + ++this.mCurrentPage; + } + } else if (aButton.id == 2) { + if (this.mCurrentPage > 0) { + --this.mCurrentPage; + } + } + this.updateButtons(); + } + } + + /** + * Handles mouse input. + */ + @Override + public void handleMouseInput() { + 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); } + */ + } + + /** + * 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; } } } + */ + + super.mouseMovedOrUp(p_146286_1_, p_146286_2_, p_146286_3_); + } + + /** + * Allows Mouseover Tooltips + */ + @Override + protected void renderToolTip(ItemStack aStack, int p_146285_2_, int p_146285_3_) { + super.renderToolTip(aStack, p_146285_2_, p_146285_3_); + } + + /** + * Custom Buttons + */ + @SideOnly(Side.CLIENT) + static class GrindleGuiButton extends GuiButton { + + public static final ResourceLocation mBookTexture; + + static { + ResourceLocation r; + try { + r = (ResourceLocation) ReflectionUtils.getField(GuiScreenBook.class, "bookGuiTextures") + .get(null); + + } catch (IllegalArgumentException | IllegalAccessException e) { + r = new ResourceLocation("textures/gui/book.png"); + } + mBookTexture = r; + } + + private final boolean aPageForward; + + public GrindleGuiButton(int aID, int aX, int aY, boolean aForwards) { + this(aID, aX, aY, 20, 12, aForwards); + } + + public GrindleGuiButton(int aID, int aX, int aY, int aWidth, int aHeight, boolean aForwards) { + super(aID, aX, aY, aWidth, aHeight, ""); + this.aPageForward = aForwards; + } + + /** + * Draws this button to the screen. + */ + public void drawButton(Minecraft aGame, int aX, int aY) { + if (this.visible) { + 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); + aGame.getTextureManager().bindTexture(iconLocation); + int k = 0; + int l = 192; + + if (flag) { + k += 23; + } + + if (!this.aPageForward) { + l += 13; + } + + this.drawTexturedModalRect(this.xPosition, this.yPosition, k, l, 22, 12); + } + } + } + + public static class GrindleData { + + public static enum GrindleMode { + PROSPECTING(0), + ELEMENT(1); + private final int aModeID; + + private GrindleMode(final int aMode) { + this.aModeID = aMode; + } + + public int getMode() { + return this.aModeID; + } + } + + final boolean mValid; + final ItemStack mStack; + final String mTitle, mPosInfo, mTierDim; + final AutoMap mListData; + final GrindleMode mMode; + final int mExtraInformation; + + public GrindleData(ItemStack iStack) { + + if (iStack == null) { + mValid = false; + mStack = null; + mTitle = null; + mListData = null; + mMode = null; + mExtraInformation = 0; + this.mTierDim = ""; + this.mPosInfo = ""; + } else { + + this.mStack = iStack; + + int aType = -1; + boolean isProspecting = false; + + // If Input stack is a Data stick/Orb, set a valid type. + if (GT_Utility.areStacksEqual(iStack, CI.getDataStick(), true)) { + aType = 0; + } else if (GT_Utility.areStacksEqual(iStack, CI.getDataOrb(), true)) { + aType = 1; + } + + NBTTagCompound tNBT = iStack.getTagCompound(); + if (tNBT == null) { + tNBT = new NBTTagCompound(); + } + + 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; + } + + byte tTier = -1; + if (isProspecting) { + if (!tNBT.hasKey("prospection_tier") && tNBT.hasKey("prospection")) { + tTier = 0; + } else if (tNBT.hasKey("prospection_tier") && !tNBT.hasKey("prospection")) { + tTier = tNBT.getByte("prospection_tier"); + } + } + + mExtraInformation = isProspecting ? tTier : -1; + + if (tTier >= 0) { + String xPos, yPos, zPos, aDim; + String aPositionString, aInfoString; + Set aOreTypes = new LinkedHashSet(); + Set aOilTypes = new LinkedHashSet(); + + // Set variables that are shared between prospection types. + if (tTier == 0) { + String tData = tNBT.getString("prospection"); + String[] tDataArray = tData.split(","); + xPos = tDataArray[0]; + yPos = tDataArray[1]; + zPos = tDataArray[2]; + aDim = tDataArray[3]; + aOilTypes.add("Oil Type: " + tDataArray[5]); + aOilTypes.add("--------------------"); + aOreTypes.add("Ore Types: "); + for (int i = 6; tDataArray.length > i; i++) { + aOreTypes.add("-" + tDataArray[i]); + } + } else { + String tPos = tNBT.getString("prospection_pos"); + String[] tPosData = tPos.split(" "); + xPos = tPosData[1]; + yPos = tPosData[3]; + zPos = tPosData[5]; + aDim = tPosData[7]; + // Oil + String tOil = tNBT.getString("prospection_oils"); + String[] tOilData = tOil.split("\\|"); + if (tOilData.length > 0) { + aOilTypes.add("Oil Types:"); + for (String s : tOilData) { + if (s != null) { + aOilTypes.add(s); + } + } + aOilTypes.add("--------------------"); + } + + // Near + String tOresNear = tNBT.getString("prospection_near"); + String[] tOresNearData = tOresNear.split("\\|"); + // Middle + String tOresMid = tNBT.getString("prospection_middle"); + String[] tOresMidData = tOresMid.split("\\|"); + // Far + String tOresFar = tNBT.getString("prospection_far"); + String[] tOresFarData = tOresFar.split("\\|"); + + if ((tOresNearData.length + tOresMidData.length + tOresFarData.length) > 0) { + aOreTypes.add("Ore Types:"); + if (tOresNearData.length > 0) { + for (String s : tOresNearData) { + if (s != null) { + aOreTypes.add("-" + s + " - Near"); + } + } + } + if (tOresMidData.length > 0) { + for (String s : tOresMidData) { + if (s != null) { + aOreTypes.add("-" + s + " - Mid"); + } + } + } + if (tOresFarData.length > 0) { + for (String s : tOresFarData) { + if (s != null) { + aOreTypes.add("-" + s + " - Far"); + } + } + } + } + } + + mListData = new AutoMap(); + if (aOilTypes.size() > 0) { + for (String aOils : aOilTypes) { + if (aOils != null && aOils.length() > 0) { + mListData.put(aOils); + } + } + } + + if (aOreTypes.size() > 0) { + for (String aOres : aOreTypes) { + if (aOres != null && aOres.length() > 0) { + mListData.put(aOres); + } + } + } + + // Set Types + mMode = GrindleMode.PROSPECTING; + this.mTierDim = (aInfoString = "Tier: " + tTier + " | Dim: " + aDim); + this.mPosInfo = (aPositionString = "X:" + xPos + ", Y:" + yPos + ", Z:" + zPos); + this.mValid = true; + } + + // Non-Prospectic Data + else { + mValid = true; + mListData = null; + mMode = GrindleMode.ELEMENT; + this.mTierDim = "PLACEHOLDER"; + this.mPosInfo = "PLACEHOLDER"; + } + } + } + } } diff --git a/src/main/java/gtPlusPlus/core/gui/item/GuiScreenGrindle.java b/src/main/java/gtPlusPlus/core/gui/item/GuiScreenGrindle.java index cf94fbbb84..f9b0e8c161 100644 --- a/src/main/java/gtPlusPlus/core/gui/item/GuiScreenGrindle.java +++ b/src/main/java/gtPlusPlus/core/gui/item/GuiScreenGrindle.java @@ -1,13 +1,15 @@ package gtPlusPlus.core.gui.item; -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; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -23,468 +25,487 @@ import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraft.util.ChatAllowedCharacters; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; - -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 org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; @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 */ - private final EntityPlayer editingPlayer; - private final ItemStack bookObj; - /** Whether the book is signed or can still be edited */ - private final boolean bookIsUnsigned; - private boolean field_146481_r; - private boolean field_146480_s; - /** Update ticks since the gui was opened */ - private int updateCount; - private final int bookImageWidth = 192; - private final int bookImageHeight = 192; - private int bookTotalPages = 1; - private int currPage; - private NBTTagList bookPages; - private String bookTitle = ""; - private GuiScreenGrindle.NextPageButton buttonNextPage; - private GuiScreenGrindle.NextPageButton buttonPreviousPage; - private GuiButton buttonDone; - /** The GuiButton to sign this book. */ - private GuiButton buttonSign; - private GuiButton buttonFinalize; - private GuiButton buttonCancel; - - // Texture - private static final ResourceLocation iconLocation = new ResourceLocation(CORE.MODID, - "textures/gui/itemGrindle.png"); - - /** The inventory to render on screen */ - private final BaseInventoryGrindle inventory; - - public GuiScreenGrindle(final Container_Grindle containerItem, final EntityPlayer player) { - super(containerItem); - this.inventory = containerItem.inventory; - this.editingPlayer = player; - this.bookObj = this.inventory.getStackInSlot(0); - this.bookIsUnsigned = (this.bookObj == null ? true : false); - - if (this.bookObj != null) { - if (this.bookObj.hasTagCompound()) { - final NBTTagCompound nbttagcompound = this.bookObj.getTagCompound(); - this.bookPages = nbttagcompound.getTagList("pages", 8); - - if (this.bookPages != null) { - this.bookPages = (NBTTagList) this.bookPages.copy(); - this.bookTotalPages = this.bookPages.tagCount(); - - if (this.bookTotalPages < 1) { - this.bookTotalPages = 1; - } - } - } - - - if ((this.bookPages == null) && this.bookIsUnsigned) { this.bookPages = - new NBTTagList(); this.bookPages.appendTag(new NBTTagString("")); - this.bookTotalPages = 1; } - - } - } - - /** - * Called from the main game loop to update the screen. - */ - @Override - public void updateScreen() { - super.updateScreen(); - ++this.updateCount; - } - - /** - * Adds the buttons (and other controls) to the screen in question. - */ - @Override - @SuppressWarnings("u