Jump to content

[1.9] Where can I find the vanilla Minecraft methods, if possible? [Solved]


Recommended Posts

Posted

If I knew where to look to see all of Minecraft's methods I feel I could better understand what it is I'm doing. I've looked inside the so called "deobfuscated" uncompiled Minecraft code that you get when you run "gradle setupDecompWorkspace", but all I find are arbitrary method names such as "func_123456_a" and so on.

 

I have a specific instance where I would like to know the method to a play a sound within a world. So I went to "net/minecraft/world/World.java" but all the methods names are obfuscated. Where would I look to find the true method names within this file?

Posted

Are you looking at the code in your IDE or manually opening a JAR? Your IDE should show you the deobfuscated source code when you open a vanilla class.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Are you looking at the code in your IDE or manually opening a JAR? Your IDE should show you the deobfuscated source code when you open a vanilla class.

 

After running "gradle setupDecompWorkspace" I extracted the jar located at "/build/tmp/decompileMc/forge-1.9-12.16.0.1854-1.9-srgBin.jar" to a directory of the same name at the same location. I then opened the file located at "/build/tmp/decompileMc/forge-1.9-12.16.0.1854-1.9-srgBin/net/minecraft/world/World.java" with my IDE.

 

Here is a snippet of the contents demonstrating the arbitrary method/parameter names:

   public boolean func_175691_a(BlockPos p_175691_1_, Block p_175691_2_) {
      return false;
   }

   public boolean func_175678_i(BlockPos p_175678_1_) {
      return this.func_175726_f(p_175678_1_).func_177444_d(p_175678_1_);
   }

   public boolean func_175710_j(BlockPos p_175710_1_) {
      if(p_175710_1_.func_177956_o() >= this.func_181545_F()) {
         return this.func_175678_i(p_175710_1_);
      } else {
         BlockPos blockpos = new BlockPos(p_175710_1_.func_177958_n(), this.func_181545_F(), p_175710_1_.func_177952_p());
         if(!this.func_175678_i(blockpos)) {
            return false;
         } else {
            for(blockpos = blockpos.func_177977_b(); blockpos.func_177956_o() > p_175710_1_.func_177956_o(); blockpos = blockpos.func_177977_b()) {
               IBlockState iblockstate = this.func_180495_p(blockpos);
               if(iblockstate.func_185891_c() > 0 && !iblockstate.func_185904_a().func_76224_d()) {
                  return false;
               }
            }

            return true;
         }
      }
   }

 

These method names are nothing like the ones I see people using from these classes when importing these classes into their mods. This is where my confusion lies.

Posted

Don't manually open any JARs. Your IDE project has a forgeSrc library as a dependency, this contains the Minecraft/Forge classes with the source code attached to them. Simply open a class in this library and your IDE will show you the deobfuscated source code.

 

The JAR you tried to open is using SRG (semi-obfuscated) names, hence the srgBin classifier. build/tmp contains temporary files created by the build process, you should never need to use any of these files.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Don't manually open any JARs. Your IDE project has a forgeSrc library as a dependency, this contains the Minecraft/Forge classes with the source code attached to them. Simply open a class in this library and your IDE will show you the deobfuscated source code.

 

The JAR you tried to open is using SRG (semi-obfuscated) names, hence the srgBin classifier. build/tmp contains temporary files created by the build process, you should never need to use any of these files.

 

Okay, that makes a lot more sense, thank you. However I cannot locate a forgeSrc folder/library anywhere inside my mod directory. Can you please tell me where or how to either locate or acquire this?

 

Note: I'm am not using Eclipse or IntelliJ.

Posted

You won't see the source code in your mod directory - you find it using your IDE by looking in the referenced libraries.

 

The actual location of the setupDecompWorkspace output varies but is usually found in a folder somewhere under your /%User%/ directory. You can find out by checking the path of the forgeSrc entry under your IDE's referenced libraries.

 

EDIT: Sorry, didn't see your note about not using an IDE :\

Posted

Ah, I assumed you were using an IDE project generated by ForgeGradle. If you've created the project yourself it probably doesn't have the dependencies specified by ForgeGradle.

 

