Jump to content

Decompile java classes without field_ and func_


ElTotisPro50

Recommended Posts

21 hours ago, ElTotisPro50 said:

im in minecraft 1.16.5 and using Intellij Idea Community, do you mean i can open a .class file(that is not mine) in mi IDLE?(if i can, how)

in your IDE yes, take a look at the Dependencies of your project,
you will find the minecraft scource code in the forge-<forge_version>_<mappings_type>_<minecraft_version>.jar, in the package net.minecraft

unfortunately i can't tell, where you find the Dependencies exactly in your Project since i'm not familiar with Intellij (i use Eclipse)

Link to comment
Share on other sites

1 hour ago, Luis_ST said:

in your IDE yes, take a look at the Dependencies of your project,
you will find the minecraft scource code in the forge-<forge_version>_<mappings_type>_<minecraft_version>.jar, in the package net.minecraft

unfortunately i can't tell, where you find the Dependencies exactly in your Project since i'm not familiar with Intellij (i use Eclipse)

i dont want the source code of my project or minecraft or forge, i want to deobfuscate  a separated .class file of other mod for example:

InventedMod

InventedBlock.class

inventedBlockContainer.class

 

ETC

Link to comment
Share on other sites

[EDIT] Sorry I misread your post. This isn't possible for other mods unless you have specific mappings for them. Many are open source, and you can find the source code on curseforge. Many mods that don't list their source on curseforge still have public github repos you can search for.

If you want to build off of a mod that doesn't provide source it's a good idea to check the license first to make sure the author permits what you're trying to do. If they do or you reach out and get permission you'll have to figure out what methods mean contextually, or ask the mod dev for source. 

Edited by Drosophila
misread
Link to comment
Share on other sites

1 hour ago, Drosophila said:

[EDIT] Sorry I misread your post. This isn't possible for other mods unless you have specific mappings for them. Many are open source, and you can find the source code on curseforge. Many mods that don't list their source on curseforge still have public github repos you can search for.

If you want to build off of a mod that doesn't provide source it's a good idea to check the license first to make sure the author permits what you're trying to do. If they do or you reach out and get permission you'll have to figure out what methods mean contextually, or ask the mod dev for source. 

is there a internet page where i can find what func_ and field_ means one by one, like a translation for them?, literally thats the only thing i need

Link to comment
Share on other sites

13 minutes ago, ElTotisPro50 said:

is there a internet page where i can find what func_ and field_ means one by one, like a translation for them?, literally thats the only thing i need

Those are arbitrary prefixes created by the process of obfuscation. The naming convention refers to functions and fields. They could just have easily been foo_ and bar_. 

Edited by Drosophila
typo
Link to comment
Share on other sites

  • 3 weeks later...
1 hour ago, Majd123mc said:

Hold on, there might be a chance that the mod files aren't being the ones obfuscated, but simply the vanilla function calls are.

@ElTotisPro50 Are all the functions and methods like this? Or are only some of them

oh i know that the mod didnt obfuscated the methods, maybe minecraft did, an example is: world.func_numbers or player.func_numbers, this is from a mod called deathnote mod

public class DeathNoteGUIGui extends DeathnoteModElements.ModElement {
  public static HashMap guistate = new HashMap<>();
  
  private static ContainerType<GuiContainerMod> containerType = null;
  
  public DeathNoteGUIGui(DeathnoteModElements instance) {
    super(instance, 5);
    this.elements.addNetworkMessage(ButtonPressedMessage.class, ButtonPressedMessage::buffer, net.neio.deathnote.gui.DeathNoteGUIGui.ButtonPressedMessage::new, ButtonPressedMessage::handler);
    this.elements.addNetworkMessage(GUISlotChangedMessage.class, GUISlotChangedMessage::buffer, net.neio.deathnote.gui.DeathNoteGUIGui.GUISlotChangedMessage::new, GUISlotChangedMessage::handler);
    containerType = new ContainerType((ContainerType.IFactory)new GuiContainerModFactory());
    FMLJavaModLoadingContext.get().getModEventBus().register(this);
  }
  
  @OnlyIn(Dist.CLIENT)
  public void initElements() {
    DeferredWorkQueue.runLater(() -> ScreenManager.func_216911_a(containerType, net.neio.deathnote.gui.DeathNoteGUIGui.GuiWindow::new));
  }
  
  @SubscribeEvent
  public void registerContainer(RegistryEvent.Register<ContainerType<?>> event) {
    event.getRegistry().register(containerType.setRegistryName("death_note_gui"));
  }
  
  private static void handleButtonAction(PlayerEntity entity, int buttonID, int x, int y, int z) {
    World world = entity.field_70170_p;
    if (!world.func_175667_e(new BlockPos(x, y, z)))
      return; 
    if (buttonID == 0) {
      Map<String, Object> $_dependencies = new HashMap<>();
      $_dependencies.put("entity", entity);
      $_dependencies.put("guistate", guistate);
      $_dependencies.put("x", Integer.valueOf(x));
      $_dependencies.put("y", Integer.valueOf(y));
      $_dependencies.put("z", Integer.valueOf(z));
      $_dependencies.put("world", world);
      WriteProcedureProcedure.executeProcedure($_dependencies);
    } 
  }
  
  private static void handleSlotAction(PlayerEntity entity, int slotID, int changeType, int meta, int x, int y, int z) {
    World world = entity.field_70170_p;
    if (!world.func_175667_e(new BlockPos(x, y, z)))
      return; 
  }
}

as you can see func_numbers is seen after "something."

Link to comment
Share on other sites

1 hour ago, Majd123mc said:

Hold on, there might be a chance that the mod files aren't being the ones obfuscated, but simply the vanilla function calls are.

@ElTotisPro50 Are all the functions and methods like this? Or are only some of them

also there is a program called bearded octo nemesis that deobfuscate any .class files(is made for minecraft) but it doesnt work :(

Link to comment
Share on other sites

On 12/29/2021 at 9:18 PM, ElTotisPro50 said:

i dont want the source code of my project or minecraft or forge, i want to deobfuscate  a separated .class file of other mod for example:

of how many classes/methods/fields do you need the SRG names (and yes func_175667_e is a SRG name and not a obfuscate name)

Link to comment
Share on other sites

1 hour ago, Luis_ST said:

of how many classes/methods/fields do you need the SRG names (and yes func_175667_e is a SRG name and not a obfuscate name)

what is a SRG?, ( https://imgur.com/a/RRPPegl )

"of how many classes/methods/fields do you need the SRG names" i dont understand your question, i need to convert those obfuscated fields or "SRG" as you said to readable fields

Link to comment
Share on other sites

Hi!

I think the Forge Discord has a Bot for converting SRG Names to the newest Mappings. I don't know how it works but try just going on their discord an typing !help or something like that 

Sorry if my Posts are weird sometimes, I just try to help and learn as much as I can :D

Also: PLEASE use SPOILERS for logs!

Link to comment
Share on other sites

1 hour ago, Luis_ST said:

I think this would make the hole thing clear

ok that just explained me how forge obfuscate the fields but i need to really deobfuscate them not to explain mehow they do it(maybe im blind and in the page there is  tool or something that deobfuscates the fields but i didnt see anything)

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.



×
×
  • Create New...

Important Information

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