Jump to content

[1.7.2] Deobfuscating mod code help


Electrobob99

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.

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

It clearly tells you whats wrong.

I understand that it can't find Guava. My question is where is Guava, since even I can't find it in my modding environment either.

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

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

Reading helps.

Ok, I just ran both setupDevWorkspace as well as setupDecompWorkspace successfully, and the results..... Same error occurred. Says that guava still can't be found.

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

I think I will just give up using Bon2, since I don't want to make a 1.8 workspace just so I can deobfuscate the code. I want to get it working in the version I stated in, and perfect it before I port it.. More fun that way xD

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
    • It is an issue with quark - update it to this build: https://www.curseforge.com/minecraft/mc-mods/quark/files/3642325
    • Remove Instant Massive Structures Mod from your server     Add new crash-reports with sites like https://paste.ee/  
  • Topics

×
×
  • Create New...

Important Information

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