From 087f93d5b8f2cdf30690f6eeac63bb8aecf63d61 Mon Sep 17 00:00:00 2001 From: TehNut Date: Fri, 28 Aug 2015 15:59:34 -0700 Subject: [PATCH] Should (finally) solve #19 and #23 --- .../morechisels/item/chisel/ItemChiselGem.java | 5 +++++ .../tehnut/morechisels/registry/ItemRegistry.java | 15 ++------------- .../morechisels/registry/RecipeRegistry.java | 7 +------ 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/main/java/tehnut/morechisels/item/chisel/ItemChiselGem.java b/src/main/java/tehnut/morechisels/item/chisel/ItemChiselGem.java index 699799b..6667a98 100644 --- a/src/main/java/tehnut/morechisels/item/chisel/ItemChiselGem.java +++ b/src/main/java/tehnut/morechisels/item/chisel/ItemChiselGem.java @@ -1,5 +1,6 @@ package tehnut.morechisels.item.chisel; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; @@ -8,6 +9,7 @@ import net.minecraft.util.StatCollector; import tehnut.morechisels.ModInformation; import tehnut.morechisels.item.ItemChiselBase; +import tehnut.morechisels.registry.RecipeRegistry; import tehnut.morechisels.util.Utils; import java.awt.*; @@ -26,6 +28,9 @@ public ItemChiselGem(String name, int durability, String hexColor, boolean setDi this.setDisplayName = setDisplayName; this.name = name; this.hexColor = hexColor; + + GameRegistry.registerItem(this, "ItemChiselGem" + name); + RecipeRegistry.addConfiguredChiselRecipe(this, "gem" + name, true); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/tehnut/morechisels/registry/ItemRegistry.java b/src/main/java/tehnut/morechisels/registry/ItemRegistry.java index e7da63a..e98ecc3 100644 --- a/src/main/java/tehnut/morechisels/registry/ItemRegistry.java +++ b/src/main/java/tehnut/morechisels/registry/ItemRegistry.java @@ -7,16 +7,8 @@ import tehnut.morechisels.item.chisel.ItemChiselGem; public class ItemRegistry { - - // Items - public static Item chiselGem[]; - - public static int gemChiselCount = 0; - public static void registerItems() { // Gems - chiselGem = new Item[ConfigHandler.gemChiselWhitelist.length]; - for (String ore : OreDictionary.getOreNames()) { if (ore.startsWith("gem")) { String gem = ore.substring(3); @@ -24,11 +16,8 @@ public static void registerItems() { for (String whitelist : ConfigHandler.gemChiselWhitelist) { String[] splitWhitelist = whitelist.split(":"); - if (gem.equals(splitWhitelist[0])) { - chiselGem[gemChiselCount] = new ItemChiselGem(splitWhitelist[0], Integer.parseInt(splitWhitelist[1]), splitWhitelist[2], true); - registerOreItem(chiselGem[gemChiselCount], "ItemChisel" + splitWhitelist[0], "gem" + splitWhitelist[0]); - gemChiselCount++; - } + if (gem.equals(splitWhitelist[0])) + new ItemChiselGem(splitWhitelist[0], Integer.parseInt(splitWhitelist[1]), splitWhitelist[2], true); } } } diff --git a/src/main/java/tehnut/morechisels/registry/RecipeRegistry.java b/src/main/java/tehnut/morechisels/registry/RecipeRegistry.java index 49d1138..89a9342 100644 --- a/src/main/java/tehnut/morechisels/registry/RecipeRegistry.java +++ b/src/main/java/tehnut/morechisels/registry/RecipeRegistry.java @@ -7,16 +7,11 @@ import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import team.chisel.config.Configurations; -import tehnut.morechisels.ConfigHandler; public class RecipeRegistry { public static void registerRecipes() { - for (int i = 0; i < ItemRegistry.chiselGem.length; i++) { - String[] gemType = ConfigHandler.gemChiselWhitelist[i].split(":"); - - addConfiguredChiselRecipe(ItemRegistry.chiselGem[i], "gem" + gemType[0], true); - } + // Do stuff } /**