If your mod and the mods it depends on (if any) aren't using any access transformers, you can find the compiled forgeSrc library in the Gradle cache: ~/.gradle/caches/minecraft/net/minecraftforge/forge/<forge_version>/<mcp_mappings_channel>/<mcp_mappings_version>/forgeSrc-<forge_version>.jar (replace ~ with %USERPROFILE% on Windows)

 

If you are using access transformers, you can find the compiled forgeSrc library in your ForgeGradle workspace: <workspace_dir>/.gradle/minecraft/forgeSrc-<forge_version>-PROJECT(<project_name>).jar

 

In both cases, the JAR containing the source code will be in the same directory with the -sources classifier.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Well coolAlias's reply inspired me to go back and re-run "gradle setupDecompWorkspace" again but this time with "-d" debug flag and that showed it outputting forgeSrc into my Gradle cache exactly where your later reply Choonster said it would be. It's a shame I found it before I refreshed to see your reply, Choonster. At least it's location has been layed out elegantly for anybody else who has the same confusion I had. Thank you Choonster and coolAlias both very much for your help.

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

    • I need to know what mod is doing this crash, i mean the mod xenon is doing the crash but i want to know who mod is incompatible with xenon, but please i need to know a solution if i need to replace xenon, i cant use optifine anymore and all the other mods i tried(sodium, lithium, vulkan, etc) doesn't work, it crash the game.
    • I have been trying to solve a consistent crashing issue on my brother's computer where it will crash during the "Scanning Mod Candidates" phase of the loading process that starts when you click the play button on the Minecraft launcher. The issue seems to stem from a missing library that it mentions in the log file I provide below. I might I'm missing the bigger issue here for a smaller one but hopefully someone can find what I'm missing. Here's all of the stuff that I've been able to figure out so far: 1. It has nothing to do with mods, the crash happened with a real modpack, and even when I made a custom modpack and launched it without putting ANY mods into it (That is where the log file comes from by the way). 2. I have tried to find this class like a file in the Minecraft folders, but I've had no luck finding it (I don't think it works like that, but since I really don't understand how it works, I just figured I'd try). 3. I haven't seen anyone else have this issue before. 4. I know that my modpack (with mods) does work since I've run it on my computer, and it works fantastic. For some reason my brother's computer can't seem to run anything through curseforge. 5. This is for Minecraft version 1.20.1, Minecraft launcher version 3.4.50-2.1.3, forge 47.3.0, and curseforge app version 1.256.0.21056 6. My brother is using a Dell laptop from 6 years ago running Windows 10 (If you think more info on this would help, please ask as I do have it. I'm just choosing not to put it here for now). 7. I have reinstalled the curseforge app and installed Minecraft version 1.20.1. I have not reinstalled Minecraft or forge 47.3.0 but I didn't know if that would help. 8. I had an error code of 1 Please let me know if there is anything else that I am missing that you would like me to add to this post/add in a comment! Lastly, many thanks in advance to whoever can help! ------------- LOG FILE (latest.log) ------------- (from /Users/<NAME OF USER>/cursforge/minecraft/Instances/<THE NAME OF MY EMPTY MODPACK>/logs/latest.log) (This was made after running an empty modpack with same versions for all apps) ("[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/hxXvGGEK ------------- DEBUG.LOG (I realized that I should have put this here first after I had done all of the work on putting latest.log in) -------------------- (again, "[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/Fmh8GHYs
    • Pastebin... https://pastebin.com/Y3iZ85L5   Brand new profile, does not point to a mod as far as I can tell, my fatal message just has something about mixins. Don't know much about reading logs like this, but am genuinely stuck, please help. Java updated, pc restarted.
    • I was playing minecraft, forge 47.3.0 and 1.20.1, but when i tried to play minecraft now only crashes, i need help please. here is the crash report: https://securelogger.net/files/e6640a4f-9ed0-4acc-8d06-2e500c77aaaf.txt
  • Topics

×
×
  • Create New...

Important Information

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