Posted August 21, 20169 yr I see getDescriptionPacket no longer exists. How do we synchronize the client with the server now?
August 21, 20169 yr 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.