Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.2] Deobfuscating mod code help


Electrobob99
 Share

Recommended Posts

Like The subject states, I have hit a bit of a snag with obfuscating reversal. You see I am getting this message when hovering over this code

 

Message:

 cannot convert from Object&Comparable<?>&Serializable to boolean

Code:

 bound[0] = [i](!iblockaccess.isAirBlock(i - 1, j, k) ? 1 : false)[/i]

From what the compiler suggests I should add a cast to boolean, but I am not quite sure if that's correct or not.

I also have this problem that within a setBlockBounds method that is later in code, which says this part undefined, don't know if it's a problem or not:

setBlockBounds(bound[0] != 0 ? 0.0F : 0.25F, 0.0F, bound[1] != 0 ? 0.0F : 0.25F, bound[2] != 0 ? 1.0F : 0.75F, bound[4] != 0 ? 1.0F : 0.5F, bound[3] != 0 ? 1.0F : 0.75F);

 

Help would be appreciated, thank you

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

Show more of the code, what does "iblockaccess" point to?

Ok, this is the method where it is contained, with what "iblockaccess" points to:

 

public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k)
{
     boolean[] bound = new boolean[6];
     Block block = iblockaccess.getBlock(i, j - 1, k);
     if (block != this)
{
bound[0] = (!iblockaccess.isAirBlock(i - 1, j, k) ? 1 : false);
bound[1] = (!iblockaccess.isAirBlock(i, j, k - 1) ? 1 : false);
bound[2] = (!iblockaccess.isAirBlock(i + 1, j, k) ? 1 : false);
bound[3] = (!iblockaccess.isAirBlock(i, j, k + 1) ? 1 : false);
bound[4] = (!iblockaccess.isAirBlock(i, j + 1, k) ? 1 : false);
       setBlockBounds(bound[0] != 0 ? 0.0F : 0.25F, 0.0F, bound[1] != 0 ? 0.0F : 0.25F, bound[2] != 0 ? 1.0F : 0.75F, bound[4] != 0 ? 1.0F : 0.5F, bound[3] != 0 ? 1.0F : 0.75F);
}
else
{
bound[0] = ((iblockaccess.getBlock(i - 1, j, k) == this) && (iblockaccess.isAirBlock(i - 1, j - 1, k)) ? 1 : false);
bound[1] = ((iblockaccess.getBlock(i, j, k - 1) == this) && (iblockaccess.isAirBlock(i, j - 1, k - 1)) ? 1 : false);
bound[2] = ((iblockaccess.getBlock(i + 1, j, k) == this) && (iblockaccess.isAirBlock(i + 1, j - 1, k)) ? 1 : false);
bound[3] = ((iblockaccess.getBlock(i, j, k + 1) == this) && (iblockaccess.isAirBlock(i, j - 1, k + 1)) ? 1 : false);
setBlockBounds(bound[0] != 0 ? 0.0F : 0.25F, 0.0F, bound[1] != 0 ? 0.0F : 0.25F, bound[2] != 0 ? 1.0F : 0.75F, 1.0F, bound[3] != 0 ? 1.0F : 0.75F);
}
}

 

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

Why are you trying to store "1" or "false" into a boolean?  Booleans can't store "1".

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Ok, so bound is a boolean[]. So bound[0] = needs a boolean. But this expression: (!iblockaccess.isAirBlock(i - 1, j, k) ? 1 : false) yields and int or a boolean, where the most common supertype is Object (or really Serializable, but who cares about that).

So... you need to make it always return a boolean. In this case just replace the 1 with true. This is a decompiler error, because true and false are represented as 1 and 0 in the bytecode.

Link to comment
Share on other sites

Ok, so bound is a boolean[]. So bound[0] = needs a boolean. But this expression: (!iblockaccess.isAirBlock(i - 1, j, k) ? 1 : false) yields and int or a boolean, where the most common supertype is Object (or really Serializable, but who cares about that).

So... you need to make it always return a boolean. In this case just replace the 1 with true. This is a decompiler error, because true and false are represented as 1 and 0 in the bytecode.

Thank you, the true in place of 1 did fix the first issue, but I didn't fix the error with "bound[0] != 0" within the setBlockBounds inner method, unless I have to change the "0" to false? Would that be right?

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

Ok, another problem I have encountered was with this line in the configuration:

Property debug = cfg.get("general", "debug", false);
/* 144:152 */       debug = debug.getBoolean(false);

I also noticed there is a boolean named debug in the beginning of the main file. I'd assume that it's supposed to be different xD Like change the Property debug to a different name, or change the Boolean debug to a different name?

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

boolean debug = cfg.getBoolean("genera","debug",false);

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

boolean debug = cfg.getBoolean("genera","debug",false);

Define "doesn't work".

By doesn't work I mean I get this when I change it: "the method getBoolean(String, String, Boolean) is undefined for the type Configuration"

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

