Hi everyone! I write mod for minecraft forge 1.12.2 and use them on my minecraft server with spongeforge. On clear server all good, but with this plugin NBT sync crushes (screenshot).
Code of sync:
public SPacketUpdateTileEntity getUpdatePacket()
{
NBTTagCompound nbt = new NBTTagCompound();
this.writeToNBT(nbt);
int metadata = getBlockMetadata();
return new SPacketUpdateTileEntity(this.pos, metadata, nbt);
}
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
{
this.readFromNBT(pkt.getNbtCompound());
}
@Override
public NBTTagCompound getUpdateTag()
{
NBTTagCompound nbt = new NBTTagCompound();
this.writeToNBT(nbt);
return nbt;
}
@Override
public void handleUpdateTag(NBTTagCompound tag)
{
this.readFromNBT(tag);
}
@Override
public NBTTagCompound getTileData()
{
NBTTagCompound nbt = new NBTTagCompound();
this.writeToNBT(nbt);![crush|690x442](upload://irwPImvKffcTPC8DpIKVOFn8c7m.jpeg)
return nbt;
}
Code of NBT functions:
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
{
tagCompound.setString(key, this.getOwner());
return super.writeToNBT(tagCompound);
}
@Override
public void readFromNBT(NBTTagCompound tagCompound)
{
this.owner = tagCompound.getString(key);
super.readFromNBT(tagCompound);
}