O'Reilly logo

Minecraft™ Mod Development in 24 Hours, Sams Teach Yourself by Jimmy Koene

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Tile Entity Block

To create a block that is a tile entity, you first need a basic block. The code for the tile entity you create in this hour is as follows:

public static Block samTE;

In addition, add this code to the preInit method:

samTE = new BlockSamTE();GameRegistry.registerBlock(samTE, "SamTE");

When you add this, an error should appear under BlockSamTE, which you can fix by creating the file. After adding the BlockSamTE class, cleaning it up a bit, and adding the most basic constructor to remove all of the errors, the class should look like Listing 12.1.

LISTING 12.1 The Basic BlockSamTE Class

package com.wuppy.samsmod;import net.minecraft.block.Block;import net.minecraft.block.material.Material; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required