make storage block /give safe
This commit is contained in:
@@ -23,15 +23,18 @@ public class ItemBlockStorage extends ItemBlockBase
|
|||||||
{
|
{
|
||||||
EnumStorageType type = EnumStorageType.getById(stack.getMetadata());
|
EnumStorageType type = EnumStorageType.getById(stack.getMetadata());
|
||||||
|
|
||||||
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE);
|
if (type != null && stack.getTagCompound() != null && stack.getTagCompound().hasKey(TileStorage.NBT_STORAGE))
|
||||||
|
{
|
||||||
|
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE);
|
||||||
|
|
||||||
if (type == EnumStorageType.TYPE_CREATIVE)
|
if (type == EnumStorageType.TYPE_CREATIVE)
|
||||||
{
|
{
|
||||||
list.add(String.format(StatCollector.translateToLocal("misc.storagecraft:storage.stored"), NBTStorage.getStored(tag)));
|
list.add(String.format(StatCollector.translateToLocal("misc.storagecraft:storage.stored"), NBTStorage.getStored(tag)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
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()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user