Minecraft Class Overview - TriValleyCoderDojo/Minecraft-Jar-Hacks GitHub Wiki

When you first go into Forge ModLoader project in Eclipse, it may seem daunting, but it's not! Take a deep breath and say "I can do this", because you can! It's pretty easy. All you need is to understand a few simple things.

The first would be the Java package structure. Java structures the Java class files in tree hierarchy. You start from a root package and then go down the tree. In the case of Mojang Minecraft, everything starts from the root "net" and then the next level is "minecraft", which will form the base tree structure for all of the Minecraft source code. Now in the Eclipse project, all of the source code will by in the "src" sub-directory under the Minecraft project.

Minecraft Source Tree

When you first start to browse in the Minecraft source tree, there is a lot of stuff in there, but it's really not that bad, because there really only are three major groups of things that you are going to want to be "hacking". Those would be:

  • Blocks
  • Items
  • Entities

Blocks are anything that you place in Minecraft. This would stuff like Dirt, Grass, Cobblestone, Furnace, etc...

Items are anything that you can hold in your hand. This would be stuff like Sword, Axe, Torch, etc...

Entities are things that move around in the game and do things. This would include both aggressive (all Monsters) and passive (all Animals) entities.

Blocks

All of the block related classes will be in the net.minecraft.block package. An important thing to consider is that Java takes advantage of object inheritance, and all of the block related objects will extend from and thus inherit everything from the Block class. You can think of these object as children of the Block. For example, BlockStone is extended from Block. Sometimes there is an additional level in between. For example, BlockIce extends from BlockBreakable and then BlockBreakable extends from Block. I think you are seeing the pattern. One way or another they will all extend from Block, making it a superclass. This is important, because if you make a change to Block, there is a good chance it will effect all of the blocks, so just be careful.

Block Source Tree

Items

The items are similar to the blocks, in that they are all in one Java package (net.minecraft.item) and they all extend the Item superclass.

Item Source Tree

Entities

The entities are a little more complicated. The top level package is net.minecraft.entity, but there are many packages below that. However, there are really only two that you will be interested in net.minecraft.entity.monster and net.minecraft.entity.projectile. The classes in these two package are the common ones to "hack".

Entity Source Tree