From adf9b8c0e41b47b48c93a1d753ede1c378a728d2 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sat, 16 Jul 2016 22:16:22 +0100 Subject: [PATCH] Fix #676 --- build.gradle | 2 +- src/main/java/techreborn/init/IC2Dict.java | 84 +++++++++++++++++++ src/main/java/techreborn/init/ModRecipes.java | 3 + src/main/java/techreborn/init/OreDict.java | 71 +--------------- 4 files changed, 89 insertions(+), 71 deletions(-) create mode 100644 src/main/java/techreborn/init/IC2Dict.java diff --git a/build.gradle b/build.gradle index 5b9dda777..f5709c245 100644 --- a/build.gradle +++ b/build.gradle @@ -64,7 +64,7 @@ configurations { } -version = "1.3.3" +version = "1.3.4" def ENV = System.getenv() if (ENV.BUILD_NUMBER) { diff --git a/src/main/java/techreborn/init/IC2Dict.java b/src/main/java/techreborn/init/IC2Dict.java new file mode 100644 index 000000000..6e368b07e --- /dev/null +++ b/src/main/java/techreborn/init/IC2Dict.java @@ -0,0 +1,84 @@ +package techreborn.init; + +import ic2.core.block.BlockIC2Fence; +import ic2.core.block.BlockTexGlass; +import ic2.core.block.type.ResourceBlock; +import ic2.core.item.type.CraftingItemType; +import ic2.core.item.type.MiscResourceType; +import ic2.core.item.type.NuclearResourceType; +import ic2.core.ref.BlockName; +import ic2.core.ref.ItemName; +import ic2.core.ref.TeBlock; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; +import techreborn.Core; + +/** + * Created by modmuss50 on 16/07/2016. + */ +public class IC2Dict { + + public static void init() { + try { + CraftingItemType.circuit.getName(); + + OreDictionary.registerOre("reBattery", ItemName.re_battery.getItemStack()); + + OreDictionary.registerOre("circuitBasic", ItemName.crafting.getItemStack(CraftingItemType.circuit)); + OreDictionary.registerOre("circuitAdvanced", ItemName.crafting.getItemStack(CraftingItemType.advanced_circuit)); + + + OreDictionary.registerOre("machineBlockBasic", BlockName.resource.getItemStack(ResourceBlock.machine)); + OreDictionary.registerOre("machineBlockAdvanced", BlockName.resource.getItemStack(ResourceBlock.advanced_machine)); + + OreDictionary.registerOre("lapotronCrystal", ItemName.lapotron_crystal.getItemStack()); + OreDictionary.registerOre("energyCrystal", ItemName.lapotron_crystal.getItemStack()); + + OreDictionary.registerOre("drillBasic", ItemName.drill.getItemStack()); + OreDictionary.registerOre("drillDiamond", ItemName.diamond_drill.getItemStack()); + OreDictionary.registerOre("drillAdvanced", ItemName.iridium_drill.getItemStack()); + + ItemStack industrialTnt = BlockName.te.getItemStack(TeBlock.itnt); + industrialTnt.setItemDamage(1); + OreDictionary.registerOre("industrialTnt", industrialTnt); + + OreDictionary.registerOre("craftingIndustrialDiamond", ItemName.crafting.getItemStack(CraftingItemType.industrial_diamond)); + OreDictionary.registerOre("fertilizer", ItemName.crafting.getItemStack(CraftingItemType.bio_chaff)); + OreDictionary.registerOre("hvTransformer", BlockName.te.getItemStack(TeBlock.hv_transformer)); + + //TODO: + + //OreDictionary.registerOre("insulatedGoldCableItem", BlockName.te.getItemStack(CableType.gold)); + + //OreDictionary.registerOre("ic2Generator", ModBlocks.Generator); + //OreDictionary.registerOre("ic2SolarPanel", ModBlocks.solarPanel); + //OreDictionary.registerOre("ic2Macerator", ModBlocks.Grinder); + //OreDictionary.registerOre("ic2Extractor", ModBlocks.Extractor); + //OreDictionary.registerOre("ic2Windmill", ModBlocks.windMill); + //OreDictionary.registerOre("ic2Watermill", ModBlocks.waterMill); + + OreDictionary.registerOre("uran235", ItemName.nuclear.getItemStack(NuclearResourceType.uranium_235)); + OreDictionary.registerOre("uran238", ItemName.nuclear.getItemStack(NuclearResourceType.uranium_238)); + OreDictionary.registerOre("smallUran238", ItemName.nuclear.getItemStack(NuclearResourceType.small_uranium_238)); + OreDictionary.registerOre("smallUran235", ItemName.nuclear.getItemStack(NuclearResourceType.small_uranium_235)); + + OreDictionary.registerOre("fenceIron", BlockName.fence.getItemStack(BlockIC2Fence.IC2FenceType.iron)); + OreDictionary.registerOre("rubberWood", BlockName.rubber_wood.getItemStack()); + OreDictionary.registerOre("glassReinforced", BlockName.glass.getItemStack(BlockTexGlass.GlassType.reinforced)); + + OreDictionary.registerOre("oreIridium", ItemName.misc_resource.getItemStack(MiscResourceType.iridium_ore)); + } catch (NoClassDefFoundError notFound) { + Core.logHelper.warn( + "Can't enable integration: IC2 installed but cannot be hooked\n" + + "Do you use incompatible IC2 version?\n" + + "Please create issue on github and provide FULL LOG and mod list"); + } catch (Throwable error) { + Core.logHelper.warn( + "Exception thrown during IC2 integration init\n" + + "Do you use incompatible IC2 version?\n" + + "Please create issue on github and provide FULL LOG and mod list.\n" + + "Error stack trace: "); + error.printStackTrace(); + } + } +} diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 9aba2db53..f2b5715aa 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -3506,6 +3506,9 @@ public class ModRecipes } public static ItemStack getOre(String name) { + if(OreDictionary.getOres(name).isEmpty()){ + return new ItemStack(ModItems.missingRecipe); + } return OreDictionary.getOres(name).get(0).copy(); } diff --git a/src/main/java/techreborn/init/OreDict.java b/src/main/java/techreborn/init/OreDict.java index 995e0ede7..097a44df7 100644 --- a/src/main/java/techreborn/init/OreDict.java +++ b/src/main/java/techreborn/init/OreDict.java @@ -1,15 +1,6 @@ package techreborn.init; import com.google.common.collect.ImmutableList; -import ic2.core.block.BlockIC2Fence; -import ic2.core.block.BlockTexGlass; -import ic2.core.block.type.ResourceBlock; -import ic2.core.item.type.CraftingItemType; -import ic2.core.item.type.MiscResourceType; -import ic2.core.item.type.NuclearResourceType; -import ic2.core.ref.BlockName; -import ic2.core.ref.ItemName; -import ic2.core.ref.TeBlock; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -33,67 +24,7 @@ public class OreDict { public static void init() { if(Loader.isModLoaded("IC2")) { Core.logHelper.info("IC2 installed, enabling integration"); - try { - CraftingItemType.circuit.getName(); - - OreDictionary.registerOre("reBattery", ItemName.re_battery.getItemStack()); - - OreDictionary.registerOre("circuitBasic", ItemName.crafting.getItemStack(CraftingItemType.circuit)); - OreDictionary.registerOre("circuitAdvanced", ItemName.crafting.getItemStack(CraftingItemType.advanced_circuit)); - - - OreDictionary.registerOre("machineBlockBasic", BlockName.resource.getItemStack(ResourceBlock.machine)); - OreDictionary.registerOre("machineBlockAdvanced", BlockName.resource.getItemStack(ResourceBlock.advanced_machine)); - - OreDictionary.registerOre("lapotronCrystal", ItemName.lapotron_crystal.getItemStack()); - OreDictionary.registerOre("energyCrystal", ItemName.lapotron_crystal.getItemStack()); - - OreDictionary.registerOre("drillBasic", ItemName.drill.getItemStack()); - OreDictionary.registerOre("drillDiamond", ItemName.diamond_drill.getItemStack()); - OreDictionary.registerOre("drillAdvanced", ItemName.iridium_drill.getItemStack()); - - ItemStack industrialTnt = BlockName.te.getItemStack(TeBlock.itnt); - industrialTnt.setItemDamage(1); - OreDictionary.registerOre("industrialTnt", industrialTnt); - - OreDictionary.registerOre("craftingIndustrialDiamond", ItemName.crafting.getItemStack(CraftingItemType.industrial_diamond)); - OreDictionary.registerOre("fertilizer", ItemName.crafting.getItemStack(CraftingItemType.bio_chaff)); - OreDictionary.registerOre("hvTransformer", BlockName.te.getItemStack(TeBlock.hv_transformer)); - - //TODO: - - //OreDictionary.registerOre("insulatedGoldCableItem", BlockName.te.getItemStack(CableType.gold)); - - //OreDictionary.registerOre("ic2Generator", ModBlocks.Generator); - //OreDictionary.registerOre("ic2SolarPanel", ModBlocks.solarPanel); - //OreDictionary.registerOre("ic2Macerator", ModBlocks.Grinder); - //OreDictionary.registerOre("ic2Extractor", ModBlocks.Extractor); - //OreDictionary.registerOre("ic2Windmill", ModBlocks.windMill); - //OreDictionary.registerOre("ic2Watermill", ModBlocks.waterMill); - - OreDictionary.registerOre("uran235", ItemName.nuclear.getItemStack(NuclearResourceType.uranium_235)); - OreDictionary.registerOre("uran238", ItemName.nuclear.getItemStack(NuclearResourceType.uranium_238)); - OreDictionary.registerOre("smallUran238", ItemName.nuclear.getItemStack(NuclearResourceType.small_uranium_238)); - OreDictionary.registerOre("smallUran235", ItemName.nuclear.getItemStack(NuclearResourceType.small_uranium_235)); - - OreDictionary.registerOre("fenceIron", BlockName.fence.getItemStack(BlockIC2Fence.IC2FenceType.iron)); - OreDictionary.registerOre("rubberWood", BlockName.rubber_wood.getItemStack()); - OreDictionary.registerOre("glassReinforced", BlockName.glass.getItemStack(BlockTexGlass.GlassType.reinforced)); - - OreDictionary.registerOre("oreIridium", ItemName.misc_resource.getItemStack(MiscResourceType.iridium_ore)); - } catch (NoClassDefFoundError notFound) { - Core.logHelper.warn( - "Can't enable integration: IC2 installed but cannot be hooked\n" + - "Do you use incompatible IC2 version?\n" + - "Please create issue on github and provide FULL LOG and mod list"); - } catch (Throwable error) { - Core.logHelper.warn( - "Exception thrown during IC2 integration init\n" + - "Do you use incompatible IC2 version?\n" + - "Please create issue on github and provide FULL LOG and mod list.\n" + - "Error stack trace: "); - error.printStackTrace(); - } + IC2Dict.init(); } OreDictionary.registerOre("reBattery", ModItems.reBattery);