diff options
| author | Lance5057 <Lance5057@gmail.com> | 2015-10-05 00:02:32 -0500 |
|---|---|---|
| committer | Lance5057 <Lance5057@gmail.com> | 2015-10-15 04:54:18 -0500 |
| commit | d67ec64707414df6f78f45ec1710b4ec3fc1ef66 (patch) | |
| tree | 6a926cb12990aa88cb62e8ec099045f5b54fd8b1 /src/main/java/gmail/Lance5057/gui | |
| parent | adefc630eb6876c19660c4f51876cc9bf00d78f0 (diff) | |
Refactor and Compartmentalize all the codes!
Diffstat (limited to 'src/main/java/gmail/Lance5057/gui')
3 files changed, 0 insertions, 367 deletions
diff --git a/src/main/java/gmail/Lance5057/gui/Gui_CrestMount.java b/src/main/java/gmail/Lance5057/gui/Gui_CrestMount.java deleted file mode 100644 index cbd3b8d..0000000 --- a/src/main/java/gmail/Lance5057/gui/Gui_CrestMount.java +++ /dev/null @@ -1,89 +0,0 @@ -package gmail.Lance5057.gui; - -import gmail.Lance5057.TinkersDefense; -import gmail.Lance5057.containers.Container_CrestMount; -import gmail.Lance5057.network.Message_CrestMount; -import gmail.Lance5057.tileentities.TileEntity_CrestMount; - -import javax.swing.plaf.basic.BasicComboBoxUI.KeyHandler; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -public class Gui_CrestMount extends GuiContainer -{ -private float xSize_lo; -private float ySize_lo; - -private static final ResourceLocation iconLocation = new ResourceLocation("tinkersdefense", "textures/gui/crest_mount.png"); - -private final TileEntity_CrestMount inventory; - -public Gui_CrestMount(InventoryPlayer invPlayer, TileEntity_CrestMount te_crest) -{ -super(new Container_CrestMount(invPlayer, te_crest)); -this.inventory = te_crest; - - -} - -@Override -public void initGui() -{ - super.initGui(); - this.buttonList.add(new GuiButton(1,this.guiLeft + 61, this.guiTop + 8, 18, 18,"Flip")); - this.buttonList.add(new GuiButton(3,this.guiLeft + 79, this.guiTop + 8, 18, 18,"Flip")); - this.buttonList.add(new GuiButton(2,this.guiLeft + 97, this.guiTop + 8, 18, 18,"Flip")); - - this.buttonList.add(new GuiButton(4,this.guiLeft + 79, this.guiTop + 63, 18, 18,"Flip")); -} - -@Override -protected void actionPerformed(GuiButton button) -{ - for(int i = 1; i<5; i++) - { - if(button.id == i) - { - if(inventory.flip[i-1]==false) - inventory.flip[i-1]=true; - else - inventory.flip[i-1]=false; - - TinkersDefense.INSTANCE.sendToServer(new Message_CrestMount(inventory.xCoord, inventory.yCoord, inventory.zCoord, inventory.flip)); - } - } -} - -public void drawScreen(int par1, int par2, float par3) -{ -super.drawScreen(par1, par2, par3); -this.xSize_lo = (float)par1; -this.ySize_lo = (float)par2; -} - -protected void drawGuiContainerForegroundLayer(int par1, int par2) -{ - -} - -protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) -{ -GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); -this.mc.getTextureManager().bindTexture(iconLocation); -int k = (this.width - this.xSize) / 2; -int l = (this.height - this.ySize) / 2; -this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); -} -}
\ No newline at end of file diff --git a/src/main/java/gmail/Lance5057/gui/Gui_FinishingAnvil.java b/src/main/java/gmail/Lance5057/gui/Gui_FinishingAnvil.java deleted file mode 100644 index 0e16dd8..0000000 --- a/src/main/java/gmail/Lance5057/gui/Gui_FinishingAnvil.java +++ /dev/null @@ -1,235 +0,0 @@ -package gmail.Lance5057.gui; - -import gmail.Lance5057.TinkersDefense; -import gmail.Lance5057.containers.Container_CrestMount; -import gmail.Lance5057.containers.Container_FinishingAnvil; -import gmail.Lance5057.network.Message_CrestMount; -import gmail.Lance5057.network.Message_FinishingAnvil; -import gmail.Lance5057.tileentities.TileEntity_CrestMount; -import gmail.Lance5057.tileentities.TileEntity_FinishingAnvil; - -import org.lwjgl.opengl.GL11; - -import tconstruct.library.TConstructRegistry; -import tconstruct.library.tools.ToolCore; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ResourceLocation; - -public class Gui_FinishingAnvil extends GuiContainer -{ - private float xSize_lo; - private float ySize_lo; - - private ItemStack bigCopy; - private Boolean isNull = true; - private ItemStack editItem; - private RenderItem bigRender = new RenderItem_FinishingAnvil(this); - - public final TileEntity_FinishingAnvil inventory; - private ResourceLocation forGui; - - private int leftButtonPosX = 0; - private int leftButtonPosY = 0; - private int xLIcon_one, yLIcon_one; - private int xLIcon_two, yLIcon_two; - private int xLIcon_three, yLIcon_three; - private int leftSelect = 0; - - private int rightButtonPosX = 0; - private int rightButtonPosY = 2; - private int xRIcon_one, yRIcon_one; - private int xRIcon_two, yRIcon_two; - private int xRIcon_three, yRIcon_three; - - String[] renders; - - NBTTagCompound tags; - - private static final ResourceLocation iconLocation = new ResourceLocation("tinkersdefense", "textures/gui/finishinganvil.png"); - - public Gui_FinishingAnvil(InventoryPlayer invPlayer, TileEntity_FinishingAnvil te) - { - super(new Container_FinishingAnvil(invPlayer, te)); - this.inventory = te; - - renders = new String[4]; - renders[0] = "Head"; - renders[1] = "Accessory"; - renders[2] = "Handle"; - renders[3] = "Extra"; - } - - @Override - public void initGui() - { - super.initGui(); - this.buttonList.add(new GuiButton(1 ,this.guiLeft+25, this.guiTop+10, 10, 10,"▲")); - this.buttonList.add(new GuiButton(2 ,this.guiLeft+25, this.guiTop+59, 10, 10,"▼")); - this.buttonList.add(new GuiButton(3 ,this.guiLeft+47, this.guiTop+49, 18, 18,"✓")); - - this.buttonList.add(new GuiButton(4 ,this.guiLeft+5, this.guiTop+10, 20, 20,"")); - this.buttonList.add(new GuiButton(5 ,this.guiLeft+5, this.guiTop+30, 20, 20,"")); - this.buttonList.add(new GuiButton(6 ,this.guiLeft+5, this.guiTop+50, 20, 20,"")); - - this.buttonList.add(new GuiButton(7 ,this.guiLeft+120, this.guiTop+10, 10, 10,"▲")); - this.buttonList.add(new GuiButton(8 ,this.guiLeft+120, this.guiTop+59, 10, 10,"▼")); - - this.buttonList.add(new GuiButton(9 ,this.guiLeft+130, this.guiTop+10, 20, 20,"")); - this.buttonList.add(new GuiButton(10 ,this.guiLeft+130, this.guiTop+30, 20, 20,"")); - this.buttonList.add(new GuiButton(11 ,this.guiLeft+130, this.guiTop+50, 20, 20,"")); - - } - - @Override - protected void actionPerformed(GuiButton button) - { - if(tags != null) - switch(button.id) - { - case 1: if(this.leftButtonPosX > 0) this.leftButtonPosX--; break; - case 2: if(this.leftButtonPosX+2 < ((ToolCore)bigCopy.getItem()).getPartAmount() - 1) this.leftButtonPosX++; break; - - case 3: - TinkersDefense.INSTANCE.sendToServer(new Message_FinishingAnvil(inventory.xCoord, inventory.yCoord, inventory.zCoord, this.bigCopy)); - break; - - case 4: leftSelect = 0; rightButtonPosY = 2; break; - case 5: leftSelect = 1; rightButtonPosY = 3; break; - case 6: leftSelect = 2; rightButtonPosY = 4; break; - - case 7: if(this.rightButtonPosX > 0) this.rightButtonPosX--; break; - case 8: this.rightButtonPosX++; break; - - case 9: - if(tags.hasKey("Render"+renders[leftSelect])) - { - tags.setInteger("Render"+renders[leftSelect], bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[leftSelect]) + ((rightButtonPosX) * TinkersDefense.config.MaterialIndex)); - if(rightButtonPosX > 0) - tags.setInteger(renders[leftSelect]+"Color", TConstructRegistry.getMaterial(tags.getInteger(renders[leftSelect])).primaryColor()); - else - tags.removeTag(renders[leftSelect]+"Color"); - } - break; - - case 10: - if(tags.hasKey("Render"+renders[leftSelect])) - { - tags.setInteger("Render"+renders[leftSelect], bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[leftSelect]) + ((rightButtonPosX + 1) * TinkersDefense.config.MaterialIndex)); - tags.setInteger(renders[leftSelect]+"Color", TConstructRegistry.getMaterial(tags.getInteger(renders[leftSelect])).primaryColor()); - } - break; - - case 11: - if(tags.hasKey("Render"+renders[leftSelect])) - { - tags.setInteger("Render"+renders[leftSelect], bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[leftSelect]) + ((rightButtonPosX + 2) * TinkersDefense.config.MaterialIndex)); - tags.setInteger(renders[leftSelect]+"Color", TConstructRegistry.getMaterial(tags.getInteger(renders[leftSelect])).primaryColor()); - } - break; - } - } - public void drawScreen(int par1, int par2, float par3) - { - - - if(inventory.getStackInSlot(0) != null && isNull == true - /*inventory.getStackInSlot(0).getItem() != this.bigCopy*/) - { - this.bigCopy = inventory.getStackInSlot(0).copy(); - if(bigCopy.hasTagCompound() && bigCopy.getTagCompound().hasKey("InfiTool")) - tags = bigCopy.getTagCompound().getCompoundTag("InfiTool"); - isNull = false; - } - else if(inventory.getStackInSlot(0) == null) - { - this.bigCopy = null; - isNull = true; - } - - super.drawScreen(par1, par2, par3); - this.xSize_lo = (float)par1; - this.ySize_lo = (float)par2; - } - - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { - this.forGui = new ResourceLocation("tinkersdefense", "textures/gui/finishinganvil.png"); - - this.xLIcon_one = 0; - this.yLIcon_one = 176; - this.xLIcon_two = 0; - this.yLIcon_two = 176; - this.xLIcon_three = 0; - this.yLIcon_three = 176; - - this.xRIcon_one = 0; - this.yRIcon_one = 176; - this.xRIcon_two = 0; - this.yRIcon_two = 176; - this.xRIcon_three = 0; - this.yRIcon_three = 176; - - if(inventory.getStackInSlot(0) != null) - { - editItem = inventory.getStackInSlot(0); - if(editItem.getItem() instanceof ToolCore) - { - //this.drawTexturedModelRectFromIcon(this.guiLeft+4, this.guiTop+14, - // ((ToolCore)this.inventorySlots.inventorySlots.get(0)).getHeadItem(), 16, 16); - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.forGui = new ResourceLocation("tinkersdefense","textures/gui/"+((ToolCore)editItem.getItem()).getDefaultFolder()+".png"); - this.xLIcon_one = 32; - this.yLIcon_one = 0; - this.xLIcon_two = 48; - this.yLIcon_two = 0; - this.xLIcon_three = 64; - this.yLIcon_three = 0; - - this.xRIcon_one = 0; - this.yRIcon_one = 0; - this.xRIcon_two = 16; - this.yRIcon_two = 0; - this.xRIcon_three = 32; - this.yRIcon_three = 0; - } - } - - this.mc.getTextureManager().bindTexture(this.forGui); - if(inventory.getStackInSlot(0) != null) - this.drawTexturedModalRect(7,12 + (leftSelect * 20),16,0,16,16); - - this.drawTexturedModalRect(7,12,this.xLIcon_one+(this.leftButtonPosX*16),this.yLIcon_one+(this.leftButtonPosY*16),16,16); - this.drawTexturedModalRect(7,32,this.xLIcon_two+(this.leftButtonPosX*16),this.yLIcon_two+(this.leftButtonPosY*16),16,16); - this.drawTexturedModalRect(7,52,this.xLIcon_three+(this.leftButtonPosX*16),this.yLIcon_three+(this.leftButtonPosY*16),16,16); - - this.drawTexturedModalRect(132,12,this.xRIcon_one+(this.rightButtonPosX*16),this.yRIcon_one+(this.rightButtonPosY*16),16,16); - this.drawTexturedModalRect(132,32,this.xRIcon_two+(this.rightButtonPosX*16),this.yRIcon_two+(this.rightButtonPosY*16),16,16); - this.drawTexturedModalRect(132,52,this.xRIcon_three+(this.rightButtonPosX*16),this.yRIcon_three+(this.rightButtonPosY*16),16,16); - - bigRender.renderItemAndEffectIntoGUI(fontRendererObj, this.mc.getTextureManager(), bigCopy, 23, 5); - - } - - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(iconLocation); - int k = ((this.width - this.xSize) / 2); - int l = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l, 0, 0, this.xSize+80, this.ySize); - } - - protected void injectIcons() - { - - } -} diff --git a/src/main/java/gmail/Lance5057/gui/RenderItem_FinishingAnvil.java b/src/main/java/gmail/Lance5057/gui/RenderItem_FinishingAnvil.java deleted file mode 100644 index 6c67d44..0000000 --- a/src/main/java/gmail/Lance5057/gui/RenderItem_FinishingAnvil.java +++ /dev/null @@ -1,43 +0,0 @@ -package gmail.Lance5057.gui; - -import org.lwjgl.opengl.GL11; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class RenderItem_FinishingAnvil extends RenderItem -{ - private Gui_FinishingAnvil anvilGui; - RenderItem_FinishingAnvil(Gui_FinishingAnvil gui) - { - super(); - anvilGui = gui; - } - - @Override - public void renderItemAndEffectIntoGUI(FontRenderer fontRenderer, TextureManager textureManager, ItemStack itemStack, int x, int y) - { - if (itemStack == null) - { - return; - } - - RenderHelper.enableGUIStandardItemLighting(); - - Slot slot = anvilGui.inventorySlots.getSlotFromInventory(anvilGui.inventory, 0); - - if(slot.getStack() != null) - { - GL11.glPushMatrix(); - - GL11.glScalef(3.0f,3.0f,1.0f); - super.renderItemAndEffectIntoGUI(fontRenderer, textureManager, itemStack, x, y); - - GL11.glPopMatrix(); - } - } -} |
