make storage block /give safe
This commit is contained in:
@@ -23,6 +23,8 @@ public class ItemBlockStorage extends ItemBlockBase
|
|||||||
{
|
{
|
||||||
EnumStorageType type = EnumStorageType.getById(stack.getMetadata());
|
EnumStorageType type = EnumStorageType.getById(stack.getMetadata());
|
||||||
|
|
||||||
|
if (type != null && stack.getTagCompound() != null && stack.getTagCompound().hasKey(TileStorage.NBT_STORAGE))
|
||||||
|
{
|
||||||
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE);
|
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE);
|
||||||
|
|
||||||
if (type == EnumStorageType.TYPE_CREATIVE)
|
if (type == EnumStorageType.TYPE_CREATIVE)
|
||||||
@@ -34,6 +36,7 @@ public class ItemBlockStorage extends ItemBlockBase
|
|||||||
list.add(String.format(StatCollector.translateToLocal("misc.storagecraft:storage.stored_capacity"), NBTStorage.getStored(tag), type.getCapacity()));
|
list.add(String.format(StatCollector.translateToLocal("misc.storagecraft:storage.stored_capacity"), NBTStorage.getStored(tag), type.getCapacity()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreated(ItemStack stack, World world, EntityPlayer player)
|
public void onCreated(ItemStack stack, World world, EntityPlayer player)
|
||||||
|
Reference in New Issue
Block a user