I am working on a fix for a mod for the game minecraft. but there is a catch. The mod is not made by me, so i have to decompile it
To make a long story short, this is my first time working on obsfucated, noncomplete sources.
I am only gonna edit ONE file (out of around 1.5K).
It decompiled fine, and i edited what i wanted, but now i can’t compile it. I am using the classpath variable to point it to the jar, so i can still use the classes from the rest of the game. but 2 errors exists, both involving “.getDeclaredField(s)”.
Code:
public static Minecraft getMinecraft()
{
try
{
Field field = Minecraft.getDeclaredField("a"); // Error here
field.setAccessible(true);
return (Minecraft)field.get(null);
}
catch(IllegalAccessException illegalaccessexception)
{
illegalaccessexception.printStackTrace();
}
catch(NoSuchFieldException nosuchfieldexception)
{
nosuchfieldexception.printStackTrace();
}
return null;
}
The other case is just like this, so no need to show you that.
Error log:
TMIUtils.java:23: cannot find symbol
symbol : method getDeclaredField(java.lang.String)
location: class net.minecraft.client.Minecraft
Field field = Minecraft.getDeclaredField("a");
How will i go about fixing this? (keep in mind this is the first time working with getDeclaredField too)
It should be
Perhaps it’s a decompiler’s error.
getDeclaredField()is a method of typeClass, andMinecraft.classis a literal value of that type.