diff --git a/.gitignore b/.gitignore
index 0b5b171..af197b8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,6 @@
/.classpath
/lib
/.project
+/res/CHANGES
+/res/README.md
/.settings
diff --git a/CHANGES b/CHANGES
index b5146c2..4cfe7a7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+[2014-10-02] v1.0.1
+ - Fix for compatibility with Forge and deobfuscated clients.
+
[2014-09-30] v1.0.0
- Configuration panel now allows customization of potion colors.
diff --git a/README.md b/README.md
index 475b290..e21d3a5 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.0.0 for mc1.7.10
+**Latest Version:** v1.0.1 for mc1.7.10
## About ##
diff --git a/java/net/easymfne/potioncolorizer/GuiHexColorField.java b/java/net/easymfne/potioncolorizer/GuiHexColorField.java
index 19cfc41..d8039b5 100644
--- a/java/net/easymfne/potioncolorizer/GuiHexColorField.java
+++ b/java/net/easymfne/potioncolorizer/GuiHexColorField.java
@@ -6,9 +6,9 @@
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
- * PotionColorizer is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * PotionColorizer is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
diff --git a/java/net/easymfne/potioncolorizer/LiteModPotionColorizer.java b/java/net/easymfne/potioncolorizer/LiteModPotionColorizer.java
index 54ec352..e5a0ae6 100644
--- a/java/net/easymfne/potioncolorizer/LiteModPotionColorizer.java
+++ b/java/net/easymfne/potioncolorizer/LiteModPotionColorizer.java
@@ -6,9 +6,9 @@
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
- * PotionColorizer is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * PotionColorizer is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
@@ -55,7 +55,9 @@ public class LiteModPotionColorizer implements LiteMod, InitCompleteListener,
/** Name/Version information. */
public static final String MOD_NAME = "PotionColorizer";
- public static final String MOD_VERSION = "1.0.0";
+ public static final String MOD_VERSION = "1.0.1";
+
+ private static final int JUMP_BOOST_COLOR_1_8 = 2293580;
/** Modification instance. */
public static LiteModPotionColorizer instance;
@@ -161,7 +163,7 @@ public void init(File configPath) {
Integer.valueOf(potion.getLiquidColor()));
}
}
- defaultColors.put(Potion.jump.getName(), 2293580);
+ defaultColors.put(Potion.jump.getName(), JUMP_BOOST_COLOR_1_8);
LiteLoaderLogger.info("Saved %d default potion liquid colors.",
defaultColors.size());
}
@@ -188,19 +190,44 @@ public void onTick(Minecraft minecraft, float partialTicks, boolean inGame,
* color is not defined, reset its current color to the default if
* necessary.
*
- * @throws IllegalArgumentException
- * If a potion does not have a liquid color field.
* @throws IllegalAccessException
* If a potion does not have an accessible liquid color field.
* @throws NoSuchFieldException
* If the Potion class does not have the liquid color field.
- * @throws SecurityException
- * If a security manager prevents access to liquid color field.
*/
- private void setPotionColors() throws IllegalArgumentException,
- IllegalAccessException, NoSuchFieldException, SecurityException {
- Field f =
- Potion.class.getDeclaredField(PotionObf.potion_liquidColor.obf);
+ private void setPotionColors() throws NoSuchFieldException,
+ IllegalAccessException {
+ for (int i = 0; i < PotionObf.potion_liquidColor.names.length; i++) {
+ try {
+ setPotionColors(PotionObf.potion_liquidColor.names[i]);
+ return;
+ } catch (NoSuchFieldException e) {
+ if (i == PotionObf.potion_liquidColor.names.length - 1) {
+ throw e;
+ }
+ } catch (IllegalAccessException e) {
+ if (i == PotionObf.potion_liquidColor.names.length - 1) {
+ throw e;
+ }
+ }
+ }
+ }
+
+ /**
+ * Using reflection, modify potion colors to custom values via the given
+ * field name. If a custom color is not defined, reset its current color to
+ * the default if necessary.
+ *
+ * @param fieldName
+ * The name of the liquid color field.
+ * @throws IllegalAccessException
+ * If a potion does not have an accessible field of that name.
+ * @throws NoSuchFieldException
+ * If the Potion class does not have a field of that name.
+ */
+ private void setPotionColors(String fieldName) throws NoSuchFieldException,
+ IllegalAccessException {
+ Field f = Potion.class.getDeclaredField(fieldName);
boolean accessibility = f.isAccessible();
f.setAccessible(true);
for (Potion potion : Potion.potionTypes) {
diff --git a/java/net/easymfne/potioncolorizer/PotionColorizerConfigPanel.java b/java/net/easymfne/potioncolorizer/PotionColorizerConfigPanel.java
index df264af..8425206 100644
--- a/java/net/easymfne/potioncolorizer/PotionColorizerConfigPanel.java
+++ b/java/net/easymfne/potioncolorizer/PotionColorizerConfigPanel.java
@@ -6,9 +6,9 @@
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
- * PotionColorizer is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * PotionColorizer is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
@@ -90,8 +90,9 @@ public ColorConfigLine(int idStart, String potionName, int xPos,
.setText(colorToHex(LiteModPotionColorizer.instance.customPotionColors
.get(potionName)));
} else {
- textField.setText(colorToHex(LiteModPotionColorizer.defaultColors
- .get(potionName)));
+ textField
+ .setText(colorToHex(LiteModPotionColorizer.defaultColors
+ .get(potionName)));
}
label = I18n.format(potionName, new Object[0]);
}
@@ -228,23 +229,24 @@ public void mouseMoved(ConfigPanelHost host, int mouseX, int mouseY) {
@Override
public void mousePressed(ConfigPanelHost host, int mouseX, int mouseY,
int mouseButton) {
- if (deglintBox.mousePressed(Minecraft.getMinecraft(), mouseX,
- mouseY)) {
+ if (deglintBox.mousePressed(Minecraft.getMinecraft(), mouseX, mouseY)) {
activeButton = deglintBox;
LiteModPotionColorizer.instance.deglintPotions =
!LiteModPotionColorizer.instance.deglintPotions;
deglintBox.checked = LiteModPotionColorizer.instance.deglintPotions;
- } else if (recolorBox.mousePressed(Minecraft.getMinecraft(), mouseX, mouseY)) {
+ } else if (recolorBox.mousePressed(Minecraft.getMinecraft(), mouseX,
+ mouseY)) {
activeButton = recolorBox;
LiteModPotionColorizer.instance.recolorPotions =
!LiteModPotionColorizer.instance.recolorPotions;
recolorBox.checked = LiteModPotionColorizer.instance.recolorPotions;
- } else if (customColorBox.mousePressed(Minecraft.getMinecraft(), mouseX,
- mouseY)) {
+ } else if (customColorBox.mousePressed(Minecraft.getMinecraft(),
+ mouseX, mouseY)) {
activeButton = customColorBox;
LiteModPotionColorizer.instance.customColors =
!LiteModPotionColorizer.instance.customColors;
- customColorBox.checked = LiteModPotionColorizer.instance.customColors;
+ customColorBox.checked =
+ LiteModPotionColorizer.instance.customColors;
for (ColorConfigLine line : colorLines) {
line.refresh();
}
@@ -293,7 +295,9 @@ public void onPanelShown(ConfigPanelHost host) {
new GuiCheckbox(id++, 10, SPACING * line++, I18n.format(
"config.recolor.text", new Object[0]));
recolorBox.checked = LiteModPotionColorizer.instance.recolorPotions;
- customColorBox = new GuiCheckbox(id++, 10, SPACING * line++, I18n.format("config.custom.text", new Object[0]));
+ customColorBox =
+ new GuiCheckbox(id++, 10, SPACING * line++, I18n.format(
+ "config.custom.text", new Object[0]));
customColorBox.checked = LiteModPotionColorizer.instance.customColors;
colorLines = new ArrayList();
for (Potion potion : Potion.potionTypes) {
diff --git a/java/net/easymfne/potioncolorizer/PotionColorizerEventTransformer.java b/java/net/easymfne/potioncolorizer/PotionColorizerEventTransformer.java
index 22766f8..d32c648 100644
--- a/java/net/easymfne/potioncolorizer/PotionColorizerEventTransformer.java
+++ b/java/net/easymfne/potioncolorizer/PotionColorizerEventTransformer.java
@@ -6,9 +6,9 @@
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
- * PotionColorizer is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * PotionColorizer is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
@@ -58,7 +58,8 @@ protected void addEvents() {
private void addRecolorEvent() {
addEvent(
Event.getOrCreate(
- "PotionColorizer_ItemPotion_getColorFromItemStack", true),
+ "PotionColorizer_ItemPotion_getColorFromItemStack",
+ true),
new MethodInfo(PotionObf.itemPotion,
PotionObf.itemPotion_getColorFromItemStack,
Integer.TYPE, new Object[] { ItemStack.class,
diff --git a/java/net/easymfne/potioncolorizer/PotionObf.java b/java/net/easymfne/potioncolorizer/PotionObf.java
index 9a4faf0..349eaff 100644
--- a/java/net/easymfne/potioncolorizer/PotionObf.java
+++ b/java/net/easymfne/potioncolorizer/PotionObf.java
@@ -6,9 +6,9 @@
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
- * PotionColorizer is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * PotionColorizer is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
@@ -37,8 +37,8 @@ public class PotionObf extends Obf {
"func_77636_d", "e", "hasEffect");
/** liquidColor field in net.minecraft.potion.Potion class. */
- public static PotionObf potion_liquidColor = new PotionObf("liquidColor",
- "K");
+ public static PotionObf potion_liquidColor = new PotionObf("field_76414_N",
+ "K", "liquidColor");
/**
* Create a new obfuscation mapping.
diff --git a/res/src b/res/src
deleted file mode 120000
index df24ea5..0000000
--- a/res/src
+++ /dev/null
@@ -1 +0,0 @@
-/home/eric/workspaces/modding/mcp/mcp908_mc1.7.10/eclipse/PotionRecolor/java
\ No newline at end of file