From a40df67004dc02c502f7b07d8fe7e6349273514c Mon Sep 17 00:00:00 2001 From: Nedelosk Date: Sat, 19 Aug 2017 00:04:23 +0200 Subject: [PATCH] [1.12] Fix wood plank ore dictionary recipes (#4310) --- .../minecraftforge/oredict/OreDictionary.java | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minecraftforge/oredict/OreDictionary.java b/src/main/java/net/minecraftforge/oredict/OreDictionary.java index 5718078d5..b34966650 100644 --- a/src/main/java/net/minecraftforge/oredict/OreDictionary.java +++ b/src/main/java/net/minecraftforge/oredict/OreDictionary.java @@ -60,6 +60,7 @@ import javax.annotation.Nonnull; public class OreDictionary { + private static final boolean DEBUG = false; private static boolean hasInit = false; private static List idToName = new ArrayList(); private static Map nameToId = new HashMap(128); @@ -222,7 +223,12 @@ public class OreDictionary // wood-related things replacements.put(new ItemStack(Items.STICK), "stickWood"); - replacements.put(new ItemStack(Blocks.PLANKS), "plankWood"); + replacements.put(new ItemStack(Blocks.PLANKS, 1, 0), "plankWood"); + replacements.put(new ItemStack(Blocks.PLANKS, 1, 1), "plankWood"); + replacements.put(new ItemStack(Blocks.PLANKS, 1, 2), "plankWood"); + replacements.put(new ItemStack(Blocks.PLANKS, 1, 3), "plankWood"); + replacements.put(new ItemStack(Blocks.PLANKS, 1, 4), "plankWood"); + replacements.put(new ItemStack(Blocks.PLANKS, 1, 5), "plankWood"); replacements.put(new ItemStack(Blocks.PLANKS, 1, WILDCARD_VALUE), "plankWood"); replacements.put(new ItemStack(Blocks.WOODEN_SLAB, 1, WILDCARD_VALUE), "slabWood"); @@ -330,8 +336,8 @@ public class OreDictionary new ItemStack(Blocks.SPRUCE_FENCE), new ItemStack(Blocks.SPRUCE_FENCE_GATE), new ItemStack(Blocks.SPRUCE_STAIRS), - new ItemStack(Blocks.BIRCH_STAIRS), new ItemStack(Blocks.BIRCH_FENCE_GATE), + new ItemStack(Blocks.BIRCH_FENCE), new ItemStack(Blocks.BIRCH_STAIRS), new ItemStack(Blocks.JUNGLE_FENCE), new ItemStack(Blocks.JUNGLE_FENCE_GATE), @@ -342,14 +348,25 @@ public class OreDictionary new ItemStack(Blocks.DARK_OAK_FENCE), new ItemStack(Blocks.DARK_OAK_FENCE_GATE), new ItemStack(Blocks.DARK_OAK_STAIRS), - new ItemStack(Blocks.WOODEN_SLAB), + new ItemStack(Blocks.WOODEN_SLAB, 1, WILDCARD_VALUE), new ItemStack(Blocks.GLASS_PANE), new ItemStack(Blocks.BONE_BLOCK), // Bone Block, to prevent conversion of dyes into bone meal. new ItemStack(Items.BOAT), + new ItemStack(Items.SPRUCE_BOAT), + new ItemStack(Items.BIRCH_BOAT), + new ItemStack(Items.JUNGLE_BOAT), + new ItemStack(Items.ACACIA_BOAT), + new ItemStack(Items.DARK_OAK_BOAT), new ItemStack(Items.OAK_DOOR), + new ItemStack(Items.SPRUCE_DOOR), + new ItemStack(Items.BIRCH_DOOR), + new ItemStack(Items.JUNGLE_DOOR), + new ItemStack(Items.ACACIA_DOOR), + new ItemStack(Items.DARK_OAK_DOOR), ItemStack.EMPTY //So the above can have a comma and we don't have to keep editing extra lines. }; + FMLLog.log.info("Starts to replace vanilla recipe ingredients with ore ingredients."); int replaced = 0; // Search vanilla recipes for recipes to replace for(IRecipe obj : CraftingManager.REGISTRY) @@ -357,11 +374,12 @@ public class OreDictionary if(obj.getClass() == ShapedRecipes.class || obj.getClass() == ShapelessRecipes.class) { ItemStack output = obj.getRecipeOutput(); - if (!output.isEmpty() && containsMatch(false, exclusions, output)) + if (!output.isEmpty() && containsMatch(false, new ItemStack[]{ output }, exclusions)) { continue; } + Set replacedIngs = new HashSet<>(); NonNullList lst = obj.getIngredients(); for (int x = 0; x < lst.size(); x++) { @@ -405,6 +423,11 @@ public class OreDictionary //Replace! lst.set(x, new OreIngredient(oreName)); replaced++; + if(DEBUG && replacedIngs.add(ing)) + { + String recipeName = obj.getRegistryName().getResourcePath(); + FMLLog.log.debug("Replaced {} of the recipe \'{}\' with \"{}\".", ing.getMatchingStacks(), recipeName, oreName); + } } } }