So after realizing what I had to do to sync the server with the client, I worked my way up to this:
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
//Debug
System.out.println("[DEBUG]:Server sent tile sync packet");
NBTTagCompound tagCompound = new NBTTagCompound();
this.writeToNBT(tagCompound);
return new SPacketUpdateTileEntity(pos, 1, tagCompound);
}
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
//Debug
System.out.println("[DEBUG]:Client recived tile sync packet");
readFromNBT(pkt.getNbtCompound());
}
Now the problem I'm having is that I can't get these to put out the debug messages. (aka. get them to work)
I have a block that I tried to use these methods in by calling markDirty() when you "activate" it however its "counterpart" thingy, world.markBlockForUpdate or whatever doesn't exist, or was renamed and I can't find anything like it. Therefor it won't print out the debug messages aka run the methods. What is the new method called, or what do I have to do?
Rollback Post to RevisionRollBack
The creator of Oria (comming soon (don't count on it (undertale reference)))
TileEntity data is now sent with the chunk as well as in the update packet.
Override TileEntity#getUpdateTag to write the data that needs syncing to a compound tag and return it. Override TileEntity#getUpdatePacket to create and return a SPacketUpdateTileEntity with the tag returned by TileEntity#getUpdateTag.
World#markBlockForUpdate was replaced by World#notifyBlockUpdate.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
TileEntity data is now sent with the chunk as well as in the update packet.
Override TileEntity#getUpdateTag to write the data that needs syncing to a compound tag and return it. Override TileEntity#getUpdatePacket to create and return a SPacketUpdateTileEntity with the tag returned by TileEntity#getUpdateTag.
World#markBlockForUpdate was replaced by World#notifyBlockUpdate.
Uh I already "Override TileEntity#getUpdatePacket to create and return a SPacketUpdateTileEntity with the tag returned by TileEntity#getUpdateTag." in the code in my original post, but I'll try the getUpdateTag instead of onPacketData.
-YES! Thanks a ton! it works perfectly. The problem was I used onDataPacket instead of getUpdateTag
Uh I already "Override TileEntity#getUpdatePacket to create and return a SPacketUpdateTileEntity with the tag returned by TileEntity#getUpdateTag." in the code in my original post, but I'll try the getUpdateTag instead of onPacketData.
-YES! Thanks a ton! it works perfectly. The problem was I used onDataPacket instead of getUpdateTag
You weren't using TileEntity#getUpdateTag in your original code. The tag returned by this method is sent with the chunk and should also be sent with the individual packet.
TileEntity#onDataPacket is still required to read the NBT on the client side.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
You weren't using TileEntity#getUpdateTag in your original code. The tag returned by this method is sent with the chunk and should also be sent with the individual packet.
TileEntity#onDataPacket is still required to read the NBT on the client side.
yeah I know I wasn't using getUpdateTag in my code. Thats what I said. But why do I need onDataPacket? It still works without it.
Rollback Post to RevisionRollBack
The creator of Oria (comming soon (don't count on it (undertale reference)))
yeah I know I wasn't using getUpdateTag in my code. Thats what I said. But why do I need onDataPacket? It still works without it.
Without onDataPacket, only the initial data sent with the chunk will be read. Any data sent in an SPacketTileEntity after that won't be read.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
ok, I understand. What data would be sent in it though?
The update tag and update packet should send the same data (whatever is needed on the client), but at different times.
When a chunk is first sent to the client, the packet (SPacketChunkData) includes the update tag of every TileEntity in the chunk.
When a single TileEntity needs to sync its data to the client, it calls World#notifyBlockUpdate to send its update packet.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
So after realizing what I had to do to sync the server with the client, I worked my way up to this:
Now the problem I'm having is that I can't get these to put out the debug messages. (aka. get them to work)
I have a block that I tried to use these methods in by calling markDirty() when you "activate" it however its "counterpart" thingy, world.markBlockForUpdate or whatever doesn't exist, or was renamed and I can't find anything like it. Therefor it won't print out the debug messages aka run the methods. What is the new method called, or what do I have to do?
The creator of Oria (comming soon (don't count on it (undertale reference)))
anyone? I've tried other methods like scheduleBlockUpdate() but they didn't work...
The creator of Oria (comming soon (don't count on it (undertale reference)))
TileEntity data is now sent with the chunk as well as in the update packet.
Override TileEntity#getUpdateTag to write the data that needs syncing to a compound tag and return it. Override TileEntity#getUpdatePacket to create and return a SPacketUpdateTileEntity with the tag returned by TileEntity#getUpdateTag.
World#markBlockForUpdate was replaced by World#notifyBlockUpdate.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Uh I already "Override TileEntity#getUpdatePacket to create and return a SPacketUpdateTileEntity with the tag returned by TileEntity#getUpdateTag." in the code in my original post, but I'll try the getUpdateTag instead of onPacketData.
-YES! Thanks a ton! it works perfectly. The problem was I used onDataPacket instead of getUpdateTag
The creator of Oria (comming soon (don't count on it (undertale reference)))
You weren't using TileEntity#getUpdateTag in your original code. The tag returned by this method is sent with the chunk and should also be sent with the individual packet.
TileEntity#onDataPacket is still required to read the NBT on the client side.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
yeah I know I wasn't using getUpdateTag in my code. Thats what I said. But why do I need onDataPacket? It still works without it.
The creator of Oria (comming soon (don't count on it (undertale reference)))
Without onDataPacket, only the initial data sent with the chunk will be read. Any data sent in an SPacketTileEntity after that won't be read.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
ok, I understand. What data would be sent in it though?
The creator of Oria (comming soon (don't count on it (undertale reference)))
The update tag and update packet should send the same data (whatever is needed on the client), but at different times.
When a chunk is first sent to the client, the packet (SPacketChunkData) includes the update tag of every TileEntity in the chunk.
When a single TileEntity needs to sync its data to the client, it calls World#notifyBlockUpdate to send its update packet.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
ok, thanks.
The creator of Oria (comming soon (don't count on it (undertale reference)))