Started work on the recipe links

This commit is contained in:
modmuss50 2016-06-06 19:52:46 +01:00
parent 973f68496c
commit 9c0f0fa111
3 changed files with 59 additions and 20 deletions

View file

@ -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<? extends ICompatModule> moduleClass, Object... objs)

View file

@ -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) {
}
}

View file

@ -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))