Skip to content

Commit

Permalink
Update for MC/LL 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
EasyMFnE committed Apr 4, 2015
1 parent d13f64c commit f29c147
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 65 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)</center>

<center>**Latest Version:** v1.1.0 for mc1.7.10</center>
<center>**Latest Version:** v1.1.1 for mc1.8</center>

## About ##

Expand All @@ -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 ##

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions java/net/easymfne/potioncolorizer/PotionObf.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions java/net/easymfne/potioncolorizer/gui/GuiColorPicker.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion java/net/easymfne/potioncolorizer/gui/GuiConfigPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
113 changes: 61 additions & 52 deletions java/net/easymfne/potioncolorizer/gui/GuiControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}
Expand All @@ -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();
}

Expand All @@ -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();
}
Expand Down

0 comments on commit f29c147

Please sign in to comment.