Use proper obfuscation
This commit is contained in:
parent
b6446032ae
commit
1df2209f25
2 changed files with 12 additions and 10 deletions
|
@ -3,6 +3,8 @@ package mekanism.client.gui;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
import mekanism.common.ObfuscatedNames;
|
||||||
|
import mekanism.common.util.MekanismUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
@ -33,7 +35,7 @@ public abstract class GuiElement
|
||||||
protected void displayTooltip(String s, int xAxis, int yAxis)
|
protected void displayTooltip(String s, int xAxis, int yAxis)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Method m = GuiContainer.class.getDeclaredMethod("drawCreativeTabHoveringText", String.class, Integer.TYPE, Integer.TYPE);
|
Method m = MekanismUtils.getPrivateMethod(GuiContainer.class, ObfuscatedNames.GuiContainer_drawCreativeTabHoveringText, String.class, Integer.TYPE, Integer.TYPE);
|
||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
m.invoke(guiObj, s, xAxis, yAxis);
|
m.invoke(guiObj, s, xAxis, yAxis);
|
||||||
} catch(Exception e) {}
|
} catch(Exception e) {}
|
||||||
|
@ -44,9 +46,8 @@ public abstract class GuiElement
|
||||||
if(guiObj instanceof GuiContainer)
|
if(guiObj instanceof GuiContainer)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Field f = GuiContainer.class.getDeclaredField("xSize");
|
int size = (Integer)MekanismUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_xSize);
|
||||||
f.setAccessible(true);
|
MekanismUtils.setPrivateValue(guiObj, size+xSize, GuiContainer.class, ObfuscatedNames.GuiContainer_xSize);
|
||||||
f.set(guiObj, ((Integer)f.get(guiObj))+xSize);
|
|
||||||
} catch(Exception e) {}
|
} catch(Exception e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,9 +57,8 @@ public abstract class GuiElement
|
||||||
if(guiObj instanceof GuiContainer)
|
if(guiObj instanceof GuiContainer)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Field f = GuiContainer.class.getDeclaredField("ySize");
|
int size = (Integer)MekanismUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_ySize);
|
||||||
f.setAccessible(true);
|
MekanismUtils.setPrivateValue(guiObj, size+ySize, GuiContainer.class, ObfuscatedNames.GuiContainer_ySize);
|
||||||
f.set(guiObj, ((Integer)f.get(guiObj))+ySize);
|
|
||||||
} catch(Exception e) {}
|
} catch(Exception e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,9 +66,7 @@ public abstract class GuiElement
|
||||||
protected FontRenderer getFontRenderer()
|
protected FontRenderer getFontRenderer()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Field f = GuiScreen.class.getDeclaredField("fontRenderer");
|
return (FontRenderer)MekanismUtils.getPrivateValue(guiObj, GuiScreen.class, ObfuscatedNames.GuiScreen_fontRenderer);
|
||||||
f.setAccessible(true);
|
|
||||||
return (FontRenderer)f.get(guiObj);
|
|
||||||
} catch(Exception e) {}
|
} catch(Exception e) {}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -7,4 +7,8 @@ public final class ObfuscatedNames
|
||||||
public static String[] AbstractClientPlayer_downloadImageCape = new String[] {"downloadImageCape", "field_110315_c", "c"};
|
public static String[] AbstractClientPlayer_downloadImageCape = new String[] {"downloadImageCape", "field_110315_c", "c"};
|
||||||
public static String[] AbstractClientPlayer_locationCape = new String[] {"locationCape", "field_110313_e", "e"};
|
public static String[] AbstractClientPlayer_locationCape = new String[] {"locationCape", "field_110313_e", "e"};
|
||||||
public static String[] AbstractClientPlayer_getDownloadImage = new String[] {"getDownloadImage", "func_110301_a", "a"};
|
public static String[] AbstractClientPlayer_getDownloadImage = new String[] {"getDownloadImage", "func_110301_a", "a"};
|
||||||
|
public static String[] GuiContainer_drawCreativeTabHoveringText = new String[] {"drawCreativeTabHoveringText", "func_74190_a", "a"};
|
||||||
|
public static String[] GuiContainer_xSize = new String[] {"xSize", "field_74194_b", "c"};
|
||||||
|
public static String[] GuiContainer_ySize = new String[] {"ySize", "field_74195_c", "d"};
|
||||||
|
public static String[] GuiScreen_fontRenderer = new String[] {"fontRenderer", "field_73886_k", "o"};
|
||||||
}
|
}
|
Loading…
Reference in a new issue