From f29c147f15246898289078c4cad2804aab292a1c Mon Sep 17 00:00:00 2001 From: EasyMFnE Date: Sat, 4 Apr 2015 18:41:00 -0400 Subject: [PATCH] Update for MC/LL 1.8 --- CHANGES | 3 + README.md | 4 +- .../LiteModPotionColorizer.java | 5 +- .../easymfne/potioncolorizer/PotionObf.java | 6 +- .../potioncolorizer/gui/GuiColorPicker.java | 6 +- .../potioncolorizer/gui/GuiConfigPanel.java | 2 +- .../potioncolorizer/gui/GuiControl.java | 113 ++++++++++-------- 7 files changed, 74 insertions(+), 65 deletions(-) diff --git a/CHANGES b/CHANGES index 74393aa..2ac699e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +[2015-04-04] v1.1.1 + - Updated for MC/LL 1.8. + [2014-10-16] v1.1.0 - Updated GUI functionality for picking custom colors based on work by Mumfrey. - Fix for recognizing additional potion types added by external mods. diff --git a/README.md b/README.md index c8ef6ef..29b47b9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [Bug Report](https://github.com/EasyMFnE/PotionColorizer/issues) | [Donate](https://www.paypal.com/cgi-bin/webscr?hosted_button_id=457RX2KYUDY5G&item_name=PotionColorizer&cmd=_s-xclick) -
**Latest Version:** v1.1.0 for mc1.7.10
+
**Latest Version:** v1.1.1 for mc1.8
## About ## @@ -21,7 +21,7 @@ This project contains the following functionality: ## Installation ## 1. Install proper version of LiteLoader. -2. Download and move this mode to the proper versioned mods folder. (e.g. `.minecraft/mods/1.7.10/`) +2. Download and move this mode to the proper versioned mods folder. (e.g. `.minecraft/mods/1.8/`) ## Configuration ## diff --git a/java/net/easymfne/potioncolorizer/LiteModPotionColorizer.java b/java/net/easymfne/potioncolorizer/LiteModPotionColorizer.java index e138bf5..b51859c 100644 --- a/java/net/easymfne/potioncolorizer/LiteModPotionColorizer.java +++ b/java/net/easymfne/potioncolorizer/LiteModPotionColorizer.java @@ -51,9 +51,7 @@ public class LiteModPotionColorizer implements LiteMod, InitCompleteListener, Co /** Name/Version information. */ public static final String MOD_NAME = "PotionColorizer"; - public static final String MOD_VERSION = "1.1.0"; - - private static final int JUMP_BOOST_COLOR_1_8 = 2293580; // TODO: Remove in 1.8 release. + public static final String MOD_VERSION = "1.1.1"; /** Modification instance. */ public static LiteModPotionColorizer instance; @@ -152,7 +150,6 @@ public void onInitCompleted(Minecraft minecraft, LiteLoader loader) { defaultColors.put(potion.getName(), Integer.valueOf(potion.getLiquidColor())); } } - defaultColors.put(Potion.jump.getName(), JUMP_BOOST_COLOR_1_8); LiteLoaderLogger.info("Saved %d default potion liquid colors.", defaultColors.size()); try { setPotionColors(); diff --git a/java/net/easymfne/potioncolorizer/PotionObf.java b/java/net/easymfne/potioncolorizer/PotionObf.java index a9e559e..5ef4e96 100644 --- a/java/net/easymfne/potioncolorizer/PotionObf.java +++ b/java/net/easymfne/potioncolorizer/PotionObf.java @@ -23,17 +23,17 @@ public class PotionObf extends Obf { /** net.minecraft.item.ItemPotion class. */ - public static PotionObf itemPotion = new PotionObf("net.minecraft.item.ItemPotion", "adp"); + public static PotionObf itemPotion = new PotionObf("net.minecraft.item.ItemPotion", "amw"); /** getColorFromItemStack(ItemStack, int) method from ItemPotion. */ public static PotionObf itemPotion_getColorFromItemStack = new PotionObf("func_82790_a", "a", "getColorFromItemStack"); /** hasEffect(ItemStack) method from ItemPotion. */ - public static PotionObf itemPotion_hasEffect = new PotionObf("func_77636_d", "e", "hasEffect"); + public static PotionObf itemPotion_hasEffect = new PotionObf("func_77636_d", "f", "hasEffect"); /** liquidColor field in net.minecraft.potion.Potion class. */ - public static PotionObf potion_liquidColor = new PotionObf("field_76414_N", "K", "liquidColor"); + public static PotionObf potion_liquidColor = new PotionObf("field_76414_N", "L", "liquidColor"); /** * Create a new obfuscation mapping. diff --git a/java/net/easymfne/potioncolorizer/gui/GuiColorPicker.java b/java/net/easymfne/potioncolorizer/gui/GuiColorPicker.java index 5805f91..9ef1bb2 100644 --- a/java/net/easymfne/potioncolorizer/gui/GuiColorPicker.java +++ b/java/net/easymfne/potioncolorizer/gui/GuiColorPicker.java @@ -71,11 +71,11 @@ public GuiColorPicker(Minecraft minecraft, int controlId, int xPos, int yPos, in this.fontRenderer = minecraft.fontRendererObj; this.txtRed = - new GuiTextField(this.fontRenderer, this.xPosition + 163, this.yPosition + 10, 32, 16); + new GuiTextField(0, this.fontRenderer, this.xPosition + 163, this.yPosition + 10, 32, 16); this.txtGreen = - new GuiTextField(this.fontRenderer, this.xPosition + 163, this.yPosition + 30, 32, 16); + new GuiTextField(0, this.fontRenderer, this.xPosition + 163, this.yPosition + 30, 32, 16); this.txtBlue = - new GuiTextField(this.fontRenderer, this.xPosition + 163, this.yPosition + 50, 32, 16); + new GuiTextField(0, this.fontRenderer, this.xPosition + 163, this.yPosition + 50, 32, 16); this.txtRed.setMaxStringLength(3); this.txtGreen.setMaxStringLength(3); diff --git a/java/net/easymfne/potioncolorizer/gui/GuiConfigPanel.java b/java/net/easymfne/potioncolorizer/gui/GuiConfigPanel.java index 58340f5..82f7838 100644 --- a/java/net/easymfne/potioncolorizer/gui/GuiConfigPanel.java +++ b/java/net/easymfne/potioncolorizer/gui/GuiConfigPanel.java @@ -210,7 +210,7 @@ public void mousePressed(ConfigPanelHost host, int mouseX, int mouseY, int mouse @Override public void mouseReleased(ConfigPanelHost host, int mouseX, int mouseY, int mouseButton) { if (activeButton != null) { - activeButton.func_146111_b(mouseX, mouseY); + activeButton.mouseReleased(mouseX, mouseY); if (activeButton instanceof GuiControl) { ((GuiControl) activeButton).mouseReleased(mouseX, mouseY); } diff --git a/java/net/easymfne/potioncolorizer/gui/GuiControl.java b/java/net/easymfne/potioncolorizer/gui/GuiControl.java index a93f042..b342e11 100644 --- a/java/net/easymfne/potioncolorizer/gui/GuiControl.java +++ b/java/net/easymfne/potioncolorizer/gui/GuiControl.java @@ -36,6 +36,7 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; /** * GuiControlEx is the base class for additional controls. It includes some advanced drawing methods @@ -196,10 +197,11 @@ public static void drawNativeLine(float x1, float y1, float x2, float y2, float glColor4f(f1, f2, f3, f); glLineWidth(width); - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawing(GL_LINES); - tessellator.addVertex(x1, y1, 0); - tessellator.addVertex(x2, y2, 0); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer renderer = tessellator.getWorldRenderer(); + renderer.startDrawing(GL_LINES); + renderer.addVertex(x1, y1, 0); + renderer.addVertex(x2, y2, 0); tessellator.draw(); glEnable(GL_TEXTURE_2D); @@ -264,20 +266,21 @@ public static void drawArrow(int x1, int y1, int x2, int y2, int z, int width, i glColor4f(f1, f2, f3, f); // Draw the line - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertex(x1, y2, z); - tessellator.addVertex(x2, y2, z); - tessellator.addVertex(x2, y1, z); - tessellator.addVertex(x1, y1, z); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer renderer = tessellator.getWorldRenderer(); + renderer.startDrawingQuads(); + renderer.addVertex(x1, y2, z); + renderer.addVertex(x2, y2, z); + renderer.addVertex(x2, y1, z); + renderer.addVertex(x1, y1, z); tessellator.draw(); // If an arrow then draw the arrow head if (arrowHead && arrowHeadSize > 0) { - tessellator.startDrawing(4); - tessellator.addVertex(x2, 0 - arrowHeadSize / 2, z); - tessellator.addVertex(x2, arrowHeadSize / 2, z); - tessellator.addVertex(length, 0, z); + renderer.startDrawing(4); + renderer.addVertex(x2, 0 - arrowHeadSize / 2, z); + renderer.addVertex(x2, arrowHeadSize / 2, z); + renderer.addVertex(length, 0, z); tessellator.draw(); } @@ -311,15 +314,16 @@ public void setTexMapSize(int textureSize) { */ @SuppressWarnings("cast") public void drawTexturedModalRectRot(int x, int y, int x2, int y2, int u, int v, int u2, int v2) { - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x2, y2, this.zLevel, (float) (u) * texMapScale, (float) (v2) + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer renderer = tessellator.getWorldRenderer(); + renderer.startDrawingQuads(); + renderer.addVertexWithUV(x2, y2, this.zLevel, (float) (u) * texMapScale, (float) (v2) * texMapScale); - tessellator.addVertexWithUV(x2, y, this.zLevel, (float) (u2) * texMapScale, (float) (v2) + renderer.addVertexWithUV(x2, y, this.zLevel, (float) (u2) * texMapScale, (float) (v2) * texMapScale); - tessellator.addVertexWithUV(x, y, this.zLevel, (float) (u2) * texMapScale, (float) (v) + renderer.addVertexWithUV(x, y, this.zLevel, (float) (u2) * texMapScale, (float) (v) * texMapScale); - tessellator.addVertexWithUV(x, y2, this.zLevel, (float) (u) * texMapScale, (float) (v) + renderer.addVertexWithUV(x, y2, this.zLevel, (float) (u) * texMapScale, (float) (v) * texMapScale); tessellator.draw(); } @@ -336,15 +340,16 @@ public void drawTexturedModalRectRot(int x, int y, int x2, int y2, int u, int v, */ @SuppressWarnings("cast") public void drawTexturedModalRectRot(int x, int y, int u, int v, int width, int height) { - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x + height, y + width, this.zLevel, (float) (u) * texMapScale, + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer renderer = tessellator.getWorldRenderer(); + renderer.startDrawingQuads(); + renderer.addVertexWithUV(x + height, y + width, this.zLevel, (float) (u) * texMapScale, (float) (v + height) * texMapScale); - tessellator.addVertexWithUV(x + height, y, this.zLevel, (float) (u + width) * texMapScale, + renderer.addVertexWithUV(x + height, y, this.zLevel, (float) (u + width) * texMapScale, (float) (v + height) * texMapScale); - tessellator.addVertexWithUV(x, y, this.zLevel, (float) (u + width) * texMapScale, (float) (v) + renderer.addVertexWithUV(x, y, this.zLevel, (float) (u + width) * texMapScale, (float) (v) * texMapScale); - tessellator.addVertexWithUV(x, y + width, this.zLevel, (float) (u) * texMapScale, (float) (v) + renderer.addVertexWithUV(x, y + width, this.zLevel, (float) (u) * texMapScale, (float) (v) * texMapScale); tessellator.draw(); } @@ -494,16 +499,17 @@ protected void drawCrossHair(int x, int y, int size, int width, int color) { glLogicOp(GL_OR_REVERSE); // Draw the frame - Tessellator tessellator = Tessellator.instance; - - tessellator.startDrawing(GL_LINES); - tessellator.addVertex(x - size, y, 0); - tessellator.addVertex(x + size, y, 0); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer renderer = tessellator.getWorldRenderer(); + + renderer.startDrawing(GL_LINES); + renderer.addVertex(x - size, y, 0); + renderer.addVertex(x + size, y, 0); tessellator.draw(); - tessellator.startDrawing(GL_LINES); - tessellator.addVertex(x, y - size, 0); - tessellator.addVertex(x, y + size, 0); + renderer.startDrawing(GL_LINES); + renderer.addVertex(x, y - size, 0); + renderer.addVertex(x, y + size, 0); tessellator.draw(); glDisable(GL_COLOR_LOGIC_OP); @@ -570,15 +576,16 @@ protected void drawTooltip(FontRenderer fontRenderer, String tooltipText, int mo */ @SuppressWarnings("cast") public void drawTexturedModalRect(int x, int y, int x2, int y2, int u, int v, int u2, int v2) { - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x, y2, this.zLevel, (float) (u) * texMapScale, (float) (v2) + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer renderer = tessellator.getWorldRenderer(); + renderer.startDrawingQuads(); + renderer.addVertexWithUV(x, y2, this.zLevel, (float) (u) * texMapScale, (float) (v2) * texMapScale); - tessellator.addVertexWithUV(x2, y2, this.zLevel, (float) (u2) * texMapScale, (float) (v2) + renderer.addVertexWithUV(x2, y2, this.zLevel, (float) (u2) * texMapScale, (float) (v2) * texMapScale); - tessellator.addVertexWithUV(x2, y, this.zLevel, (float) (u2) * texMapScale, (float) (v) + renderer.addVertexWithUV(x2, y, this.zLevel, (float) (u2) * texMapScale, (float) (v) * texMapScale); - tessellator.addVertexWithUV(x, y, this.zLevel, (float) (u) * texMapScale, (float) (v) + renderer.addVertexWithUV(x, y, this.zLevel, (float) (u) * texMapScale, (float) (v) * texMapScale); tessellator.draw(); } @@ -597,12 +604,13 @@ public void drawTexturedModalRect(int x, int y, int x2, int y2, int u, int v, in */ public void drawTexturedModalRectF(int x, int y, int x2, int y2, float u, float v, float u2, float v2) { - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x, y2, this.zLevel, u, v2); - tessellator.addVertexWithUV(x2, y2, this.zLevel, u2, v2); - tessellator.addVertexWithUV(x2, y, this.zLevel, u2, v); - tessellator.addVertexWithUV(x, y, this.zLevel, u, v); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer renderer = tessellator.getWorldRenderer(); + renderer.startDrawingQuads(); + renderer.addVertexWithUV(x, y2, this.zLevel, u, v2); + renderer.addVertexWithUV(x2, y2, this.zLevel, u2, v2); + renderer.addVertexWithUV(x2, y, this.zLevel, u2, v); + renderer.addVertexWithUV(x, y, this.zLevel, u, v); tessellator.draw(); } @@ -620,15 +628,16 @@ public void drawTexturedModalRectF(int x, int y, int x2, int y2, float u, float @SuppressWarnings("cast") public void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float texMapScale) { - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x + 0, y + height, this.zLevel, (float) (u + 0) * texMapScale, + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer renderer = tessellator.getWorldRenderer(); + renderer.startDrawingQuads(); + renderer.addVertexWithUV(x + 0, y + height, this.zLevel, (float) (u + 0) * texMapScale, (float) (v + height) * texMapScale); - tessellator.addVertexWithUV(x + width, y + height, this.zLevel, (float) (u + width) + renderer.addVertexWithUV(x + width, y + height, this.zLevel, (float) (u + width) * texMapScale, (float) (v + height) * texMapScale); - tessellator.addVertexWithUV(x + width, y + 0, this.zLevel, (float) (u + width) * texMapScale, + renderer.addVertexWithUV(x + width, y + 0, this.zLevel, (float) (u + width) * texMapScale, (float) (v + 0) * texMapScale); - tessellator.addVertexWithUV(x + 0, y + 0, this.zLevel, (float) (u + 0) * texMapScale, + renderer.addVertexWithUV(x + 0, y + 0, this.zLevel, (float) (u + 0) * texMapScale, (float) (v + 0) * texMapScale); tessellator.draw(); }