CapacitorHelper.java 文件源码

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

项目:EnderIO 作者:
protected static @Nullable ICapacitorData getNBTCapacitorDataFromItemStack(@Nonnull ItemStack stack) {
  final NBTTagCompound nbtRoot = stack.getTagCompound();
  if (nbtRoot == null) {
    return null;
  }
  if (!nbtRoot.hasKey("eiocap", (new NBTTagCompound()).getId())) {
    return null;
  }
  final NBTTagCompound nbtTag = nbtRoot.getCompoundTag("eiocap");
  if (!nbtTag.hasKey("level", (new NBTTagFloat(0)).getId())) {
    return null;
  }
  final float capLevel = nbtTag.getFloat("level");
  if (capLevel < 0 || capLevel >= 10) {
    return null;
  }
  return new NBTCapacitorData(stack.getItem().getUnlocalizedName(stack), capLevel, nbtTag);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号