That error is obvious.

I think I would how to resolve this, found there were actually 2 variables named debug, one was a Property type, and the other was of Boolean type. So I think all I should have to do is change one of their variable names.

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

Ok, so things were going fine for me, until I got to the biome portion of my endeavors. In one of the main biome files, I found this line of code which gives an error:

BiomeManager.icyBiomes.add(new BiomeManager.BiomeEntry([i]biome[/i], 10));

. So my question is what could be done to fix this?

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

What's the error?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

What's the error?

Well, to be honest I do know why it doesn't work, in that biome creation changed. Specifically the fact that the BiomeManager class no longer has icybiomes/warmbiomes, etc. But what I want to know is what is supposed to be used in place of:

"BiomeManager.icyBiomes.add(new BiomeManager.BiomeEntry(biomename, 10));"

 

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

/*
     * These lists should no longer be accessed directly. Instead, use the appropriate add, remove and get methods within this class.
     */
    @Deprecated
    public static List<BiomeEntry> icyBiomes = biomes[biomeType.ICY.ordinal()];

 

Huh, it says deprecated with a note on what to use instead.  Use the appropriate add, remove and get methods within this class.

 

    public static void addBiome(BiomeType type, BiomeEntry entry)
    {
        isModded = true;
        
        int idx = type.ordinal();
        List<BiomeEntry> list = idx > biomes.length ? null : biomes[idx];
        if (list != null) list.add(entry);
    }

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

/*
     * These lists should no longer be accessed directly. Instead, use the appropriate add, remove and get methods within this class.
     */
    @Deprecated
    public static List<BiomeEntry> icyBiomes = biomes[biomeType.ICY.ordinal()];

 

Huh, it says deprecated with a note on what to use instead.  Use the appropriate add, remove and get methods within this class.

 

    public static void addBiome(BiomeType type, BiomeEntry entry)
    {
        isModded = true;
        
        int idx = type.ordinal();
        List<BiomeEntry> list = idx > biomes.length ? null : biomes[idx];
        if (list != null) list.add(entry);
    }

Doesn't seem to be the case for 1.7.2, and to show it here is the BiomeManager class verbatim:

 

public class BiomeManager
{
    public static ArrayList<BiomeGenBase> strongHoldBiomes = new ArrayList<BiomeGenBase>();
    public static ArrayList<BiomeGenBase> strongHoldBiomesBlackList = new ArrayList<BiomeGenBase>();

    @SuppressWarnings("unchecked")
    public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn)
    {
        if (!MapGenVillage.villageSpawnBiomes.contains(biome))
        {
            ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
            biomes.add(biome);
            MapGenVillage.villageSpawnBiomes = biomes;
        }
    }

    @SuppressWarnings("unchecked")
    public static void removeVillageBiome(BiomeGenBase biome)
    {
        if (MapGenVillage.villageSpawnBiomes.contains(biome))
        {
            ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
            biomes.remove(biome);
            MapGenVillage.villageSpawnBiomes = biomes;
        }
    }

    public static void addStrongholdBiome(BiomeGenBase biome)
    {
        if (!strongHoldBiomes.contains(biome))
        {
            strongHoldBiomes.add(biome);
        }
    }

    public static void removeStrongholdBiome(BiomeGenBase biome)
    {
        if (!strongHoldBiomesBlackList.contains(biome))
        {
            strongHoldBiomesBlackList.add(biome);
        }
    }

    public static void addSpawnBiome(BiomeGenBase biome)
    {
        if (!WorldChunkManager.allowedBiomes.contains(biome))
        {
            WorldChunkManager.allowedBiomes.add(biome);
        }
    }

    public static void removeSpawnBiome(BiomeGenBase biome)
    {
        if (WorldChunkManager.allowedBiomes.contains(biome))
        {
            WorldChunkManager.allowedBiomes.remove(biome);
        }
    }
}

 

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

Try

BiomeDictionary.registerBiomeType(BiomeGenBase biome, Type ... types)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Ok here is another question. I have heard that I could use the BON program to deobfuscate classes, but what I want to know is, what do I put into the "MCP Folder" parameter. I ask this since there is no MCP folder anymore.

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

Ok here is another question. I have heard that I could use the BON program to deobfuscate classes, but what I want to know is, what do I put into the "MCP Folder" parameter. I ask this since there is no MCP folder anymore.

Download BON2, it is updated for the new Forge installation.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Ok, didn't know there was a Bon2, but... dumb question, where do I install it? Mainly ask this because I get this error when I try to run it:

Guava Couldn't be found. You must run setupDevWorkspace or setupDecompWorkspace atleast once to in order to use this.

Followed by:

Guava couldn't be added to the classpath. Please report to Parker8283. java.lang.ClassNotFoundException: com.google.common.collect.Maps

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.