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

Server Synchronization

Another important thing a tile entity can do is synchronize with the server and, therefore, interact with the player. The player interaction and server synchronization for this tile entity is simple. When the block is right-clicked, the counter that switches the metadata stops until it’s right-clicked again. Because this changes how the block works, this has to be synchronized between the server and the client.

The first thing required for this is a Boolean that is checked to see if the counter should change. The variable should look like this:

private boolean counterEnabled = true;

This variable should also be used in the updateEntity method to make sure the counter is only enabled when this ...

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