Jump to content

Configuration Craps Up


Recommended Posts

When I run minecraft (in eclipse)

the config is normal. Like this

 

# Configuration file
# Generated on 7/12/12 10:52 PM

####################
# block 
####################

block {
   Crying Obsidian=130
   Spike Block=131
}

####################
# general 
####################

general {
}

####################
# item 
####################

item {
   Empty Time Machine=6000
   Time Dust=6002
   Time Machine=6001
}

 

When I run it again,

the config looks like this:

 

#MLProperties: name (type:default) min:max -- information
#
#Thu Jul 12 22:45:15 EDT 2012
general={
Empty=Time Machine\=6000
Time=Machine\=6001
Crying=Obsidian\=130
item={
}=
Spike=Block\=131
block={

 

And the error is here

 

27 achievements
182 recipes
LWJGL Version: 2.4.2
Jul 12, 2012 10:54:26 PM cpw.mods.fml.common.FMLCommonHandler beginLoading
INFO: Attempting early MinecraftForge initialization
Jul 12, 2012 10:54:26 PM cpw.mods.fml.common.FMLCommonHandler beginLoading
INFO: Completed early MinecraftForge initialization
2012-07-12 22:54:26 [iNFO] Forge Mod Loader version 2.2.48.135 for Minecraft 1.2.5 loading
2012-07-12 22:54:27 [iNFO] Loading mods from C:\Users\Joe\Minecraft\Minecraft Modding\MCP\jars\mods
2012-07-12 22:54:27 [iNFO] Forge Mod Loader has loaded 2 mods
Exception in thread "Minecraft main thread" java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at cpw.mods.fml.common.modloader.ModLoaderModContainer.preInit(ModLoaderModContainer.java:107)
at cpw.mods.fml.common.Loader.preModInit(Loader.java:235)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:593)
at cpw.mods.fml.client.FMLClientHandler.onPreLoad(FMLClientHandler.java:193)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:383)
at net.minecraft.client.Minecraft.run(Minecraft.java:735)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: property general has no scope
at net.minecraft.src.forge.Configuration.load(Configuration.java:245)
at DarkNinja2462.Unimplecraft.mod_Unimplecraft.configurationProperties(mod_Unimplecraft.java:69)
at DarkNinja2462.Unimplecraft.mod_Unimplecraft.<clinit>(mod_Unimplecraft.java:20)
... 13 more

 

Here is my code in mod_Unimplecraft.java

 

package DarkNinja2462.Unimplecraft;

import java.io.File;
import java.util.*;
import net.minecraft.src.*;
import net.minecraft.src.forge.*;
import net.minecraft.client.Minecraft;


public class mod_Unimplecraft extends BaseMod {

@Override
public String getVersion() {
	return "0.0.1";
}

//Declarations

static Configuration configuration = new Configuration(new File(Minecraft.getMinecraftDir(), "config/mod_Unimplecraft.cfg"));
static int CryingID = configurationProperties();
static int SpikeID;
static int timeMachineEmptyID;
static int timeMachineID;
static int timeDustID;


public static Block Crying;
public static Block Spike;
public static Item timeMachineEmpty;
public static Item timeMachine;
public static Item timeDust;

//Register everything

@Override
public void load() {
	this.registerBlocks();
	this.addNames();
	AchievementLib.addAchievementDescs();
	MinecraftForge.registerAchievementPage(AchievementLib.page1);
	CraftLib.registerRecipes();
}

private void registerBlocks(){
	ModLoader.registerBlock(Crying);
	ModLoader.registerBlock(Spike);
}

private void addNames(){
	ModLoader.addName(Crying, "Crying Obsidian");
	ModLoader.addName(Spike, "Spike Block");
	ModLoader.addName(timeMachine, "Time Machine");
	ModLoader.addName(timeMachineEmpty,"Empty Time Machine");
	ModLoader.addName(timeDust, "Time Dust");
}

//Creating Blocks, Items, and more

static {		
	Crying = new BasicBlock(CryingID, 0, Material.rock, (Block.blockLapis.getHardness() + Block.obsidian.getHardness())/2, 2000.0F, Block.soundStoneFootstep, false, 0).setBlockName("Crying Obsidian");
	Spike = new BlockSpike(SpikeID, 1, Material.rock, 2.0F, 10.0F, Block.soundStoneFootstep, false, 0).setBlockName("Spike Block");
	timeMachineEmpty = new BasicItem(timeMachineEmptyID, 1, 1, 0, "Empty Time Machine", false, EnumRarity.common);
	timeMachine = new BasicItem(timeMachineID, 1, 0, 0, "Time Machine", true, EnumRarity.rare).setContainerItem(timeMachineEmpty);
	timeDust = new BasicItem(timeDustID, 64, 2, 0, "Time Dust", true, EnumRarity.uncommon);
}

    public static int configurationProperties()
    {
            configuration.load();
            CryingID = Integer.parseInt(configuration.getOrCreateBlockIdProperty("Crying Obsidian", 130).value);
            SpikeID = Integer.parseInt(configuration.getOrCreateBlockIdProperty("Spike Block", 131).value);
            timeMachineEmptyID = Integer.parseInt(configuration.getOrCreateIntProperty("Empty Time Machine", Configuration.CATEGORY_ITEM, 6000).value);
            timeMachineID = Integer.parseInt(configuration.getOrCreateIntProperty("Time Machine", Configuration.CATEGORY_ITEM, 6001).value);
            timeDustID = Integer.parseInt(configuration.getOrCreateIntProperty("Time Dust", Configuration.CATEGORY_ITEM, 6002).value);
            configuration.save();
            return CryingID;
    }

//Getting Achievements

public void takenFromCrafting(EntityPlayer entityplayer, ItemStack itemstack, IInventory iinventory){
	boolean flag = false;
	if (itemstack.itemID == Crying.blockID){
		entityplayer.addStat(AchievementLib.CryingAchieve, 1);
		flag = true;
	}
	else if (itemstack.itemID == timeMachineEmpty.shiftedIndex){
		entityplayer.addStat(AchievementLib.eTimeAchieve, 1);
		flag = true;
	}
	else if (itemstack.itemID == timeMachine.shiftedIndex){
		entityplayer.addStat(AchievementLib.TimeAchieve, 1);
		flag = true;
	}
	else if (itemstack.itemID == timeDust.shiftedIndex){
		entityplayer.addStat(AchievementLib.timeDustAchieve, 1);
		flag = true;
	}
	else if (itemstack.itemID == Spike.blockID){
		entityplayer.addStat(AchievementLib.SpikeAchieve,1 );
		flag = true;
	}
}



}

 

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.



×
×
  • Create New...

Important Information

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