Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2017
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. @Nullable
  2. @Override
  3. public SPacketUpdateTileEntity getUpdatePacket() {
  4.  
  5. NBTTagCompound data = new NBTTagCompound();
  6. writeToNBT(data);
  7. return new SPacketUpdateTileEntity(this.pos, 1, data);
  8. }
  9.  
  10. @Override
  11. @SideOnly(Side.CLIENT)
  12. public void onDataPacket(NetworkManager networkManager, SPacketUpdateTileEntity s35PacketUpdateTileEntity) {
  13. readFromNBT(s35PacketUpdateTileEntity.getNbtCompound());
  14. worldObj.markBlockRangeForRenderUpdate(this.pos, this.pos);
  15. markForUpdate();
  16. }
  17.  
  18.  
  19. public void markForUpdate() {
  20. if (this.worldObj != null) {
  21. Block block = worldObj.getBlockState(this.pos).getBlock();
  22. this.worldObj.notifyBlockUpdate(this.pos, worldObj.getBlockState(this.pos), worldObj.getBlockState(this.pos), 3);
  23. }
  24. }
  25.  
  26. @Override
  27. public NBTTagCompound getUpdateTag()
  28. {
  29. NBTTagCompound nbtTagCompound = new NBTTagCompound();
  30. writeToNBT(nbtTagCompound);
  31. return nbtTagCompound;
  32. }
  33.  
  34. @Override
  35. public void handleUpdateTag(NBTTagCompound tag)
  36. {
  37. this.readFromNBT(tag);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement