@Override
public void handleData(NBTTagCompound data)
{
DimBlockPos dbp = new DimBlockPos();
dbp.deserializeNBT(data.getCompoundTag("blockPosData"));
NBTTagCompound tileData = data.getCompoundTag("tileData");
if (MC.getSide() == Side.CLIENT)
{
VoidApi.proxy.getClientListener().addScheduledTask(() -> {
if (VoidApi.proxy.getClientWorld().isBlockLoaded(dbp.pos) && VoidApi.proxy.getClientWorld().getTileEntity(dbp.pos) != null)
{
Optional.ofNullable(VoidApi.proxy.getClientWorld().getTileEntity(dbp.pos)).ifPresent(t -> t.deserializeNBT(tileData));
}
VoidApi.proxy.getClientWorld().markBlockRangeForRenderUpdate(dbp.pos.down().north().west(), dbp.pos.up().west().south());
});
}
else
{
// Server deserializing a tile from client data?..
WorldServer ws = DimensionManager.getWorld(dbp.dim);
ws.addScheduledTask(() -> {
if (ws.isBlockLoaded(dbp.pos) && ws.getTileEntity(dbp.pos) != null)
{
Optional.ofNullable(ws.getTileEntity(dbp.pos)).ifPresent(t -> t.deserializeNBT(tileData));
}
});
}
}
HandlerTileData.java 文件源码
java
阅读 14
收藏 0
点赞 0
评论 0
项目:VoidApi
作者:
评论列表
文章目录