From a2b0f59765a7d98eb683e30d00398e35b6a5309c Mon Sep 17 00:00:00 2001 From: WayofTime Date: Tue, 9 Dec 2014 20:34:48 -0500 Subject: [PATCH] More assets for Reagent guage --- .../api/compress/CompressionRegistry.java | 8 +- .../client/renderer/RenderHelper.java | 84 ++++++++---------- .../tileEntity/gui/GuiWritingTable.java | 8 +- .../alchemicalwizardry/gui/container.png | Bin 0 -> 260 bytes .../textures/gui/container.png | Bin 0 -> 321 bytes .../textures/gui/container1.png | Bin 0 -> 380 bytes 6 files changed, 45 insertions(+), 55 deletions(-) create mode 100644 src/main/resources/assets/alchemicalwizardry/gui/container.png create mode 100644 src/main/resources/assets/alchemicalwizardry/textures/gui/container.png create mode 100644 src/main/resources/assets/alchemicalwizardry/textures/gui/container1.png diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/compress/CompressionRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/api/compress/CompressionRegistry.java index 12c95a5a..fd17c8ba 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/compress/CompressionRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/compress/CompressionRegistry.java @@ -6,7 +6,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -52,7 +51,7 @@ public class CompressionRegistry { for(Entry entry : thresholdMap.entrySet()) { - if(SpellHelper.areItemStacksEqual(entry.getKey(), stack)) + if(areItemStacksEqual(entry.getKey(), stack)) { return entry.getValue(); } @@ -60,4 +59,9 @@ public class CompressionRegistry return 0; } + + public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack) + { + return stack.isItemEqual(compressedStack) && (stack.getTagCompound() == null ? compressedStack.getTagCompound() == null : stack.getTagCompound().equals(compressedStack.getTagCompound())); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderHelper.java b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderHelper.java index 28ca5ae6..3607fdfd 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderHelper.java +++ b/src/main/java/WayofTime/alchemicalWizardry/client/renderer/RenderHelper.java @@ -6,10 +6,7 @@ import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiChat; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -21,8 +18,8 @@ import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -import WayofTime.alchemicalWizardry.ModItems; import WayofTime.alchemicalWizardry.api.alchemy.energy.IReagentHandler; +import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; @@ -154,55 +151,44 @@ public class RenderHelper return r; } + public static void drawTexturedModalRect(int p_73729_1_, int p_73729_2_, int p_73729_3_, int p_73729_4_, double p_73729_5_, double p_73729_6_) + { + float f = 0.00390625F; + float f1 = 0.00390625F; + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + p_73729_6_), (double)zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1)); + tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + p_73729_6_), (double)zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1)); + tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + 0), (double)zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + 0) * f1)); + tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + 0), (double)zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + 0) * f1)); + tessellator.draw(); + } + private static void renderTestHUD(Minecraft mc) { - int x = 0; - int y = 0; - int l; - float f; - float f3; - float f4; - TextureManager p_77015_2_ = mc.getTextureManager(); - ItemStack p_77015_3_ = new ItemStack(ModItems.activationCrystal); + Reagent reagent = ReagentRegistry.incendiumReagent; + int xSize = 32; + int ySize = 32; - Object object = p_77015_3_.getIconIndex(); + int x = (10 - xSize) / 2 * 8; + int y = (150 - ySize) / 2 * 8; + + ResourceLocation test2 = new ResourceLocation("alchemicalwizardry", "textures/gui/container1.png"); + GL11.glColor4f(reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), 0.5F); + mc.getTextureManager().bindTexture(test2); + + GL11.glScalef(1f/8f, 1f/8f, 1f/8f); + + drawTexturedModalRect(x, y, 0, 0, 256, 256); + + ResourceLocation test = new ResourceLocation("alchemicalwizardry", "textures/gui/container.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.getTextureManager().bindTexture(test); + - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(770, 771, 1, 0); - ResourceLocation resourcelocation = p_77015_2_.getResourceLocation(p_77015_3_.getItemSpriteNumber()); - p_77015_2_.bindTexture(resourcelocation); - - if (object == null) - { - object = ((TextureMap)Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation)).getAtlasSprite("missingno"); - } - - l = p_77015_3_.getItem().getColorFromItemStack(p_77015_3_, 0); - f3 = (float)(l >> 16 & 255) / 255.0F; - f4 = (float)(l >> 8 & 255) / 255.0F; - f = (float)(l & 255) / 255.0F; - -// if (this.renderWithColor) -// { -// GL11.glColor4f(f3, f4, f, 1.0F); -// } - - GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure that render states are reset, a renderEffect can derp them up. - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_BLEND); - - renderIcon(x, y, (IIcon)object, 16, 16); - - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glDisable(GL11.GL_BLEND); - -// if (renderEffect && p_77015_3_.hasEffect(0)) -// { -// renderEffect(p_77015_2_, x, y); -// } - GL11.glEnable(GL11.GL_LIGHTING); + drawTexturedModalRect(x, y, 0, 0, 256, 256); + + } public static void renderIcon(int p_94149_1_, int p_94149_2_, IIcon p_94149_3_, int p_94149_4_, int p_94149_5_) diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiWritingTable.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiWritingTable.java index c6d9d572..a0c1baba 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiWritingTable.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/gui/GuiWritingTable.java @@ -1,14 +1,15 @@ package WayofTime.alchemicalWizardry.common.tileEntity.gui; -import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable; -import WayofTime.alchemicalWizardry.common.tileEntity.container.ContainerWritingTable; -import net.minecraft.client.gui.inventory.GuiBrewingStand; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; + import org.lwjgl.opengl.GL11; +import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable; +import WayofTime.alchemicalWizardry.common.tileEntity.container.ContainerWritingTable; + public class GuiWritingTable extends GuiContainer { public GuiWritingTable(InventoryPlayer inventoryPlayer, TEWritingTable tileEntity) @@ -38,6 +39,5 @@ public class GuiWritingTable extends GuiContainer int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - GuiBrewingStand d; } } \ No newline at end of file diff --git a/src/main/resources/assets/alchemicalwizardry/gui/container.png b/src/main/resources/assets/alchemicalwizardry/gui/container.png new file mode 100644 index 0000000000000000000000000000000000000000..140dd8e0322f89628a6ea543e3d6aeaff7d59b11 GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPq4;O=?b+M&dEKo=`GbEzKIX^cyHLnE7WngeFN=+<>&kwQhl|0COFd=LN1%{wW=KSdbAE1aYF-JD%fR4Vl$uzQ znxasiS(2gP?&%wlqL<1J6kqD;;usQf_-%L~SAzo2-9?*AR_9H!Ul&|9^LoDv%hc>H zQE3jVDY@@|9x-Id%9J(T7FV4h_d{q?CS$ns1HFoO^TGoc_%?KQ7#_>5dvw~I;gw+W zk;2+9Px*{lm6%Gew!UX*7r3>DS&7NJAebrag}1_iYp;Ac-!!Y6+=_7uZ(MyK^nq4^ z=nk$mAsdz%pZZ&rUDfPgciQ_+rJLiThkSLbW*vCH>#-=4*m@pThllkbpLn|ZxvX<>&kwQhl^2OSt01WBTz^-GbEzKIX^cyHLnE7WngeFN=+f1QDE_jxX!L*ck9CknwDJYanm}kS$eqS*y*3Ar|w^UVE2>x>olDl({-$p zC!S?I`6O|zD@UUu%P|ShNsle+O2bM8|EV*)w`H^m+)>HOa6+nO)gmcYh9lMI|7I*; z`F>Pu!?iW&(+N+)ozn^WfYOwA}+I6(z SyH*}35IkM|T-G@yGywqbeUxJW literal 0 HcmV?d00001