Jump to content

working with Multiple config files issue.


Corruption44

Recommended Posts

Hey this is my first mod so i'm not entirely sure how thing's work so if i've done something odd say so, basically the mod worked before adding the config method using direct ID's but i'd like it to use the ID's form the config files instead incase they change, the mod is basically just to add item swapping between mods.

 

Edit-it doesn't Crash the recipes just don't show up ingame

 

package mod.Y;

 

 

 

import java.io.File;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.item.crafting.FurnaceRecipes;

import net.minecraftforge.common.Configuration;

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.common.Property;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.Init;

import cpw.mods.fml.common.Mod.Instance;

import cpw.mods.fml.common.Mod.PostInit;

import cpw.mods.fml.common.Mod.PreInit;

import cpw.mods.fml.common.SidedProxy;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.event.FMLPostInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.network.NetworkMod;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

 

@Mod(modid="Interchange", name="Interchange", version="0.0.1")

@NetworkMod(clientSideRequired=false, serverSideRequired=false)

public class Y {

 

//Establish Variables

public Property MFRsapID;

public Property ICsapID;

public Property MystCrystalID;

public Property TWITorchID;

public Property ICfertID;

public Property MFRfertID;

public Property FORfertID;

public Property METfertID;

public Property UEcircuitID;

public Property MEKcircuitID;

public Property ICcircuitID;

public Property ICrubberID;

public Property MFRrubberID;

public Property ICwireID;

public Property UEwireID;

 

        // The instance of your mod that Forge uses.

        @Instance("Y")

        public static Y instance;

     

        // Says where the client and server 'proxy' code is loaded.

        @SidedProxy(clientSide="mod.Y.client.ClientProxy", serverSide="mod.Y.CommonProxy")

        public static CommonProxy proxy;

     

        @PreInit

        public void preInit(FMLPreInitializationEvent event) {

 

//Establish config file names

        File MFRFile = new File("config/MFreloaded.cfg");

        File UEFile = new File("config/UniversalElectricity/UniversalElectrcity.cfg");

        File IC2File = new File("config/IC2.cfg");

        File FORFile = new File("config/forestry/base.conf");

        File MYSTFile = new File("config/mystcraft_config.txt");

        File MEKFile = new File("config/Mekanism.cfg");

        File METUFile = new File("config/Metallurgy/MetallurgyUtility.cfg");

        File TwilightFile = new File("config/TwilightForest.cfg");

       

//load configs into Configuration objects

        Configuration MFR = new Configuration(MFRFile);

        Configuration UE = new Configuration(UEFile);

        Configuration MYST = new Configuration(MYSTFile);

        Configuration IC2 = new Configuration(IC2File);

        Configuration MEK = new Configuration(MEKFile);

        Configuration METU = new Configuration(METUFile);

        Configuration Twilight = new Configuration(TwilightFile);

        Configuration FOR = new Configuration(FORFile);

       

//gather ID's from Configs

        MFRsapID = MFR.getBlock("ID.RubberSapling", 3124);

        ICsapID = IC2.getBlock("blockRubSapling", 4090);

        MystCrystalID = MYST.getBlock("block.crystal.id", 1476);

        TWITorchID = Twilight.getItem("Torchberries",27728);

        ICfertID = IC2.getItem("itemFertilizer", 29865);

        MFRfertID = MFR.getItem("ID.FertilizerItem", 11992);

        FORfertID = FOR.getItem("I:fertilizerBio", 5000);

        METfertID = METU.getItem("\"Fertilizer Id\"", 28408);

        UEcircuitID = UE.getItem("Circuit=",13973);

        ICcircuitID = IC2.getItem("itemPartCircuit",29935);

        MEKcircuitID = MEK.getItem("ControlCircuit",12214);

        ICrubberID = IC2.getItem("itemRubber",29960);

        MFRrubberID = MFR.getItem("ID.RubberBar",11995);

        ICwireID = IC2.getBlock("blockCable", 4078);

        UEwireID = UE.getBlock("Copper_Wire", 3971);

       

       

       

        }

     

        @Init

