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);
}
CapacitorHelper.java 文件源码
java
阅读 19
收藏 0
点赞 0
评论 0
项目:EnderIO
作者:
评论列表
文章目录