From 9803c9e83e306fe682d01dd192f84fce38fd7ee8 Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 12 Nov 2012 17:07:33 -0800 Subject: [PATCH] Added saplings and leaves to the ore dict. PR: #242 --- .../minecraftforge/common/MinecraftForge.java | 2 ++ .../minecraftforge/oredict/OreDictionary.java | 33 +++++++++++++------ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/common/net/minecraftforge/common/MinecraftForge.java b/common/net/minecraftforge/common/MinecraftForge.java index f58e6456d9..5704878026 100644 --- a/common/net/minecraftforge/common/MinecraftForge.java +++ b/common/net/minecraftforge/common/MinecraftForge.java @@ -14,6 +14,7 @@ import net.minecraftforge.common.ForgeHooks.SeedEntry; import net.minecraftforge.event.EventBus; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.EntityEvent; +import net.minecraftforge.oredict.OreDictionary; public class MinecraftForge { @@ -196,6 +197,7 @@ public class MinecraftForge EntityEnderman.carriableBlocks = temp; EVENT_BUS.register(INTERNAL_HANDLER); + OreDictionary.getOreName(0); } public static String getBrandingVersion() diff --git a/common/net/minecraftforge/oredict/OreDictionary.java b/common/net/minecraftforge/oredict/OreDictionary.java index b04e17e5c0..ee5d8aa0fb 100644 --- a/common/net/minecraftforge/oredict/OreDictionary.java +++ b/common/net/minecraftforge/oredict/OreDictionary.java @@ -13,6 +13,7 @@ import net.minecraftforge.event.Event; public class OreDictionary { + private static boolean hasInit = false; private static int maxID = 0; private static HashMap oreIDs = new HashMap(); private static HashMap> oreStacks = new HashMap>(); @@ -23,14 +24,19 @@ public class OreDictionary public static void initVanillaEntries() { - registerOre("logWood", new ItemStack(Block.wood, 1, -1)); - registerOre("plankWood", new ItemStack(Block.planks, 1, -1)); - registerOre("slabWood", new ItemStack(Block.woodSingleSlab, 1, -1)); - registerOre("stairWood", Block.stairCompactPlanks); - registerOre("stairWood", Block.stairsWoodBirch); - registerOre("stairWood", Block.stairsWoodJungle); - registerOre("stairWood", Block.stairsWoodSpruce); - registerOre("stickWood", Item.stick); + if (!hasInit) + { + registerOre("logWood", new ItemStack(Block.wood, 1, -1)); + registerOre("plankWood", new ItemStack(Block.planks, 1, -1)); + registerOre("slabWood", new ItemStack(Block.woodSingleSlab, 1, -1)); + registerOre("stairWood", Block.stairCompactPlanks); + registerOre("stairWood", Block.stairsWoodBirch); + registerOre("stairWood", Block.stairsWoodJungle); + registerOre("stairWood", Block.stairsWoodSpruce); + registerOre("stickWood", Item.stick); + registerOre("treeSapling", new ItemStack(Block.sapling, 1, -1)); + registerOre("treeLeaves", new ItemStack(Block.leaves, 1, -1)); + } // Build our list of items to replace with ore tags Map replacements = new HashMap(); @@ -61,9 +67,13 @@ public class OreDictionary for(int i = 0; i < 16; i++) { ItemStack dye = new ItemStack(Item.dyePowder, 1, i); - registerOre(dyes[i], dye); + if (!hasInit) + { + registerOre(dyes[i], dye); + } replacements.put(dye, dyes[i]); } + hasInit = true; ItemStack[] replaceStacks = replacements.keySet().toArray(new ItemStack[0]); @@ -116,7 +126,10 @@ public class OreDictionary recipes.removeAll(recipesToRemove); recipes.addAll(recipesToAdd); - System.out.println(recipesToRemove.size() + " " + recipesToAdd.size()); + if (recipesToRemove.size() > 0) + { + System.out.println("Replaced " + recipesToRemove.size() + " ore recipies"); + } } /**