TileEntitySpecialRender; Using the TE to update rendering

So today I came across a little conundrum when trying to rely upon a variable in my Tile Entity to decide on whether to render part of the model. Luckily, I fond my answer on the Minecraft Forums and thought it might be helpful to post.

What you need before doing this:
– A basic mod class
– A Tile Entity and Tile Entity Special Renderer

First, go into your Tile Class and add the following:

public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) {
NBTTagCompound tagCom = pkt.data;

public Packet getDescriptionPacket() {
NBTTagCompound tagCom = new NBTTagCompound();
return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tagCom);

That will allow us to sync the client and server later.
Next, open your TESR (TileEntitySpecialRenderer) and add this line of code at the very very beginning of the renderTileEntityAt function.

tileEnt.worldObj.scheduleBlockUpdate(tileEnt.xCoord, tileEnt.yCoord, tileEnt.zCoord, Tele.teleporterBase.blockID, 10);

That will schedule the update that we just prepared in the TileEntity class. Now when the rendering occurs, it will be able to actively pull data from an up-to-date TileEntity. For example, you can now say (in the renderTileEntityAt function):

if (tileEnt.getStackInSlot(0) != null) {do something}

One thought on “TileEntitySpecialRender; Using the TE to update rendering”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

The main site for many things, including Minecraft & Mods, Doctor Who, among other things.

%d bloggers like this: