Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (โ‹ฎ) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Wherever you initialize and register your blocks, you also need to register your tile entity:

GameRegistry.registerTileEntity(YourTileEntity.class, "uniqueTileEntityName");

Are you 100% sure that your data is not saving and loading correctly, and not just that you are not seeing it on the client when you reload? Custom tile entity data is not automatically sent to the client, so if you require your "color" variable, for example, to render your tile entity, of course it will be "reset" when you re-load the world, since the client side doesn't know about the server side values.

ย 

I recommend you first put some debugging statements in your read from NBT method to print the variables stored in there. If those are printing correct values, then you need to add the following two methods to your tile entity class:

@Override
public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
this.writeToNBT(tag);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
}

@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
}

That should synchronize the client-side tile entity when it is loaded from NBT on the server.

  • Author

Wherever you initialize and register your blocks, you also need to register your tile entity:

GameRegistry.registerTileEntity(YourTileEntity.class, "uniqueTileEntityName");

Are you 100% sure that your data is not saving and loading correctly, and not just that you are not seeing it on the client when you reload? Custom tile entity data is not automatically sent to the client, so if you require your "color" variable, for example, to render your tile entity, of course it will be "reset" when you re-load the world, since the client side doesn't know about the server side values.

ย 

I recommend you first put some debugging statements in your read from NBT method to print the variables stored in there. If those are printing correct values, then you need to add the following two methods to your tile entity class:

@Override
public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
this.writeToNBT(tag);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
}

@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
}

That should synchronize the client-side tile entity when it is loaded from NBT on the server.

ย 

ย 

I added those 2 methods and BOOM it worked thanks alot!

I'm always happy to help others!

ย 

Java is not my main programming language but I have alot experience in PHP/HTML/JS/CSS3/C#/SQL

Guest
This topic is now closed to further replies.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions โ†’ Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.