mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-13 00:47:31 +00:00
Make drawers handle unregistered items more gracefully.
This commit is contained in:
1 parent
5332671033
commit
2ec4abc41d
3 files changed
+20
-11
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ buildscript {
|
||||
|
||||
apply plugin: 'forge'
|
||||
|
||||
version = "1.7.10-1.3.6"
|
||||
version = "1.7.10-1.3.7"
|
||||
group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "StorageDrawers"
|
||||
|
||||
|
||||
@@ -490,12 +490,15 @@ public class TileEntityDrawersComp extends TileEntityDrawers
|
||||
@Override
|
||||
public void readFromNBT (int slot, NBTTagCompound tag) {
|
||||
if (tag.hasKey("Item")) {
|
||||
ItemStack stack = new ItemStack(Item.getItemById(tag.getShort("Item")));
|
||||
stack.setItemDamage(tag.getShort("Meta"));
|
||||
if (tag.hasKey("Tags"))
|
||||
stack.setTagCompound(tag.getCompoundTag("Tags"));
|
||||
Item item = Item.getItemById(tag.getShort("Item"));
|
||||
if (item != null) {
|
||||
ItemStack stack = new ItemStack(item);
|
||||
stack.setItemDamage(tag.getShort("Meta"));
|
||||
if (tag.hasKey("Tags"))
|
||||
stack.setTagCompound(tag.getCompoundTag("Tags"));
|
||||
|
||||
protoStack[slot] = stack;
|
||||
protoStack[slot] = stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -161,12 +161,18 @@ public class DrawerData extends BaseDrawerData
|
||||
|
||||
public void readFromNBT (NBTTagCompound tag) {
|
||||
if (tag.hasKey("Item") && tag.hasKey("Count")) {
|
||||
ItemStack stack = new ItemStack(Item.getItemById(tag.getShort("Item")));
|
||||
stack.setItemDamage(tag.getShort("Meta"));
|
||||
if (tag.hasKey("Tags"))
|
||||
stack.setTagCompound(tag.getCompoundTag("Tags"));
|
||||
Item item = Item.getItemById(tag.getShort("Item"));
|
||||
if (item != null) {
|
||||
ItemStack stack = new ItemStack(item);
|
||||
stack.setItemDamage(tag.getShort("Meta"));
|
||||
if (tag.hasKey("Tags"))
|
||||
stack.setTagCompound(tag.getCompoundTag("Tags"));
|
||||
|
||||
setStoredItem(stack, tag.getInteger("Count"), false);
|
||||
setStoredItem(stack, tag.getInteger("Count"), false);
|
||||
}
|
||||
else {
|
||||
reset();
|
||||
}
|
||||
}
|
||||
else {
|
||||
reset();
|
||||
|
||||
Reference in new issue
Block a user