        public void load(FMLInitializationEvent event) {

        proxy.registerRenderers();

       

//Establish ID's as Item Stacks

        ItemStack dirtStack = new ItemStack(1,1,0);

        ItemStack massStack = new ItemStack(5000,1,0);

        ItemStack rockStack = new ItemStack(5001,1,0);

        ItemStack clayStack = new ItemStack(337,1,0);

        ItemStack mfrsap = new ItemStack(MFRsapID.getInt(),1,0);

        ItemStack ic2sap = new ItemStack(ICsapID.getInt(),1,0);

        ItemStack crystalStack = new ItemStack(MystCrystalID.getInt(),8,0);

        ItemStack torchberryStack = new ItemStack(TWITorchID.getInt(),1,0);

        ItemStack flour = new ItemStack(4362,1,12);

        ItemStack icfert = new ItemStack(ICfertID.getInt(),2,0);

        ItemStack mfrfert = new ItemStack(MFRfertID.getInt(),2,0);

        ItemStack forfert = new ItemStack(FORfertID.getInt(),2,0);

        ItemStack metfert = new ItemStack(METfertID.getInt(),2,0);

        ItemStack glowStack = new ItemStack(348,1,0);

        ItemStack diamondStack = new ItemStack(264,1,0);

        ItemStack emeraldStack = new ItemStack(388,1,0);

        ItemStack lapisStack = new ItemStack(351,1,4);

        ItemStack glassStack = new ItemStack(20,1,0);

        ItemStack cake = new ItemStack(354,1,0);

        ItemStack butter = new ItemStack(15268,1,0);

        ItemStack egg = new ItemStack(344,1,0);

        ItemStack sugar = new ItemStack(353,1,0);

        ItemStack cCircuit = new ItemStack(MEKcircuitID.getInt(),1,0);

        ItemStack bCircuit = new ItemStack(UEcircuitID.getInt(),1,0);

        ItemStack icCircuit = new ItemStack(ICcircuitID.getInt(),1,0);

        ItemStack redstone = new ItemStack(331,1,0);

        ItemStack icWire = new ItemStack(ICwireID.getInt(),1,0);

        ItemStack ueWire = new ItemStack(UEwireID.getInt(),1,0);

        ItemStack icRubber = new ItemStack(ICrubberID.getInt(),1,0);

        ItemStack mfrRubber = new ItemStack(MFRrubberID.getInt(),1,0);

        //ItemStack  = new ItemStack(,1,0);

       

 

//Recipes

        //Rubber Exchange

        GameRegistry.addRecipe(icRubber, " x ","  ","  ",

                    'x', mfrRubber);

        GameRegistry.addRecipe(icRubber, " x ","  ","  ",

                    'x', mfrRubber);

       

        //Wire Exchange

        GameRegistry.addRecipe(icWire, " x ","  ","  ",

                    'x', ueWire);

        GameRegistry.addRecipe(ueWire, " x ","  ","  ",

                    'x', icWire);

       

        //Cicuit Exchange

        GameRegistry.addRecipe(icCircuit, " x ","  ","  ",

                    'x', bCircuit);

        GameRegistry.addRecipe(icCircuit, " x ","  ","  ",

                    'x', cCircuit);

        GameRegistry.addRecipe(cCircuit, "x  ","  ","  ",

                    'x', bCircuit);

        GameRegistry.addRecipe(cCircuit, "yxy","  ","  ",

                    'x', icCircuit,'y',redstone);

        GameRegistry.addRecipe(bCircuit, "  ","x  ","  ",

                    'x', cCircuit);

        GameRegistry.addRecipe(bCircuit, "  ","yxy","  ",

                    'x', icCircuit,'y',redstone);

 

        //Rubber Sapling Interchange

        GameRegistry.addRecipe(ic2sap, "x  ","  ","  ",

                    'x', mfrsap);

        GameRegistry.addRecipe(mfrsap, "x  ","  ","  ",

                    'x', ic2sap);

       

        //Fertilizer TO Forestry Fertilizers

        GameRegistry.addRecipe(forfert, "x  ", "x  ","  ",

                    'x', mfrfert);

        GameRegistry.addRecipe(forfert, "x  ", "x  ","  ",

                    'x', icfert);

        GameRegistry.addRecipe(forfert, "x  ", "x  ","  ",

                    'x', metfert);

       

        //Fertilizes TO IC2 fertilizer

        GameRegistry.addRecipe(icfert, " x ", " x ","  ",

        'x', mfrfert);

        GameRegistry.addRecipe(icfert, " x ", " x ","  ",

        'x', forfert);

        GameRegistry.addRecipe(icfert, " x ", " x ","  ",

        'x', metfert);

       

        //Fertilizer TO MFR fertilizer

        GameRegistry.addRecipe(mfrfert, " x ", "x  ","  ",

        'x', icfert);

        GameRegistry.addRecipe(mfrfert, " x ", "x  ","  ",

        'x', metfert);

        GameRegistry.addRecipe(mfrfert, " x ", "x  ","  ",

        'x', forfert);

       

        //Fertilizes TO Metallurgy fertilizer

        GameRegistry.addRecipe(metfert, "x  ", " x ","  ",

        'x', mfrfert);

        GameRegistry.addRecipe(metfert, "x  ", " x ","  ",

        'x', forfert);

        GameRegistry.addRecipe(metfert, "x  ", " x ","  ",

        'x', icfert);

       

        //Mystcraft Crystal

        GameRegistry.addRecipe(crystalStack, "aba", "bcb","aba",

        'a',lapisStack,'b',glassStack,'c',diamondStack );

       

        //Real Cake!

        GameRegistry.addRecipe(cake, "aaa","dbd","cdc",

        'a',flour ,'b',butter,'c',egg,'d',sugar);

        }

     

        @PostInit

        public void postInit(FMLPostInitializationEvent event) {

                // Stub Method

        }

}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.