Creating a Tile Entity

Before actually creating the TileEntity class, it is a good idea to register it in the mod file first. Just like most other things you have to register for your mod, you can do this using the GameRegistry class. You use a method called registerTileEntity, which looks like the following for TileEntitySam:

GameRegistry.registerTileEntity(TileEntitySam.class, "TE_samTE");

The first parameter in this method is the tile entity you want to register, followed by .class. The second parameter is the unlocalized name of the tile entity. However, because the tile entity will never show its name, it’s not required to add a localization for it in the en_US.lang file.

Now it’s time to actually create the ...

Get Minecraft™ Mod Development in 24 Hours, Sams Teach Yourself now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.