From 6be78f4edbe1f5eb4c0ec94a07ed9625f386135e Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Thu, 15 Jan 2015 15:54:57 +0100 Subject: [PATCH] Change material-item-mapping IMC to have the item in an item-subtag like the partbuilder IMC --- src/main/java/tconstruct/util/IMCHandler.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/tconstruct/util/IMCHandler.java b/src/main/java/tconstruct/util/IMCHandler.java index feaf30cc6f2..221855ddc74 100644 --- a/src/main/java/tconstruct/util/IMCHandler.java +++ b/src/main/java/tconstruct/util/IMCHandler.java @@ -202,12 +202,17 @@ else if(type.equals("addMaterialItem")) { NBTTagCompound tag = message.getNBTValue(); - if (!checkRequiredTags("Material Item", tag, "MaterialId", "Value", "id", "Count", "Damage")) + if (!checkRequiredTags("Material Item", tag, "MaterialId", "Value", "Item")) continue; int id = tag.getInteger("MaterialId"); int value = tag.getInteger("Value"); - ItemStack stack = ItemStack.loadItemStackFromNBT(tag); + ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Item")); + + if(stack == null) { + TConstruct.logger.error("Material Item IMC: Item for Material %d is null", id); + continue; + } if(TConstructRegistry.getMaterial(id) == null) { TConstruct.logger.error("Material Item IMC: Material with ID %d does not exist", id);