IC2 integration but not dependency

  • Hi,
    I wanted to create a mod with IC2 integration but not dependency. I've tried this:


    Java
    package addedcompat.integration;
    import java.util.logging.Level;
    import ic2.api.item.Items;import net.minecraft.block.Block;import net.minecraft.item.Item;import net.minecraft.item.ItemStack;import net.minecraft.item.crafting.CraftingManager;import net.minecraftforge.oredict.ShapedOreRecipe;import net.minecraftforge.oredict.ShapelessOreRecipe;import addedcompat.common.AddedCompat;import addedcompat.common.CraftingManagerTable;import addedcompat.common.LogHelper;import cpw.mods.fml.common.Loader;
    public class IC2Integration  {	public static void isIC2Installed() {		if(Loader.isModLoaded("IC2")) {			try {				LogHelper.log(Level.INFO, "IC2 integration initialised");				ItemStack energyCrystal = Items.getItem("energyCrystal");				ItemStack lapotronCrystal = Items.getItem("lapotronCrystal");				ItemStack advancedCircuit = Items.getItem("advancedCircuit");				ItemStack lapiDust = Items.getItem("lapiDust");				ItemStack bronzeIngot = Items.getItem("bronzeIngot");
    				CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe((energyCrystal), new Object[] {						"RRR",						"RSR",						"RRR", Character.valueOf('R'), Item.redstone, Character.valueOf('S'), new ItemStack(AddedCompat.metaItemCompat,1,0)					}));										CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe((lapotronCrystal), new Object[] {						"LAL",						"LRL",						"LAL", Character.valueOf('R'), new ItemStack(AddedCompat.metaItemCompat,1,1), Character.valueOf('A'), advancedCircuit, Character.valueOf('L'), lapiDust 					}));										CraftingManagerTable.getInstance().getRecipeList().add(new ShapelessOreRecipe((bronzeIngot), new Object[] {						Block.cobblestone, Item.ingotIron					}));										CraftingManagerTable.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(Item.ingotIron), new Object[] {							Block.cobblestone, bronzeIngot					}));			 }			catch(Exception e) {				LogHelper.log(Level.INFO, "IC2 integration not initialised");				e.printStackTrace(System.err);                        }			}else{		}	}}



    This doesn't seem to work.


    Thanks!

  • Actually instead of getItem maybe try to use addShaped/ShapelessOreRecipe with using oreDict names of IC2 Items ;)
    Because as far as I know, there isnt mod which have same oredict names for items as IC2 have in cases of electric stuff.:) So just, find names in API and use it. Probably it should work and don't forget for Energy Crystals and Lapotron Crystals( also other electric stuff ) added Short.WILDCARD for using all meta's from this items :)


    Edit.: You already added oreRecipes, so just try that WILDCARD values and also, you probably should import required stuff

    public void getForumUserData(Signature signature, User user) { if(user.equalsTo("Cass") && user.isOnline() { Forum.Out.println("signature")})return;}


  • What exactly does not work?
    Also, why are you adding recipes directly to the list? Use GameRegistry.addRecipe(new ShapedOreRecipe(lots of parameters)) or GameRegistry.addRecipe(new ShapelessOreRecipe(lots of parameters)), since that is the official way to do it. Also, by using ShapedOreRecipe and ShapelessOreRecipe you can just enter strings as inputs and they get matched to the OreDict-registrated items of this string. Another problem could be that you don't actually call this method ever.