net.minecraft.item.Item.getNBTShareTag()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中net.minecraft.item.Item.getNBTShareTag()方法的一些代码示例,展示了Item.getNBTShareTag()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Item.getNBTShareTag()方法的具体详情如下:
包路径:net.minecraft.item.Item
类名称:Item
方法名:getNBTShareTag

Item.getNBTShareTag介绍

暂无

代码示例

代码示例来源:origin: raoulvdberge/refinedstorage

public static void writeItemStack(ByteBuf buf, ItemStack stack) {
  buf.writeInt(Item.getIdFromItem(stack.getItem()));
  buf.writeInt(stack.getCount());
  buf.writeShort(stack.getItemDamage());
  ByteBufUtils.writeTag(buf, stack.getItem().getNBTShareTag(stack));
}

代码示例来源:origin: WayofTime/BloodMagic

@Nonnull
  @Override
  public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) {
    TileMimic mimic = (TileMimic) te;
    ItemStack mimiced = mimic.getStackInSlot(0);
    if (!mimiced.isEmpty()) {
      NBTTagCompound item = new NBTTagCompound();
      item.setString("id", mimiced.getItem().getRegistryName().toString());
      item.setInteger("data", mimiced.getMetadata());
      NBTTagCompound shareTag = mimiced.getItem().getNBTShareTag(mimiced);
      if (shareTag != null)
        item.setTag("nbt", shareTag);

      tag.setTag("mimiced", item);
    }
    return tag;
  }
}

相关文章

微信公众号

最新文章

更多