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.

[1.10.2][TileEntity][Client-Server] What replaced getDescriptionPacket?

Featured Replies

Posted

I see getDescriptionPacket no longer exists. How do we synchronize the client with the server now?

  • Author

I think what that link says is inverted

 

about the pair

getUpdateTag()

and

handleUpdateTarget

it is written:

 

Caveat: whatever tag you return must have the position of the TE in the "x" "y" and "z" tags. Otherwise MC doesn't know which TE to apply the packet to since we don't have anything like entity ID's. Any packets whose tags are missing "x" "y" and "z" are silently discarded.

 

The super class methods (in TileEntity) already deal with reading and writing x, y, z, id, and serialize some stuff.

 

About the pair

getUpdatePacket()

and

onDataPacket()

it is said:

Noncaveat: The position of the TE is in the packet, so this compound need not have the TE position

 

It really is, but we have to construct the packet ourselves, because the super method returns null.

 

After reading that short article, what I'm doing is this:

        @Override
public NBTTagCompound getUpdateTag()
{
	NBTTagCompound tag = super.getUpdateTag();
	tag.setString("Target", target);
	return tag;
}

@Override
public void handleUpdateTag(NBTTagCompound tag)
{
	super.handleUpdateTag(tag);
	target = tag.getString("Target");
}

@Override
public SPacketUpdateTileEntity getUpdatePacket()
{
	return new SPacketUpdateTileEntity(pos, getBlockMetadata(), getUpdateTag());
}

@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
{
	if(net.getDirection() == EnumPacketDirection.CLIENTBOUND)
	{
		readFromNBT(pkt.getNbtCompound());
	}
}

 

Is it correct?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.