From 03ca8bde35e168b0ec4d04c4a02bbfb9fe3eb762 Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Tue, 17 Sep 2013 16:14:00 -0400 Subject: [PATCH] Fixed nbt and meta recipe output issue meta for recipes that had no defined meta was getting set to max meta value. This catches on that and sets its to zero. Later after i work out other bugs i'll flip this to being random to allow for more complex salvaging. --- src/dark/api/ProcessorRecipes.java | 11 ++++++++--- src/dark/core/prefab/helpers/AutoCraftingManager.java | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/dark/api/ProcessorRecipes.java b/src/dark/api/ProcessorRecipes.java index 96b3c66c..2181a225 100644 --- a/src/dark/api/ProcessorRecipes.java +++ b/src/dark/api/ProcessorRecipes.java @@ -6,6 +6,7 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import dark.core.prefab.helpers.AutoCraftingManager; import dark.core.prefab.helpers.Pair; @@ -152,11 +153,15 @@ public class ProcessorRecipes { if (recipeList[i] != null && random.nextFloat() >= chance) { - if (recipeList[i].getItemDamage() == 32767) + int meta = recipeList[i].getItemDamage(); + NBTTagCompound tag = recipeList[i].getTagCompound(); + if (recipeList[i].itemID < Block.blocksList.length && Block.blocksList[recipeList[i].itemID] != null && recipeList[i].getItemDamage() > 16) { - recipeList[i] = new ItemStack(recipeList[i].itemID, recipeList[i].stackSize, recipeList[i].getItemDamage()); + meta = 0; + } - reList[i] = recipeList[i]; + reList[i] = new ItemStack(recipeList[i].itemID, recipeList[i].stackSize, meta); + reList[i].setTagCompound(tag); } } } diff --git a/src/dark/core/prefab/helpers/AutoCraftingManager.java b/src/dark/core/prefab/helpers/AutoCraftingManager.java index f1097b6f..40685a9e 100644 --- a/src/dark/core/prefab/helpers/AutoCraftingManager.java +++ b/src/dark/core/prefab/helpers/AutoCraftingManager.java @@ -351,7 +351,7 @@ public class AutoCraftingManager if (checkStack != null) { this.printDebug("ResourceChecker", " -----Item in slot0" + i + " = " + checkStack.toString()); - if (this.areStacksEqual(recipeItem, checkStack)) + if (AutoCraftingManager.areStacksEqual(recipeItem, checkStack)) { this.printDebug("ResourceChecker", "Found matching item " + checkStack.toString()); return i;