From 9c0f0fa1119dcf4e3c2dfc1bf5bcaa1e554b4294 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Mon, 6 Jun 2016 19:52:46 +0100 Subject: [PATCH] Started work on the recipe links --- .../java/techreborn/compat/CompatManager.java | 2 + .../techreborn/compat/ic2/RecipesIC2.java | 37 +++++++++++++++++ .../java/techreborn/init/RecipeCompact.java | 40 +++++++++---------- 3 files changed, 59 insertions(+), 20 deletions(-) create mode 100644 src/main/java/techreborn/compat/ic2/RecipesIC2.java diff --git a/src/main/java/techreborn/compat/CompatManager.java b/src/main/java/techreborn/compat/CompatManager.java index b5afaf1af..a207e4189 100644 --- a/src/main/java/techreborn/compat/CompatManager.java +++ b/src/main/java/techreborn/compat/CompatManager.java @@ -5,6 +5,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import techreborn.client.render.parts.ClientPartLoader; +import techreborn.compat.ic2.RecipesIC2; import techreborn.compat.theoneprobe.CompactTheOneProbe; import techreborn.compat.tinkers.CompatModuleTinkers; import techreborn.compat.waila.CompatModuleWaila; @@ -34,6 +35,7 @@ public class CompatManager registerCompact(CompatModuleTinkers.class, "tconstruct"); registerCompact(CompactTheOneProbe.class, "theoneprobe"); //registerCompact(CompatModulePsi.class, "Psi"); + registerCompact(RecipesIC2.class, "IC2"); } public void registerCompact(Class moduleClass, Object... objs) diff --git a/src/main/java/techreborn/compat/ic2/RecipesIC2.java b/src/main/java/techreborn/compat/ic2/RecipesIC2.java new file mode 100644 index 000000000..3b3939a61 --- /dev/null +++ b/src/main/java/techreborn/compat/ic2/RecipesIC2.java @@ -0,0 +1,37 @@ +package techreborn.compat.ic2; + +import ic2.api.item.IC2Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import reborncore.common.util.CraftingHelper; +import techreborn.compat.ICompatModule; +import techreborn.init.ModBlocks; + +/** + * Created by Mark on 06/06/2016. + */ +public class RecipesIC2 implements ICompatModule { + @Override + public void preInit(FMLPreInitializationEvent event) { + + } + + @Override + public void init(FMLInitializationEvent event) { + CraftingHelper.addShapelessRecipe(new ItemStack(ModBlocks.machineframe, 0, 1), IC2Items.getItem("resource","machine")); + CraftingHelper.addShapelessRecipe( IC2Items.getItem("resource","machine"), new ItemStack(ModBlocks.machineframe, 0, 1)); + } + + @Override + public void postInit(FMLPostInitializationEvent event) { + + } + + @Override + public void serverStarting(FMLServerStartingEvent event) { + + } +} diff --git a/src/main/java/techreborn/init/RecipeCompact.java b/src/main/java/techreborn/init/RecipeCompact.java index 8143d6bd0..8a5111f2c 100644 --- a/src/main/java/techreborn/init/RecipeCompact.java +++ b/src/main/java/techreborn/init/RecipeCompact.java @@ -108,26 +108,26 @@ public class RecipeCompact implements IRecipeCompact { init(); } -// if(Loader.isModLoaded("IC2")){ -// ItemStack stack = IC2Items.getItem(name); -// if(stack == null){ -// if(lookupHashMap.containsKey(name)){ -// Ic2ItemLookup lookup = lookupHashMap.get(name); -// if(lookup.getStack() != null){ -// return lookup.getStack(); -// } -// return IC2Items.getItem(lookup.getName(), lookup.getVariant()); -// } else { -// String line = "IC2:" + name; -// if (!missingItems.contains(line)) -// { -// missingItems.add(line); -// } -// } -// } else { -// return stack; -// } -// } + if(Loader.isModLoaded("IC2")){ + ItemStack stack = IC2Items.getItem(name); + if(stack == null){ + if(lookupHashMap.containsKey(name)){ + Ic2ItemLookup lookup = lookupHashMap.get(name); + if(lookup.getStack() != null){ + return lookup.getStack(); + } + return IC2Items.getItem(lookup.getName(), lookup.getVariant()); + } else { + String line = "IC2:" + name; + if (!missingItems.contains(line)) + { + missingItems.add(line); + } + } + } else { + return stack; + } + } if (!recipes.containsKey(name)) { if (!missingItems.contains(name))