XPBlock.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:GlobalXP 作者:
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
    if(worldIn.isRemote || !stack.hasTagCompound())
        return;

    TileEntity te = worldIn.getTileEntity(pos);

    if(te instanceof TileEntityXPBlock)
    {
        NBTTagCompound tag = stack.getTagCompound().getCompoundTag("BlockEntityTag");

        tag.setInteger("x", pos.getX());
        tag.setInteger("y", pos.getY());
        tag.setInteger("z", pos.getZ());
        ((TileEntityXPBlock)te).readFromNBT(tag);
        ((TileEntityXPBlock)te).markDirty();
        GlobalXP.network.sendToAllAround(new SPacketUpdateXPBlock((TileEntityXPBlock)te), new NetworkRegistry.TargetPoint(worldIn.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 64));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号