0
\$\begingroup\$

I am trying to build a Minecraft mod with Forge on IntelliJ, and I am wondering where I can find the parts that are being imported.

For example: import net.minecraft.world.level.block.Block;

I checked minecraft.net to see whether I can find it there, but I was unable to. This is the same for other sources, which I'd like to gather more information from, such as what they are, what they are used for, what else is included, etc. I also checked all the folders included in the setup with Forge.

As of now, I am more comfortable with Javascript/Node.JS, so I know if I were doing something similar to this in JS, it would be like searching it up on npmjs.com.

EDIT: I think I found it: I believe it was in ./build/_compileJava_2. I guess my question still lasts for a general build with Java. How come although those sources are in other directories (such as ./build/_compileJava_2) I only have to write import net.minecraft.world..... instead of something like import "./build/_compileJava_2/net/minecraft/world/..."?

\$\endgroup\$
1
  • \$\begingroup\$ In Eclipse you can ctrl-click on something, or right click -> jump to definition, or see it in the project tree under "Referenced Libraries". Does IntelliJ not have something similar? \$\endgroup\$ Nov 23, 2022 at 18:20

1 Answer 1

0
\$\begingroup\$

Without knowing what build system you are using its hard to say.

There is a bunch of basic java stuff you probably need to learn about too. Maven is the main repo for java artifacts (https://search.maven.org/), similar to npm for js. However for commercial game files like the minecraft, they are not likely to be distributed this way.

The key thing for any java project is that imports are done by package name, not file location/path. The find the location in disk, you need to know how the classpath is being built. This provides an overview of what it is, but it is not normally set manually these days: https://stackoverflow.com/questions/2396493/what-is-a-classpath-and-how-do-i-set-it

Additionally, in Intellij, you should be able to click on the project tab and make sure it is set to project view. There should be an external libraries section listing all the dependencies. You can expand these to find more details, and right-click -> open in -> explorer to find the location in your file system.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .