MrMasochism Posted July 4, 2012 Posted July 4, 2012 Hi, I've been trying to set the private values in EnumCreatureType using ModLoader.setPrivateValue. This works fine in the eclipse environment but when i come to reobfuscate it doesn't update the name of the field that i'm trying to set and so it will die with a fieldNotFound exception. Is this a bug or am i doing something not supported? MrMasochism Quote
LexManos Posted July 4, 2012 Posted July 4, 2012 The reobf does not reobf strings. How could it? You have to take that into account. Quote I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
MrMasochism Posted July 4, 2012 Author Posted July 4, 2012 Yeah that's fair enough, how can i find what the reobfuscated variable is named? Quote
LexManos Posted July 4, 2012 Posted July 4, 2012 By using MCPBot on espernet. EXA: Quote <LexManos> gcf Minecraft.thePlayer -MCPBot- [ GET CLIENT FIELDS ] -MCPBot- Side : client -MCPBot- Name : Minecraft.thePlayer -MCPBot- Notch : Minecraft.h -MCPBot- Searge : field_6322_g -MCPBot- Type/Notch : LEntityPlayerSP; | Lvq; -MCPBot- Description : The player who's actually in control of this game. Or, looking at the maping files inside the conf folder, those are fairly self explanatory. Quote I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
MrMasochism Posted July 4, 2012 Author Posted July 4, 2012 Alright, so i found that maxNumberOfCreature was reobfuscated to field_21108_e but when i switched the call over to that field it still came up saying that the field could not be found: try { ModLoader.setPrivateValue(EnumCreatureType.class, EnumCreatureType.monster, "field_21108_e", 80); ModLoader.setPrivateValue(EnumCreatureType.class, EnumCreatureType.creature, "field_21108_e", 80); ModLoader.setPrivateValue(EnumCreatureType.class, EnumCreatureType.waterCreature, "field_21108_e", 100); } catch (Throwable e) { System.err.println(e); } Reveal hidden contents [sEVERE] Unexpected exception java.lang.RuntimeException: java.lang.NoSuchFieldException: field_21108_e at cpw.mods.fml.common.ReflectionHelper.setPrivateValue(ReflectionHelper.java:93) at ModLoader.setPrivateValue(ModLoader.java:731) at pixelmon.PixelmonSpawner.init(PixelmonSpawner.java:17) at mod_Pixelmon.addSpawns(mod_Pixelmon.java:271) at mod_Pixelmon.load(mod_Pixelmon.java:214) at cpw.mods.fml.common.modloader.ModLoaderModContainer.init(ModLoaderModContainer.java:351) at cpw.mods.fml.common.Loader.modInit(Loader.java:263) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:604) at cpw.mods.fml.server.FMLServerHandler.onLoadComplete(FMLServerHandler.java:147) at net.minecraft.server.MinecraftServer.s(MinecraftServer.java:204) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:412) at dn.run(SourceFile:492) Caused by: java.lang.NoSuchFieldException: field_21108_e at java.lang.Class.getDeclaredField(Unknown Source) at cpw.mods Quote
MrMasochism Posted July 4, 2012 Author Posted July 4, 2012 This error of course comes up after reobfuscation and was before i stuck the try catch loop around it. Running it inside eclipse with the maxNumberOfCreature string works fine too Quote
LexManos Posted July 4, 2012 Posted July 4, 2012 That isnt the obfuscated name, that's the Searge name. You want the Notch name. Quote I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.