Jump to content

Recommended Posts

Posted

I am working on TileEntity and need to sync data between the client and the server. I think that I have gotten everything working, with one possible exception:

 

I cannot get it to sync whenever the block changes. According to outdated information, I need to use World#markBlockForUpdate, which appears to no longer exist. What do I use to replace it?

 

And is there a resource that I can use to find out where everything moves since outdated versions? I feel like I am missing some important trove of information.

 

Edit: Aparantly I just need to call this.markDirty()..? Well, maybe. Aparantly I am now getting packets of some description. The packet contains NBT data which is valid when it leaves. Sadly the NBT is gone when it arrives. Code below

 

@Override
public Packet<?> getDescriptionPacket()
{
NBTTagCompound tag = new NBTTagCompound();
if (this.hasStoredBlock())
{
	NBTTagCompound stored = new NBTTagCompound();
	stored.setString("name", storedBlock.getItem().getRegistryName().toString());
	stored.setInteger("meta", storedBlock.getItemDamage());
	stored.setInteger("amount", storeAmount);
	tag.setTag("storedBlock", stored);
}
return new SPacketUpdateTileEntity(this.getPos(), this.getBlockMetadata(), tag);
}

@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
{
System.out.println(pkt.getNbtCompound().toString());
}

  • 1 year later...
  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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