From 420faddca46e70e3a70def168fb4e452ef193b0d Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Sat, 21 Feb 2015 21:31:16 +0000 Subject: Added just a butt ton of stuff, also thanks to pau101 for helping me with the Hand Pedestal animation :) --- .../jewelrycraft/client/ClientProxy.java | 39 ++++-- java/darkknight/jewelrycraft/client/GuiGuide.java | 143 +++++++++++---------- .../darkknight/jewelrycraft/client/GuiJewelry.java | 41 ++++-- .../jewelrycraft/client/GuiRingChest.java | 27 ++-- 4 files changed, 152 insertions(+), 98 deletions(-) (limited to 'java/darkknight/jewelrycraft/client') diff --git a/java/darkknight/jewelrycraft/client/ClientProxy.java b/java/darkknight/jewelrycraft/client/ClientProxy.java index 8593b58..8f95d9e 100644 --- a/java/darkknight/jewelrycraft/client/ClientProxy.java +++ b/java/darkknight/jewelrycraft/client/ClientProxy.java @@ -4,24 +4,22 @@ import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.MinecraftForgeClient; import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.registry.VillagerRegistry; import darkknight.jewelrycraft.CommonProxy; import darkknight.jewelrycraft.block.BlockList; +import darkknight.jewelrycraft.entities.EntityHalfHeart; +import darkknight.jewelrycraft.entities.EntityHeart; +import darkknight.jewelrycraft.entities.renders.HeartRender; import darkknight.jewelrycraft.model.ModelDisplayer; +import darkknight.jewelrycraft.model.ModelHalfHeart; import darkknight.jewelrycraft.model.ModelHandPedestal; +import darkknight.jewelrycraft.model.ModelHeart; import darkknight.jewelrycraft.model.ModelJewlersCraftingBench; import darkknight.jewelrycraft.model.ModelMolder; import darkknight.jewelrycraft.model.ModelShadowEye; import darkknight.jewelrycraft.model.ModelShadowHand; import darkknight.jewelrycraft.model.ModelSmelter; -import darkknight.jewelrycraft.renders.ItemRender; -import darkknight.jewelrycraft.renders.TileEntityDisplayerRender; -import darkknight.jewelrycraft.renders.TileEntityHandPedestalRender; -import darkknight.jewelrycraft.renders.TileEntityJewelrsCraftingTableRender; -import darkknight.jewelrycraft.renders.TileEntityMolderRender; -import darkknight.jewelrycraft.renders.TileEntityShadowEyeRender; -import darkknight.jewelrycraft.renders.TileEntityShadowHandRender; -import darkknight.jewelrycraft.renders.TileEntitySmelterRender; import darkknight.jewelrycraft.tileentity.TileEntityDisplayer; import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal; import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable; @@ -29,28 +27,43 @@ import darkknight.jewelrycraft.tileentity.TileEntityMolder; import darkknight.jewelrycraft.tileentity.TileEntityShadowEye; import darkknight.jewelrycraft.tileentity.TileEntityShadowHand; import darkknight.jewelrycraft.tileentity.TileEntitySmelter; +import darkknight.jewelrycraft.tileentity.renders.ItemRender; +import darkknight.jewelrycraft.tileentity.renders.TileEntityDisplayerRender; +import darkknight.jewelrycraft.tileentity.renders.TileEntityHandPedestalRender; +import darkknight.jewelrycraft.tileentity.renders.TileEntityJewelrsCraftingTableRender; +import darkknight.jewelrycraft.tileentity.renders.TileEntityMolderRender; +import darkknight.jewelrycraft.tileentity.renders.TileEntityShadowEyeRender; +import darkknight.jewelrycraft.tileentity.renders.TileEntityShadowHandRender; +import darkknight.jewelrycraft.tileentity.renders.TileEntitySmelterRender; public class ClientProxy extends CommonProxy { @Override public void registerRenderers() { + ResourceLocation pedestalResourceLocation = new ResourceLocation("jewelrycraft", "textures/tileentities/BricksPedestal.png"); + TileEntityHandPedestalRender pedestalRender = new TileEntityHandPedestalRender(new ModelHandPedestal(pedestalResourceLocation), pedestalResourceLocation); + ResourceLocation shadowResourceLocation = new ResourceLocation("jewelrycraft", "textures/tileentities/ShadowHand.png"); + TileEntityShadowHandRender shadowHandRender = new TileEntityShadowHandRender(new ModelShadowHand(shadowResourceLocation), shadowResourceLocation); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmelter.class, new TileEntitySmelterRender()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMolder.class, new TileEntityMolderRender()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityJewelrsCraftingTable.class, new TileEntityJewelrsCraftingTableRender()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDisplayer.class, new TileEntityDisplayerRender()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityShadowEye.class, new TileEntityShadowEyeRender()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHandPedestal.class, new TileEntityHandPedestalRender()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityShadowHand.class, new TileEntityShadowHandRender()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHandPedestal.class, pedestalRender); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityShadowHand.class, shadowHandRender); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.displayer), new ItemRender(new TileEntityDisplayerRender(), new TileEntityDisplayer(), new ModelDisplayer())); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.jewelCraftingTable), new ItemRender(new TileEntityJewelrsCraftingTableRender(), new TileEntityJewelrsCraftingTable(), new ModelJewlersCraftingBench())); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.smelter), new ItemRender(new TileEntitySmelterRender(), new TileEntitySmelter(), new ModelSmelter())); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.molder), new ItemRender(new TileEntityMolderRender(), new TileEntityMolder(), new ModelMolder())); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.shadowEye), new ItemRender(new TileEntityShadowEyeRender(), new TileEntityShadowEye(), new ModelShadowEye())); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.handPedestal), new ItemRender(new TileEntityHandPedestalRender(), new TileEntityHandPedestal(), new ModelHandPedestal())); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.shadowHand), new ItemRender(new TileEntityShadowHandRender(), new TileEntityShadowHand(), new ModelShadowHand())); - + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.handPedestal), new ItemRender(pedestalRender, new TileEntityHandPedestal(), new ModelHandPedestal(pedestalResourceLocation))); + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.shadowHand), new ItemRender(shadowHandRender, new TileEntityShadowHand(), new ModelShadowHand(shadowResourceLocation))); VillagerRegistry.instance().registerVillagerSkin(3000, new ResourceLocation("jewelrycraft", "textures/entities/jeweler.png")); + + RenderingRegistry.registerEntityRenderingHandler(EntityHeart.class, new HeartRender(new ModelHeart(), 0.25F)); + RenderingRegistry.registerEntityRenderingHandler(EntityHalfHeart.class, new HeartRender(new ModelHalfHeart(), 0.25F)); } } diff --git a/java/darkknight/jewelrycraft/client/GuiGuide.java b/java/darkknight/jewelrycraft/client/GuiGuide.java index 879c9b3..503e681 100644 --- a/java/darkknight/jewelrycraft/client/GuiGuide.java +++ b/java/darkknight/jewelrycraft/client/GuiGuide.java @@ -2,7 +2,6 @@ package darkknight.jewelrycraft.client; import java.util.ArrayList; import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; @@ -12,9 +11,7 @@ import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; - import org.lwjgl.opengl.GL11; - import darkknight.jewelrycraft.block.BlockList; import darkknight.jewelrycraft.container.GuiRectangle; import darkknight.jewelrycraft.container.GuiTab; @@ -30,21 +27,32 @@ public class GuiGuide extends GuiContainer World world; private final GuiTab[] tabs; private GuiTab activeTab; + ResourceLocation pageTexture, flippedPageTexture; - public GuiGuide(Container container, World world) + /** + * @param container + * @param world + * @param pageTex + * @param flipPageTex + */ + public GuiGuide(Container container, World world, ResourceLocation pageTex, ResourceLocation flipPageTex) { super(container); page = 1; rot = 0; del = 0; this.world = world; - - tabs = new GuiTab[] - { new GuiTabBlocks(0), new GuiTabItems(1), new GuiTabGemsAndIngots(2), new GuiTabModifiers(3)}; - + tabs = new GuiTab[]{new GuiTabBlocks(0), new GuiTabItems(1), new GuiTabGemsAndIngots(2), new GuiTabModifiers(3)}; activeTab = tabs[0]; + pageTexture = pageTex; + flippedPageTexture = flipPageTex; } + /** + * @param f + * @param i + * @param j + */ @Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { @@ -53,115 +61,94 @@ public class GuiGuide extends GuiContainer if (del == 0) rot++; del++; if (del >= 2) del = 0; - Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePage.png")); + Minecraft.getMinecraft().getTextureManager().bindTexture(pageTexture); drawTexturedModalRect(guiLeft + 147 / 2 + 20, guiTop - 10, 0, 0, 145, 180); - Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip.png")); + Minecraft.getMinecraft().getTextureManager().bindTexture(flippedPageTexture); drawTexturedModalRect(guiLeft - 147 / 2 + 21, guiTop - 10, 0, 0, 145, 180); - - for (GuiRectangle tab : tabs) - { + for(GuiRectangle tab: tabs){ int srcX = 24; int sizeX = 19; - - if (tab == activeTab) - { + if (tab == activeTab){ srcX += 38; sizeX += 3; - } - else if (tab.inRect(this, i, j)) - { - srcX += 19; - } - + }else if (tab.inRect(this, i, j)) srcX += 19; tab.draw(this, srcX, 180, sizeX, 18); } - - if (i >= guiLeft + 195 + 20 && i <= guiLeft + 195 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page + 2 <= activeTab.getMaxPages()) - { + if (i >= guiLeft + 195 + 20 && i <= guiLeft + 195 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page + 2 <= activeTab.getMaxPages()){ drawTexturedModalRect(guiLeft + 195 + 20, guiTop + 127 + 20, 0, 180, 11, 14); nextHover = true; } - - if (i >= guiLeft + 20 - 61 && i <= guiLeft - 61 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page - 2 > 0) - { + if (i >= guiLeft + 20 - 61 && i <= guiLeft - 61 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page - 2 > 0){ drawTexturedModalRect(guiLeft - 61 + 20, guiTop + 127 + 20, 11, 180, 11, 14); prevHover = true; } - activeTab.drawBackground(this, i, j, page); activeTab.drawBackground(this, i, j, page + 1); - ArrayList text = new ArrayList(); text.add(Integer.toString(page)); - this.drawHoveringText(text, guiLeft - 10 + 20 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj); + drawHoveringText(text, guiLeft - 10 + 20 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj); text.remove(Integer.toString(page)); text.add(Integer.toString(page + 1)); - this.drawHoveringText(text, guiLeft - 10 + 20 + 147 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj); - - for (int tab = 0; tab < tabs.length; tab++) + drawHoveringText(text, guiLeft - 10 + 20 + 147 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj); + for(int tab = 0; tab < tabs.length; tab++) renderItem(tabs[tab].getIcon(), guiLeft - 52, guiTop + 26 + tab * 19, activeTab.getIcon()); - } + /** + * @param x + * @param y + */ + @Override protected void drawGuiContainerForegroundLayer(int x, int y) { activeTab.drawForeground(this, x, y, page); activeTab.drawForeground(this, x, y, page + 1); - - for (GuiTab tab : tabs) - { + for(GuiTab tab: tabs) tab.drawString(this, x, y, tab.getName()); - } } + /** + * @param x + * @param y + * @param button + */ @Override protected void mouseClicked(int x, int y, int button) { if (nextHover && page + 2 <= activeTab.getMaxPages()) page += 2; else if (prevHover && page > 1) page -= 2; - activeTab.mouseClick(this, x, y, button); - - for (GuiTab tab : tabs) - { - if (activeTab != tab) - { - if (tab.inRect(this, x, y)) - { - activeTab = tab; - page = 1; - break; - } + for(GuiTab tab: tabs) + if (activeTab != tab) if (tab.inRect(this, x, y)){ + activeTab = tab; + page = 1; + break; } - } } + /** + * @param item + * @param x + * @param y + * @param activeIcon + */ public void renderItem(ItemStack item, float x, float y, ItemStack activeIcon) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, item); entityitem.hoverStart = 0.0F; - if (item.isItemEqual(new ItemStack(BlockList.jewelAltar))) - { - y -= 4; - } + if (item.isItemEqual(new ItemStack(BlockList.jewelAltar))) y -= 4; GL11.glTranslatef(x, y, 100); - float scale = 30F; GL11.glScalef(-scale, scale, scale); - if (activeIcon != null && item.isItemEqual(activeIcon)) GL11.glRotatef(rot, 0, 1, 0); - if (item.isItemEqual(new ItemStack(BlockList.jewelAltar))) - { + if (item.isItemEqual(new ItemStack(BlockList.jewelAltar))){ GL11.glRotatef(160.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - } - else GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - + }else GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - else - { + else{ GL11.glRotatef(180F, 0F, 1F, 0F); RenderManager.instance.options.fancyGraphics = true; RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); @@ -169,9 +156,14 @@ public class GuiGuide extends GuiContainer } GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); - } + /** + * @param item + * @param x + * @param y + * @param scale + */ public void renderItem(ItemStack item, float x, float y, float scale) { GL11.glPushMatrix(); @@ -183,8 +175,7 @@ public class GuiGuide extends GuiContainer GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F); if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - else - { + else{ RenderManager.instance.options.fancyGraphics = true; RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); RenderManager.instance.options.fancyGraphics = false; @@ -192,22 +183,36 @@ public class GuiGuide extends GuiContainer GL11.glPopMatrix(); } + /** + * @return + */ public int getLeft() { return guiLeft; } + /** + * @return + */ public int getTop() { return guiTop; } + /** + * @return + */ public FontRenderer getFont() { return fontRendererObj; } - @SuppressWarnings("rawtypes") + /** + * @param lst + * @param x + * @param y + */ + @SuppressWarnings ("rawtypes") public void drawHoverString(List lst, int x, int y) { drawHoveringText(lst, x, y, fontRendererObj); diff --git a/java/darkknight/jewelrycraft/client/GuiJewelry.java b/java/darkknight/jewelrycraft/client/GuiJewelry.java index bbc6236..1d31770 100644 --- a/java/darkknight/jewelrycraft/client/GuiJewelry.java +++ b/java/darkknight/jewelrycraft/client/GuiJewelry.java @@ -1,32 +1,57 @@ package darkknight.jewelrycraft.client; -import org.lwjgl.opengl.GL11; - -import darkknight.jewelrycraft.container.ContainerJewelryTab; -import darkknight.jewelrycraft.container.ContainerRingChest; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import darkknight.jewelrycraft.container.ContainerJewelryTab; +import darkknight.jewelrycraft.events.KeyBindings; public class GuiJewelry extends GuiContainer -{ - public GuiJewelry(ContainerJewelryTab containerJewelryTab) +{ + ResourceLocation texture; + + /** + * @param containerJewelryTab + * @param texture + */ + public GuiJewelry(ContainerJewelryTab containerJewelryTab, ResourceLocation texture) { super(containerJewelryTab); xSize = 194; ySize = 166; + this.texture = texture; } + /** + * @param f + * @param mouseX + * @param mouseY + */ @Override public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { - GL11.glColor3f(1, 1, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/jewelry_tab.png")); + GL11.glColor3f(1, 1, 1); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); } + /** + * @param mouseX + * @param mouseY + */ @Override public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + {} + + /** + * @param charecter + * @param key + */ + @Override + protected void keyTyped(char charecter, int key) { + super.keyTyped(charecter, key); + if (key == KeyBindings.inventory.getKeyCode()) mc.thePlayer.closeScreen(); } } diff --git a/java/darkknight/jewelrycraft/client/GuiRingChest.java b/java/darkknight/jewelrycraft/client/GuiRingChest.java index f711558..2504d6f 100644 --- a/java/darkknight/jewelrycraft/client/GuiRingChest.java +++ b/java/darkknight/jewelrycraft/client/GuiRingChest.java @@ -1,35 +1,46 @@ package darkknight.jewelrycraft.client; -import org.lwjgl.opengl.GL11; - -import darkknight.jewelrycraft.container.ContainerRingChest; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import darkknight.jewelrycraft.container.ContainerRingChest; public class GuiRingChest extends GuiContainer { public ContainerRingChest container; + ResourceLocation texture; - public GuiRingChest(ContainerRingChest container) + /** + * @param container + * @param texture + */ + public GuiRingChest(ContainerRingChest container, ResourceLocation texture) { super(container); this.container = container; xSize = 176; ySize = 166; + this.texture = texture; } + /** + * @param f + * @param mouseX + * @param mouseY + */ @Override public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { GL11.glColor3f(1, 1, 1); - - Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/chest_ring.png")); - + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); } + /** + * @param mouseX + * @param mouseY + */ @Override public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { -- cgit v1.2.3