From ff41fd97eb377dd1ebd78b4b56e81c59ca786667 Mon Sep 17 00:00:00 2001 From: Lance5057 Date: Fri, 29 Jul 2016 08:52:49 -0500 Subject: Prelaunch backup --- .../finishingAnvil/Container_FinishingAnvil.java | 2 +- .../blocks/finishingAnvil/Gui_FinishingAnvil.java | 576 ++++++++++++++++----- .../finishingAnvil/RenderItem_FinishingAnvil.java | 2 +- .../finishingAnvil/utilities/Injector.java | 71 ++- 4 files changed, 488 insertions(+), 163 deletions(-) (limited to 'src/main/java/lance5057/tDefense/finishingAnvil') diff --git a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Container_FinishingAnvil.java b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Container_FinishingAnvil.java index 3b775f2..f137076 100644 --- a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Container_FinishingAnvil.java +++ b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Container_FinishingAnvil.java @@ -10,7 +10,7 @@ public class Container_FinishingAnvil extends Container { public Container_FinishingAnvil(InventoryPlayer inventoryPlayer, TileEntity_FinishingAnvil te) { - addSlotToContainer(new Slot(te, 0, 48, 32)); + addSlotToContainer(new Slot(te, 0, 39, 32)); for(int x = 0; x < 9; x++) { diff --git a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Gui_FinishingAnvil.java b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Gui_FinishingAnvil.java index b9fc7d2..0395b61 100644 --- a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Gui_FinishingAnvil.java +++ b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Gui_FinishingAnvil.java @@ -4,22 +4,33 @@ import java.util.ArrayList; import java.util.List; import lance5057.tDefense.TinkersDefense; +import lance5057.tDefense.armor.ArmorCore; +import lance5057.tDefense.armor.renderers.ArmorRenderer; import lance5057.tDefense.core.network.Message_FinishingAnvil; import lance5057.tDefense.finishingAnvil.utilities.Injector; import lance5057.tDefense.finishingAnvil.utilities.ToolCoreTip; +import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.texture.ITextureObject; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; +import org.lwjgl.util.glu.Project; -import cpw.mods.fml.client.config.GuiButtonExt; import tconstruct.library.TConstructRegistry; import tconstruct.library.tools.ToolCore; +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.client.config.GuiButtonExt; public class Gui_FinishingAnvil extends GuiContainer { @@ -27,15 +38,16 @@ public class Gui_FinishingAnvil extends GuiContainer private float ySize_lo; private ItemStack bigCopy; - private Boolean isNull = true; + //private Boolean isNull = true; private ItemStack editItem; - private RenderItem bigRender = new RenderItem_FinishingAnvil(this); + private final RenderItem bigRender = new RenderItem_FinishingAnvil( + this); public final TileEntity_FinishingAnvil inventory; private ResourceLocation forGui; private int leftButtonPosX = 0; - private int leftButtonPosY = 0; + private final int leftButtonPosY = 0; private int xLIcon_one, yLIcon_one; private int xLIcon_two, yLIcon_two; private int xLIcon_three, yLIcon_three; @@ -51,58 +63,94 @@ public class Gui_FinishingAnvil extends GuiContainer NBTTagCompound tags; - private static final ResourceLocation iconLocation = new ResourceLocation("tinkersdefense", "textures/gui/finishinganvil.png"); + boolean renderFlat = true; + boolean renderBiped = true; + int rotation = 0; + + InventoryPlayer player; + + 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; + inventory = te; renders = new String[4]; renders[0] = "Head"; renders[1] = "Accessory"; renders[2] = "Handle"; renders[3] = "Extra"; + + player = invPlayer; } @Override public void initGui() { super.initGui(); - this.buttonList.add(new GuiButtonExt(1, this.guiLeft + 25, this.guiTop + 10, 10, 10, "⇑")); - this.buttonList.add(new GuiButtonExt(2, this.guiLeft + 25, this.guiTop + 59, 10, 10, "⇓")); - this.buttonList.add(new GuiButtonExt(3, this.guiLeft + 47, this.guiTop + 49, 18, 18, "✓")); - - this.buttonList.add(new GuiButtonExt(4, this.guiLeft + 5, this.guiTop + 10, 20, 20, "")); - this.buttonList.add(new GuiButtonExt(5, this.guiLeft + 5, this.guiTop + 30, 20, 20, "")); - this.buttonList.add(new GuiButtonExt(6, this.guiLeft + 5, this.guiTop + 50, 20, 20, "")); - - this.buttonList.add(new GuiButtonExt(7, this.guiLeft + 120, this.guiTop + 10, 10, 10, "⇑")); - this.buttonList.add(new GuiButtonExt(8, this.guiLeft + 120, this.guiTop + 60, 10, 10, "⇓")); - - this.buttonList.add(new GuiButtonExt(9, this.guiLeft + 130, this.guiTop + 10, 20, 20, "")); - this.buttonList.add(new GuiButtonExt(10, this.guiLeft + 130, this.guiTop + 30, 20, 20, "")); - this.buttonList.add(new GuiButtonExt(11, this.guiLeft + 130, this.guiTop + 50, 20, 20, "")); - + buttonList.add(new GuiButtonExt(1, guiLeft + 25, guiTop + 11, 10, 10, + "⇑")); + buttonList.add(new GuiButtonExt(2, guiLeft + 25, guiTop + 61, 10, 10, + "⇓")); + buttonList.add(new GuiButtonExt(3, guiLeft + 38, guiTop + 53, 18, 18, + "✓")); + + buttonList.add(new GuiButtonExt(4, guiLeft + 5, guiTop + 11, 20, 20, "")); + buttonList.add(new GuiButtonExt(5, guiLeft + 5, guiTop + 31, 20, 20, "")); + buttonList.add(new GuiButtonExt(6, guiLeft + 5, guiTop + 51, 20, 20, "")); + + buttonList.add(new GuiButtonExt(7, guiLeft + 141, guiTop + 11, 10, 10, + "⇑")); + buttonList.add(new GuiButtonExt(8, guiLeft + 141, guiTop + 61, 10, 10, + "⇓")); + + buttonList.add(new GuiButtonExt(9, guiLeft + 151, guiTop + 11, 20, 20, + "")); + buttonList.add(new GuiButtonExt(10, guiLeft + 151, guiTop + 31, 20, 20, + "")); + buttonList.add(new GuiButtonExt(11, guiLeft + 151, guiTop + 51, 20, 20, + "")); + + buttonList.add(new GuiButtonExt(12, guiLeft + 38, guiTop + 11, 18, 18, + "∅")); + buttonList.add(new GuiButtonExt(13, guiLeft + 120, guiTop + 11, 18, 18, + "3D")); + buttonList.add(new GuiButtonExt(14, guiLeft + 120, guiTop + 53, 18, 18, + "")); + + buttonList.add(new GuiButtonExt(15, guiLeft + 59, guiTop + 60, 10, 10, + "<")); + buttonList.add(new GuiButtonExt(16, guiLeft + 107, guiTop + 60, 10, 10, + ">")); } @Override protected void actionPerformed(GuiButton button) { if(tags != null) + { switch(button.id) { case 1: - if(this.leftButtonPosX > 0) - this.leftButtonPosX--; + if(leftButtonPosX > 0) + { + leftButtonPosX--; + } break; case 2: - if(this.leftButtonPosX + 3 < ((ToolCore) bigCopy.getItem()).getPartAmount()) - this.leftButtonPosX++; + if(leftButtonPosX + 3 < ((ToolCore) bigCopy.getItem()).getPartAmount()) + { + leftButtonPosX++; + } break; case 3: - TinkersDefense.INSTANCE.sendToServer(new Message_FinishingAnvil(inventory.xCoord, inventory.yCoord, inventory.zCoord, this.bigCopy)); + TinkersDefense.INSTANCE.sendToServer(new Message_FinishingAnvil( + inventory.xCoord, inventory.yCoord, + inventory.zCoord, bigCopy)); break; case 4: @@ -119,94 +167,205 @@ public class Gui_FinishingAnvil extends GuiContainer break; case 7: - if(this.rightButtonPosX > 0) + if(rightButtonPosX > 0) { - this.rightButtonPosX--; + rightButtonPosX--; } - else if(this.rightButtonPosY > (0 + this.leftSelect * 4)) + else if(rightButtonPosY > (0 + leftSelect * 4)) { - this.rightButtonPosY--; - this.rightButtonPosX = 15; + rightButtonPosY--; + rightButtonPosX = 15; } break; - case 8: - this.rightButtonPosX++; - if(this.rightButtonPosX >= 16) + + case 13: + renderFlat = !renderFlat; + break; + + case 14: + renderBiped = !renderBiped; + break; + + case 15: + if(rotation <= 0) { - this.rightButtonPosY++; - this.rightButtonPosX = 0; + rotation += 360; } + rotation -= 8; break; - case 9: - if(tags.hasKey("Render" + renders[leftSelect])) + case 16: + if(rotation >= 360) { - tags.setInteger("Render" + renders[leftSelect], bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[leftSelect]) + ((rightButtonPosX + ((rightButtonPosY % 3) * 16)) * TinkersDefense.config.MaterialIndex)); - if(rightButtonPosX > 0) - tags.setInteger(renders[leftSelect] + "Color", TConstructRegistry.getMaterial(tags.getInteger(renders[leftSelect])).primaryColor()); - else - tags.removeTag(renders[leftSelect] + "Color"); + rotation -= 360; } + rotation += 8; break; - case 10: - if(tags.hasKey("Render" + renders[leftSelect])) + default: + if(bigCopy.getItem() instanceof ArmorCore) { - tags.setInteger("Render" + renders[leftSelect], bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[leftSelect]) + ((rightButtonPosX + 1 + ((rightButtonPosY % 3) * 16)) * TinkersDefense.config.MaterialIndex)); - tags.setInteger(renders[leftSelect] + "Color", TConstructRegistry.getMaterial(tags.getInteger(renders[leftSelect])).primaryColor()); + doArmorEdit(button.id); } - break; + else + { + doToolEdit(button.id); + } + } + } + } - case 11: - if(tags.hasKey("Render" + renders[leftSelect])) + public void doToolEdit(int id) + { + switch(id) + { + case 9: + if(tags.hasKey("Render" + renders[leftSelect])) + { + tags.setInteger("Render" + renders[leftSelect], bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[leftSelect]) + ((rightButtonPosX + ((rightButtonPosY % 3) * 16)) * TinkersDefense.config.MaterialIndex)); + if(rightButtonPosX > 0) { - tags.setInteger("Render" + renders[leftSelect], bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[leftSelect]) + ((rightButtonPosX + 2 + ((rightButtonPosY % 3) * 16)) * TinkersDefense.config.MaterialIndex)); tags.setInteger(renders[leftSelect] + "Color", TConstructRegistry.getMaterial(tags.getInteger(renders[leftSelect])).primaryColor()); } - break; - } + 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 + ((rightButtonPosY % 3) * 16)) * 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 + ((rightButtonPosY % 3) * 16)) * TinkersDefense.config.MaterialIndex)); + tags.setInteger(renders[leftSelect] + "Color", TConstructRegistry.getMaterial(tags.getInteger(renders[leftSelect])).primaryColor()); + } + break; + + case 12: + tags.setInteger("RenderHead", bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[0])); + tags.setInteger("RenderAccessory", bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[1])); + tags.setInteger("RenderHandle", bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[2])); + tags.setInteger("RenderExtra", bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[3])); + + tags.removeTag(renders[0] + "Color"); + tags.removeTag(renders[1] + "Color"); + tags.removeTag(renders[2] + "Color"); + tags.removeTag(renders[3] + "Color"); + break; + + case 8: + rightButtonPosX++; + if(rightButtonPosX >= 16) + { + rightButtonPosY++; + rightButtonPosX = 0; + } + break; + + } } + public void doArmorEdit(int id) + { + final NBTTagCompound aTags = bigCopy.getTagCompound().getCompoundTag("ArmorRenderer"); + final ArmorCore armor = (ArmorCore) bigCopy.getItem(); + final List boxes = armor.getRenderer().boxList; + + switch(id) + { + case 9: + aTags.setBoolean(boxes.get(rightButtonPosX + 9).boxName, !aTags.getBoolean(boxes.get(rightButtonPosX + (rightButtonPosY % 3) + 9).boxName)); + break; + + case 10: + aTags.setBoolean(boxes.get(rightButtonPosX + 1 + 9).boxName, !aTags.getBoolean(boxes.get(rightButtonPosX + 1 + (rightButtonPosY % 3) + 9).boxName)); + break; + + case 11: + aTags.setBoolean(boxes.get(rightButtonPosX + 2 + 9).boxName, !aTags.getBoolean(boxes.get(rightButtonPosX + 2 + (rightButtonPosY % 3) + 9).boxName)); + break; + + case 12: + tags.setInteger("RenderHead", bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[0])); + tags.setInteger("RenderAccessory", bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[1])); + tags.setInteger("RenderHandle", bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[2])); + tags.setInteger("RenderExtra", bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[3])); + + tags.removeTag(renders[0] + "Color"); + tags.removeTag(renders[1] + "Color"); + tags.removeTag(renders[2] + "Color"); + tags.removeTag(renders[3] + "Color"); + break; + + case 8: + if(rightButtonPosX < boxes.size() - 12) + { + rightButtonPosX++; + } + break; + + } + } + + @Override public void drawScreen(int x, int y, float par3) { - if(inventory.getStackInSlot(0) != null && isNull == true - /*inventory.getStackInSlot(0).getItem() != this.bigCopy*/) + if(inventory.getStackInSlot(0) != null) { - this.bigCopy = inventory.getStackInSlot(0).copy(); - if(bigCopy.hasTagCompound() && bigCopy.getTagCompound().hasKey("InfiTool")) - tags = bigCopy.getTagCompound().getCompoundTag("InfiTool"); - isNull = false; + if(bigCopy == null) + { + bigCopy = inventory.getStackInSlot(0).copy(); + if(bigCopy.hasTagCompound() && bigCopy.getTagCompound().hasKey("InfiTool")) + { + tags = bigCopy.getTagCompound().getCompoundTag("InfiTool"); + } + } + else if(inventory.getStackInSlot(0).getItem() != bigCopy.getItem() || inventory.getStackInSlot(0).getItemDamage() != bigCopy.getItemDamage()) + { + bigCopy = null; + } } else if(inventory.getStackInSlot(0) == null) { - this.bigCopy = null; - isNull = true; + bigCopy = null; } super.drawScreen(x, y, par3); drawTooltip(x, y); - this.xSize_lo = (float) x; - this.ySize_lo = (float) y; + xSize_lo = x; + ySize_lo = y; } + @Override 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; + mc.getTextureManager().bindTexture(iconLocation); + + drawTexturedModalRect(121, 54, 16, 176, 16, 16); + + xLIcon_one = 0; + yLIcon_one = 176; + xLIcon_two = 0; + yLIcon_two = 176; + xLIcon_three = 0; + yLIcon_three = 176; + + xRIcon_one = 0; + yRIcon_one = 176; + xRIcon_two = 0; + yRIcon_two = 176; + xRIcon_three = 0; + yRIcon_three = 176; if(inventory.getStackInSlot(0) != null) { @@ -217,110 +376,259 @@ public class Gui_FinishingAnvil extends GuiContainer // ((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 = 32; - this.xRIcon_two = 16; - this.yRIcon_two = 32; - this.xRIcon_three = 32; - this.yRIcon_three = 32; + forGui = new ResourceLocation( + "tinkersdefense", + "textures/gui/" + ((ToolCore) editItem.getItem()).getDefaultFolder() + ".png"); + xLIcon_one = 32; + yLIcon_one = 0; + xLIcon_two = 48; + yLIcon_two = 0; + xLIcon_three = 64; + yLIcon_three = 0; + + xRIcon_one = 0; + yRIcon_one = 32; + xRIcon_two = 16; + yRIcon_two = 32; + xRIcon_three = 32; + yRIcon_three = 32; } } - this.mc.getTextureManager().bindTexture(this.forGui); - if(inventory.getStackInSlot(0) != null) + if(forGui != null && bigCopy != null) { -// int leftMax = leftSelect; -// if(leftMax > 2) -// leftMax = 2; - this.drawTexturedModalRect(7, 12 + ((leftSelect - leftButtonPosX) * 20), 16, 0, 16, 16); - } + if(!(bigCopy.getItem() instanceof ArmorCore)) + { + mc.getTextureManager().bindTexture(forGui); - this.drawTexturedModalRect(7, 12, this.xLIcon_one + (this.leftButtonPosX * 16), this.yLIcon_one + 0, 16, 16); - this.drawTexturedModalRect(7, 32, this.xLIcon_two + (this.leftButtonPosX * 16), this.yLIcon_two + 0, 16, 16); - this.drawTexturedModalRect(7, 52, this.xLIcon_three + (this.leftButtonPosX * 16), this.yLIcon_three + 0, 16, 16); + if(inventory.getStackInSlot(0) != null) + { + // int leftMax = leftSelect; + // if(leftMax > 2) + // leftMax = 2; + drawTexturedModalRect(7, 13 + ((leftSelect - leftButtonPosX) * 20), 16, 0, 16, 16); + } - this.drawTexturedModalRect(132, 12, this.xRIcon_one + (this.rightButtonPosX * 16), this.yRIcon_one + (this.rightButtonPosY * 16), 16, 16); + drawTexturedModalRect(7, 13, xLIcon_one + (leftButtonPosX * 16), yLIcon_one + 0, 16, 16); + drawTexturedModalRect(7, 33, xLIcon_two + (leftButtonPosX * 16), yLIcon_two + 0, 16, 16); + drawTexturedModalRect(7, 53, xLIcon_three + (leftButtonPosX * 16), yLIcon_three + 0, 16, 16); - if(this.rightButtonPosX + 1 < 16) - this.drawTexturedModalRect(132, 32, this.xRIcon_two + (this.rightButtonPosX * 16), this.yRIcon_two + (this.rightButtonPosY * 16), 16, 16); - else - this.drawTexturedModalRect(132, 32, this.xRIcon_two + ((this.rightButtonPosX - 16) * 16), this.yRIcon_two + ((this.rightButtonPosY + 1) * 16), 16, 16); + drawTexturedModalRect(153, 13, xRIcon_one + (rightButtonPosX * 16), yRIcon_one + (rightButtonPosY * 16), 16, 16); - if(this.rightButtonPosX + 2 < 16) - this.drawTexturedModalRect(132, 52, this.xRIcon_three + (this.rightButtonPosX * 16), this.yRIcon_three + (this.rightButtonPosY * 16), 16, 16); - else - this.drawTexturedModalRect(132, 52, this.xRIcon_three + ((this.rightButtonPosX - 16) * 16), this.yRIcon_three + ((this.rightButtonPosY + 1) * 16), 16, 16); + if(rightButtonPosX + 1 < 16) + { + drawTexturedModalRect(153, 33, xRIcon_two + (rightButtonPosX * 16), yRIcon_two + (rightButtonPosY * 16), 16, 16); + } + else + { + drawTexturedModalRect(153, 33, xRIcon_two + ((rightButtonPosX - 16) * 16), yRIcon_two + ((rightButtonPosY + 1) * 16), 16, 16); + } - bigRender.renderItemAndEffectIntoGUI(fontRendererObj, this.mc.getTextureManager(), bigCopy, 23, 5); + if(rightButtonPosX + 2 < 16) + { + drawTexturedModalRect(153, 53, xRIcon_three + (rightButtonPosX * 16), yRIcon_three + (rightButtonPosY * 16), 16, 16); + } + else + { + drawTexturedModalRect(153, 53, xRIcon_three + ((rightButtonPosX - 16) * 16), yRIcon_three + ((rightButtonPosY + 1) * 16), 16, 16); + } + } + else + { + final NBTTagCompound aTags = bigCopy.getTagCompound().getCompoundTag("ArmorRenderer"); + final ArmorCore armor = (ArmorCore) bigCopy.getItem(); + final List boxes = armor.getRenderer().boxList; - } + drawTexturedModalRect(7, 13, 0, 176, 16, 16); + drawTexturedModalRect(7, 33, 0, 176, 16, 16); + drawTexturedModalRect(7, 53, 0, 176, 16, 16); - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { + //drawTexturedModalRect(153, 13, xRIcon_one + (rightButtonPosX * 16), yRIcon_one + (rightButtonPosY * 16), 16, 16); + + drawTexturedModalRect(153, 13, 64 + ((aTags.getBoolean(boxes.get(rightButtonPosX + 9).boxName) ? 0 : 1) * 16), 176, 16, 16); + drawTexturedModalRect(153, 33, 64 + ((aTags.getBoolean(boxes.get(rightButtonPosX + 1 + 9).boxName) ? 0 : 1) * 16), 176, 16, 16); + drawTexturedModalRect(153, 53, 64 + ((aTags.getBoolean(boxes.get(rightButtonPosX + 2 + 9).boxName) ? 0 : 1) * 16), 176, 16, 16); + + } + } 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() + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + mc.getTextureManager().bindTexture(iconLocation); + final int k = ((width - xSize) / 2); + final int l = (height - ySize) / 2; + drawTexturedModalRect(k, l, 0, 0, xSize + 80, ySize); + + if(renderFlat) + { + ((GuiButtonExt) buttonList.get(14)).enabled = false; + ((GuiButtonExt) buttonList.get(15)).enabled = false; + ((GuiButtonExt) buttonList.get(12)).displayString = "3D"; + + final ScaledResolution scaledresolution = new ScaledResolution(mc, + mc.displayWidth, mc.displayHeight); + bigRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), bigCopy, (int) (((scaledresolution.getScaledWidth() - 58) / 2) / 3.4), (int) (((scaledresolution.getScaledHeight() - 136) / 2) / 3.4)); + } + else + { + if(bigCopy != null && bigCopy.getItem() instanceof ArmorCore) + { + ((GuiButtonExt) buttonList.get(14)).enabled = true; + ((GuiButtonExt) buttonList.get(15)).enabled = true; + + ((GuiButtonExt) buttonList.get(12)).displayString = "2D"; + + final ArmorCore armor = (ArmorCore) bigCopy.getItem(); + + final ArmorRenderer renderer = (ArmorRenderer) armor.getArmorModel(null, bigCopy, 0); + renderer.isChild = false; + + final float yaw = player.player.prevRotationYawHead + (player.player.rotationYawHead - player.player.prevRotationYawHead); + final float yawOffset = player.player.prevRenderYawOffset + (player.player.renderYawOffset - player.player.prevRenderYawOffset); + final float limbs = player.player.prevLimbSwingAmount + (player.player.limbSwingAmount - player.player.prevLimbSwingAmount); + final float limbSwing = player.player.limbSwing - player.player.limbSwingAmount * (1.0F); + + GL11.glPushMatrix(); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glPushMatrix(); + GL11.glLoadIdentity(); + + final ScaledResolution scaledresolution = new ScaledResolution( + mc, mc.displayWidth, mc.displayHeight); + //GL11.glViewport(this.guiLeft, this.guiTop, this.width, this.height); + GL11.glViewport((scaledresolution.getScaledWidth() - 213) / 2 * scaledresolution.getScaleFactor(), (scaledresolution.getScaledHeight() - 240) / 2 * scaledresolution.getScaleFactor(), 320 * scaledresolution.getScaleFactor(), 240 * scaledresolution.getScaleFactor()); + GL11.glTranslatef(-0.34F, 0.23F, -0.1F); + Project.gluPerspective(90.0F, 1.3333334F, 9.0F, 80.0F); + final float f1 = 1.0F; + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glColor3d(1f, 1f, 1f); + RenderHelper.enableStandardItemLighting(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glTranslatef(0.0F, 3.3F, -16.0F); + GL11.glScalef(f1, f1, f1); + final float f2 = 3.0F; + GL11.glScalef(f2, f2, f2); + GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); + + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + //renderer.setRotationAngles(limbSwing, limbs, player.player.ticksExisted, 0, player.player.rotationPitch, 0.0625f, player.player); + renderer.render(player.player, limbSwing, limbs, player.player.ticksExisted, 0, 0, 0.1f); + + if(renderBiped) + { + final ModelBiped biped = new ModelBiped(0f); + //biped.bipedHeadwear.isHidden = true; + //biped.bipedHead.isHidden = true; + ResourceLocation rc = AbstractClientPlayer.getLocationSkin(player.player.getDisplayName()); + ; + FMLClientHandler.instance().getClient().renderEngine.bindTexture(rc); + final ITextureObject tex = FMLClientHandler.instance().getClient().getTextureManager().getTexture(rc); + if(tex.getGlTextureId() == 1) + { + rc = new ResourceLocation( + "minecraft:textures/entity/steve.png"); + FMLClientHandler.instance().getClient().renderEngine.bindTexture(rc); + } + + biped.isChild = false; + biped.render(player.player, limbSwing, limbs, player.player.ticksExisted, 0, 0, 0.0625f); + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + RenderHelper.disableStandardItemLighting(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight); + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glPopMatrix(); + //RenderHelper.disableStandardItemLighting(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + else + { + renderFlat = true; + } + } } protected void drawTooltip(int x, int y) { - int buttons[] = {4, 5, 6, 9, 10, 11}; + final int buttons[] = {4, 5, 6, 9, 10, 11}; for(int i = 0; i < buttons.length; i++) { - GuiButtonExt button = ((GuiButtonExt) this.buttonList.get(buttons[i] - 1)); - boolean mousehover = x >= button.xPosition && y >= button.yPosition && x < button.xPosition + button.width && y < button.yPosition + button.height; - int test = button.getHoverState(mousehover); + final GuiButtonExt button = ((GuiButtonExt) buttonList.get(buttons[i] - 1)); + final boolean mousehover = x >= button.xPosition && y >= button.yPosition && x < button.xPosition + button.width && y < button.yPosition + button.height; + final int test = button.getHoverState(mousehover); if(test == 2) { - if(bigCopy != null) + if(bigCopy != null && bigCopy.getItem() instanceof ToolCore) { - ToolCore tool = (ToolCore) bigCopy.getItem(); - ToolCoreTip tt = ((Injector) TinkersDefense.tcInject).tools.get(tool.getToolName()); - List list = new ArrayList(); + final ToolCore tool = (ToolCore) bigCopy.getItem(); + final ToolCoreTip tt = ((Injector) TinkersDefense.tcInject).tools.get(tool.getToolName()); + final List list = new ArrayList(); if(tt != null) { switch(i) { case 0: - list.add(tt.getPart(1 + this.leftButtonPosX)); + list.add(tt.getPart(1 + leftButtonPosX)); break; case 1: - list.add(tt.getPart(3 + this.leftButtonPosX)); + list.add(tt.getPart(3 + leftButtonPosX)); break; case 2: - list.add(tt.getPart(2 + this.leftButtonPosX)); + list.add(tt.getPart(2 + leftButtonPosX)); break; case 3: - list.add(tt.getPartName(this.leftSelect + 1, (rightButtonPosX + ((rightButtonPosY % 3) * 16)))); + list.add(tt.getPartName(leftSelect + 1, (rightButtonPosX + ((rightButtonPosY % 3) * 16)))); break; case 4: - list.add(tt.getPartName(this.leftSelect + 1, (rightButtonPosX + 1 + ((rightButtonPosY % 3) * 16)))); + list.add(tt.getPartName(leftSelect + 1, (rightButtonPosX + 1 + ((rightButtonPosY % 3) * 16)))); break; case 5: - list.add(tt.getPartName(this.leftSelect + 1, (rightButtonPosX + 2 + ((rightButtonPosY % 3) * 16)))); + list.add(tt.getPartName(leftSelect + 1, (rightButtonPosX + 2 + ((rightButtonPosY % 3) * 16)))); break; } if(list.get(0).contains("Metallurgy")) + { list.add(" -by Shadowclaimer"); + } + func_146283_a(list, x, y); + } + else if(bigCopy.getItem() instanceof ArmorCore) + { + final NBTTagCompound aTags = bigCopy.getTagCompound().getCompoundTag("ArmorRenderer"); + final ArmorCore armor = (ArmorCore) bigCopy.getItem(); + final List boxes = armor.getRenderer().boxList; + + switch(i) + { + case 0: + case 1: + case 2: + break; + + case 3: + list.add(boxes.get(rightButtonPosX + 9).boxName); + break; + case 4: + list.add(boxes.get(rightButtonPosX + 1 + 9).boxName); + break; + case 5: + list.add(boxes.get(rightButtonPosX + 2 + 9).boxName); + break; + } func_146283_a(list, x, y); } else diff --git a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/RenderItem_FinishingAnvil.java b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/RenderItem_FinishingAnvil.java index 0515740..edbd414 100644 --- a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/RenderItem_FinishingAnvil.java +++ b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/RenderItem_FinishingAnvil.java @@ -35,7 +35,7 @@ public class RenderItem_FinishingAnvil extends RenderItem { GL11.glPushMatrix(); - GL11.glScalef(3.0f, 3.0f, 1.0f); + GL11.glScalef(3.438f, 3.43f, 1.0f); super.renderItemAndEffectIntoGUI(fontRenderer, textureManager, itemStack, x, y); GL11.glPopMatrix(); diff --git a/src/main/java/lance5057/tDefense/finishingAnvil/utilities/Injector.java b/src/main/java/lance5057/tDefense/finishingAnvil/utilities/Injector.java index a0125d9..375b2e5 100644 --- a/src/main/java/lance5057/tDefense/finishingAnvil/utilities/Injector.java +++ b/src/main/java/lance5057/tDefense/finishingAnvil/utilities/Injector.java @@ -30,7 +30,8 @@ public class Injector extends ToolCore protected void loadHeads(IIconRegister iconRegister) { - int toolLength = TConstructRegistry.tools.size(); + + final int toolLength = TConstructRegistry.tools.size(); for(int i = 0; i < toolLength; i++) { heads.clear(); @@ -38,42 +39,58 @@ public class Injector extends ToolCore handles.clear(); extras.clear(); - this.headStrings.clear(); - this.headIcons.clear(); - this.accessoryStrings.clear(); - this.accessoryIcons.clear(); - this.handleStrings.clear(); - this.handleIcons.clear(); - this.extraStrings.clear(); - this.extraIcons.clear(); + headStrings.clear(); + headIcons.clear(); + accessoryStrings.clear(); + accessoryIcons.clear(); + handleStrings.clear(); + handleIcons.clear(); + extraStrings.clear(); + extraIcons.clear(); - ToolCore tool = TConstructRegistry.tools.get(i); + final ToolCore tool = TConstructRegistry.tools.get(i); - IIcon origHead = tool.headIcons.get(-1); - IIcon origAccessory = tool.accessoryIcons.get(-1); - IIcon origHandle = tool.handleIcons.get(-1); - IIcon origExtra = tool.extraIcons.get(-1); + final IIcon origHead = tool.headIcons.get(-1); + final IIcon origAccessory = tool.accessoryIcons.get(-1); + final IIcon origHandle = tool.handleIcons.get(-1); + final IIcon origExtra = tool.extraIcons.get(-1); if(tool.getToolName().equals("Battleaxe")) + { BattleAxe(); + } if(tool.getToolName().equals("Arrow")) + { Arrow(); + } if(tool.getToolName().equals("Broadsword")) + { Broadsword(); + } if(tool.getToolName().equals("Battlesign")) + { Battlesign(); + } if(tool.getToolName().equals("Hatchet")) + { Axe(); + } if(tool.getToolName().equals("Mattock")) + { Mattock(); + } if(tool.getToolName().equals("Longbow")) + { Longbow(); + } if(tool.getToolName().equals("HeaterShield")) + { HeaterShield(); - setupIcons(tool, iconRegister, heads, this.headStrings, this.headIcons); - setupIcons(tool, iconRegister, accessories, this.accessoryStrings, this.accessoryIcons); - setupIcons(tool, iconRegister, handles, this.handleStrings, this.handleIcons); - setupIcons(tool, iconRegister, extras, this.extraStrings, this.extraIcons); + } + setupIcons(tool, iconRegister, heads, headStrings, headIcons); + setupIcons(tool, iconRegister, accessories, accessoryStrings, accessoryIcons); + setupIcons(tool, iconRegister, handles, handleStrings, handleIcons); + setupIcons(tool, iconRegister, extras, extraStrings, extraIcons); tool.headStrings.putAll(headStrings); tool.headIcons.putAll(headIcons); @@ -152,8 +169,8 @@ public class Injector extends ToolCore { for(int i = 0; i < newList.size(); i++) { - PatternBuilder pb = PatternBuilder.instance; - for(Map.Entry entry : pb.materialSets.entrySet()) + final PatternBuilder pb = PatternBuilder.instance; + for(final Map.Entry entry : pb.materialSets.entrySet()) { String icon = "tinkersdefense:"; icon += tool.getDefaultFolder() + "/" + newList.get(i); @@ -167,7 +184,7 @@ public class Injector extends ToolCore void BattleAxe() { - ToolCoreTip tt = new ToolCoreTip(); + final ToolCoreTip tt = new ToolCoreTip(); tt.accessory = "Front Head"; tt.head = "Back Head"; @@ -203,7 +220,7 @@ public class Injector extends ToolCore void Axe() { - ToolCoreTip tt = new ToolCoreTip(); + final ToolCoreTip tt = new ToolCoreTip(); tt.head = "Head"; tt.handle = "Handle"; @@ -325,7 +342,7 @@ public class Injector extends ToolCore void Broadsword() { - ToolCoreTip tt = new ToolCoreTip(); + final ToolCoreTip tt = new ToolCoreTip(); tt.head = "Blade"; tt.accessory = "Guard"; @@ -469,7 +486,7 @@ public class Injector extends ToolCore void HeaterShield() { - ToolCoreTip tt = new ToolCoreTip(); + final ToolCoreTip tt = new ToolCoreTip(); tt.head = "Plate"; tt.accessory = "Emblem"; @@ -479,7 +496,7 @@ public class Injector extends ToolCore tt.headTT.add("Standard Plate"); heads.add("_glass_plate"); tt.headTT.add("Glass Plate"); - + tt.accessoryTT.add("Standard Emblem"); accessories.add("_test_face"); tt.accessoryTT.add("Villager Emblem"); @@ -519,7 +536,7 @@ public class Injector extends ToolCore tt.handleTT.add("Squared Edge"); handles.add("_heart_edge"); tt.handleTT.add("Heart Edge"); - + tt.extraTT.add("Standard Binding"); extras.add("_spider_binding"); tt.extraTT.add("Spider Binding"); @@ -544,7 +561,7 @@ public class Injector extends ToolCore extras.add("_skull_binding"); tt.extraTT.add("Skull Binding"); extras.add("_hell_binding"); - tt.extraTT.add("Hell Binding"); + tt.extraTT.add("Hell Binding"); extras.add("_queen_binding"); tt.extraTT.add("Queen's Binding"); extras.add("_tri_binding"); -- cgit v1.2.3