The Meaning of Life, the Universe, and Everything.
Join Date:
6/14/2017
Posts:
44
Member Details
Not exactly. Just mcp for now. Can I change minecraft client code? What I want to is get rid of all the "flag1", "flag2" names and put in stuff to make the code clearer. Will mcp still be able to recompile and reobfuscate the code later back into the same minecraft jar?
Nothing will happen if you rename variables or methods within a class as long as they are not referenced elsewhere (then you'd have to change those classes as well and it is best not to modify more classes than you need to). In fact, I recommend that you do to make the code easier to read, rather than having "var1, par1, field12345" all over the place (MCP mostly only fully deobfuscates frequently used methods and fields).
For example, I changed the following line of code (using the names in MCP for 1.6.4) to the one seen below it by renaming variables, changing the method name and even adding/removing parameters (it is only called from within the same class so it doesn't matter what you do):
MCP won't change any renamed variables back to their obfuscated names but that doesn't matter either*, it is just as if you added a new class and I've even gone further, like this (I combined MapGenCaves with MapGenBase as well as MapGenRavine so they are all one class, mainly for convenience at first; ChunkProviderGenerate was already modified so there was no reason not to change the class declarations):
public class MapGenCaves extends MapGenBase
public class MapGenCavesRavines
As seen here I made a lot more changes, including to the way the classes are constructed (vanilla and modified):
public class ChunkProviderGenerate implements IChunkProvider
{
private MapGenBase caveGenerator = new MapGenCaves();
public class ChunkProviderGenerate implements IChunkProvider
{
// Combination of MapGenBase, MapGenCaves, and MapGenRavine
private MapGenCavesRavines caveGenerator;
public ChunkProviderGenerate(World world, long worldSeed, boolean structuresEnabled)
{
// Note that MapGenCavesRavines depends on MapGenStronghold and MapGenMineshaft depends on
// MapGenCavesRavines and MapGenStronghold
this.strongholdGenerator = new MapGenStronghold(world);
this.caveGenerator = new MapGenCavesRavines(world, this.strongholdGenerator, structuresEnabled);
this.mineshaftGenerator = new MapGenMineshaft(world, this.caveGenerator, this.strongholdGenerator);
*Of course, any other mods that try to access the modified classes won't work or will use the (unaltered) vanilla-named classes instead of your modified (renamed) classes but if you are using MCP you probably don't care about mod cross-compatibility (the changes shown above completely wreak any possibility of compatibility but the mod it is from is not intended to be used with other world-generation mods, if there are even any that do not use Forge, which this mod is also incompatible with).
The Meaning of Life, the Universe, and Everything.
Join Date:
6/14/2017
Posts:
44
Member Details
Thank you for your reply, very informative. But in case I do want to minimize compatibility issues (more concerned about other mods of my own that I might make), then is changing local variables and parameters names any problem? Will mcp be able to recompile minecraft back exactly to what it was?
Not exactly. Just mcp for now. Can I change minecraft client code? What I want to is get rid of all the "flag1", "flag2" names and put in stuff to make the code clearer. Will mcp still be able to recompile and reobfuscate the code later back into the same minecraft jar?
Nothing will happen if you rename variables or methods within a class as long as they are not referenced elsewhere (then you'd have to change those classes as well and it is best not to modify more classes than you need to). In fact, I recommend that you do to make the code easier to read, rather than having "var1, par1, field12345" all over the place (MCP mostly only fully deobfuscates frequently used methods and fields).
For example, I changed the following line of code (using the names in MCP for 1.6.4) to the one seen below it by renaming variables, changing the method name and even adding/removing parameters (it is only called from within the same class so it doesn't matter what you do):
MCP won't change any renamed variables back to their obfuscated names but that doesn't matter either*, it is just as if you added a new class and I've even gone further, like this (I combined MapGenCaves with MapGenBase as well as MapGenRavine so they are all one class, mainly for convenience at first; ChunkProviderGenerate was already modified so there was no reason not to change the class declarations):
As seen here I made a lot more changes, including to the way the classes are constructed (vanilla and modified):
*Of course, any other mods that try to access the modified classes won't work or will use the (unaltered) vanilla-named classes instead of your modified (renamed) classes but if you are using MCP you probably don't care about mod cross-compatibility (the changes shown above completely wreak any possibility of compatibility but the mod it is from is not intended to be used with other world-generation mods, if there are even any that do not use Forge, which this mod is also incompatible with).
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
Thank you for your reply, very informative. But in case I do want to minimize compatibility issues (more concerned about other mods of my own that I might make), then is changing local variables and parameters names any problem? Will mcp be able to recompile minecraft back exactly to what it was?