Jump to content

Recommended Posts

Posted

My game crashed when i add in my config.  All the code is on my github:  https://github.com/biggles2206/rocketSwordMod_source/tree/master/common/com/biggles2206/rocketSwordMod

and my crash report

  Reveal hidden contents

 

 

Any help would be appreciated

- Thomas

Lets make forge modding the best it can be!

Posted
  On 7/28/2013 at 8:05 PM, GotoLink said:

At line 33 of RSM.class:

config_Main.init(file);

But file is not initialized anywhere... ::)

 

Modified some of the code. Still crashes.

Lets make forge modding the best it can be!

Posted

If the crash is the same, you didn't fix anything, obviously.

ProHint: "file" (all lower case) is a variable you can set as a field in your class, to initialize yourself (need some knowledge of File class)

NoobHint: PreInit event can provide an already set config file

 

Posted
  On 7/29/2013 at 10:06 AM, GotoLink said:

If the crash is the same, you didn't fix anything, obviously.

ProHint: "file" (all lower case) is a variable you can set as a field in your class, to initialize yourself (need some knowledge of File class)

NoobHint: PreInit event can provide an already set config file

 

Im gunna re - -write the config class, to see if that fixes it

Lets make forge modding the best it can be!

Posted
  On 7/29/2013 at 4:42 PM, biggles2206 said:

  Quote

If the crash is the same, you didn't fix anything, obviously.

ProHint: "file" (all lower case) is a variable you can set as a field in your class, to initialize yourself (need some knowledge of File class)

NoobHint: PreInit event can provide an already set config file

 

Im gunna re - -write the config class, to see if that fixes it

 

Re - Written config. Still crashes.

 

 

  Reveal hidden contents

 

 

I updated the code on my github.

Lets make forge modding the best it can be!

Posted
  Quote
java.lang.NullPointerException

  at net.minecraftforge.common.Configuration.<init>(Configuration.java:91)

  at com.biggles2206.rocketSwordMod.config.ConfigHandler.init(ConfigHandler.java:12)

  at com.biggles2206.rocketSwordMod.RSM.preInit(RSM.java:33)

 

line 33 of RSM:

ConfigHandler.init(null);

so yes its normal thsi fails

you need to create a new file

 

File file = new File("wtfman:P.cfg");

ConfigHandler.init(file);

 

 

 

 

 

jsut a comparison, mine looks like this, its using forge build in system:

// Configuration
private Configuration config;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	EquipmentStatsBase.setupMap();
	// the advantage of usign config files is that if theres a conflict
	// between 2 items or 2 block, the config file will generate a new id
	// for the block that wont go in conflict with any other id, preventing
	// crashes.
	config = new Configuration(event.getSuggestedConfigurationFile());
	blockIds = new int[] {
			config.getBlock("orichalcumOre", 509).getInt() ,
			config.getBlock("unobtainiumOre", 510).getInt() };
	itemIds = new int[] {config.getItem("test", 1000).getInt(),
			config.getItem("magestaff", 1001).getInt(),
			config.getItem("heartoftheadmin", 1002).getInt(),
			config.getItem("mythil", 1003).getInt(),
			config.getItem("meteorite", 1004).getInt(),
			config.getItem("adamantium", 1005).getInt(),
			config.getItem("orichalcum", 1006).getInt(),
			config.getItem("unobtainium", 1007).getInt(),};
	config.save();

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted
  On 7/29/2013 at 5:19 PM, hydroflame said:

  Quote
java.lang.NullPointerException

  at net.minecraftforge.common.Configuration.<init>(Configuration.java:91)

  at com.biggles2206.rocketSwordMod.config.ConfigHandler.init(ConfigHandler.java:12)

  at com.biggles2206.rocketSwordMod.RSM.preInit(RSM.java:33)

 

line 33 of RSM:

ConfigHandler.init(null);

so yes its normal thsi fails

you need to create a new file

 

File file = new File("wtfman:P.cfg");

ConfigHandler.init(file);

 

 

 

 

 

jsut a comparison, mine looks like this, its using forge build in system:

// Configuration
private Configuration config;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	EquipmentStatsBase.setupMap();
	// the advantage of usign config files is that if theres a conflict
	// between 2 items or 2 block, the config file will generate a new id
	// for the block that wont go in conflict with any other id, preventing
	// crashes.
	config = new Configuration(event.getSuggestedConfigurationFile());
	blockIds = new int[] {
			config.getBlock("orichalcumOre", 509).getInt() ,
			config.getBlock("unobtainiumOre", 510).getInt() };
	itemIds = new int[] {config.getItem("test", 1000).getInt(),
			config.getItem("magestaff", 1001).getInt(),
			config.getItem("heartoftheadmin", 1002).getInt(),
			config.getItem("mythil", 1003).getInt(),
			config.getItem("meteorite", 1004).getInt(),
			config.getItem("adamantium", 1005).getInt(),
			config.getItem("orichalcum", 1006).getInt(),
			config.getItem("unobtainium", 1007).getInt(),};
	config.save();

 

I modified the RSM class to how i understand it from your post (updated github) but i still get a crash.

 

  Reveal hidden contents

 

Lets make forge modding the best it can be!

Posted
  Quote
Caused by: java.lang.Error: Unresolved compilation problem:

  file cannot be resolved to a variable

 

  at com.biggles2206.rocketSwordMod.RSM.preInit(RSM.java:33)

 

... ah man ....

 

[lmgtfy]file cannot be resolved to a variable[/lmgtfy]

 

  Quote
File file = new File("myconfigfile.cfg");

ConfigHandler.init(file);

 

 

learning java is important to make awesome mods :)

 

EDIT: forge tutorial on config files:

http://www.minecraftforge.net/wiki/How_to_make_an_advanced_configuration_file

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted
  On 7/29/2013 at 7:14 PM, hydroflame said:

  Quote
Caused by: java.lang.Error: Unresolved compilation problem:

  file cannot be resolved to a variable

 

  at com.biggles2206.rocketSwordMod.RSM.preInit(RSM.java:33)

 

... ah man ....

 

[lmgtfy]file cannot be resolved to a variable[/lmgtfy]

 

  Quote
File file = new File("myconfigfile.cfg");

ConfigHandler.init(file);

 

 

learning java is important to make awesome mods :)

 

EDIT: forge tutorial on config files:

http://www.minecraftforge.net/wiki/How_to_make_an_advanced_configuration_file

 

I did that, im even more confused!  I've updated github.

Lets make forge modding the best it can be!

Posted
  Quote
package com.biggles2206.rocketSwordMod;

 

/**

* @author biggles2206

*/

 

import com.biggles2206.rocketSwordMod.blocks.ModBlocks;

import com.biggles2206.rocketSwordMod.config.ConfigHandler;

import com.biggles2206.rocketSwordMod.items.ModItems;

import com.biggles2206.rocketSwordMod.lib.Refence;

import com.biggles2206.rocketSwordMod.proxy.CommonProxy;

 

import cpw.mods.fml.common.Mod;

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

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;

 

 

@Mod(name = Refence.NAME, modid = Refence.MODID, version = Refence.VERSION)

@NetworkMod(clientSideRequired = true, serverSideRequired = false)

public class RSM {

 

@SidedProxy(clientSide = Refence.CLIENT_PROXY_LOC, serverSide = Refence.COMMON_PROXY_LOC)

public static CommonProxy proxy;

@EventHandler

public void preInit(FMLPreInitializationEvent event){

ModBlocks.init();

ModItems.init();

ModItems.addNames();

ConfigHandler.init(file1);

}

 

@EventHandler

public void Init(FMLInitializationEvent event){

 

 

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent event){

 

 

}

}

 

this should actually be :

 

  Quote
package com.biggles2206.rocketSwordMod;

 

/**

* @author biggles2206

*/

 

import com.biggles2206.rocketSwordMod.blocks.ModBlocks;

import com.biggles2206.rocketSwordMod.config.ConfigHandler;

import com.biggles2206.rocketSwordMod.items.ModItems;

import com.biggles2206.rocketSwordMod.lib.Refence;

import com.biggles2206.rocketSwordMod.proxy.CommonProxy;

 

import cpw.mods.fml.common.Mod;

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

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;

 

 

@Mod(name = Refence.NAME, modid = Refence.MODID, version = Refence.VERSION)

@NetworkMod(clientSideRequired = true, serverSideRequired = false)

public class RSM {

 

@SidedProxy(clientSide = Refence.CLIENT_PROXY_LOC, serverSide = Refence.COMMON_PROXY_LOC)

public static CommonProxy proxy;

@EventHandler

public void preInit(FMLPreInitializationEvent event){

ModBlocks.init();

ModItems.init();

ModItems.addNames();

File file1 = new File("fileName.cfg");

ConfigHandler.init(file1);

 

}

 

@EventHandler

public void Init(FMLInitializationEvent event){

 

 

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent event){

 

 

}

}

 

in your first version file1 doesnt exists anywhere, the compiler dont know wtf you're talking about

 

in version 2 i create one and this reference is passed to the method

 

BTW THIS BASIC JAVA

i suggest you go at least over the basics before going any further, itll help in the long run. because if you think you can do ASM in this state, wake up will be hard

 

good modding :)

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted
  On 7/29/2013 at 7:52 PM, hydroflame said:

  Quote
package com.biggles2206.rocketSwordMod;

 

/**

* @author biggles2206

*/

 

import com.biggles2206.rocketSwordMod.blocks.ModBlocks;

import com.biggles2206.rocketSwordMod.config.ConfigHandler;

import com.biggles2206.rocketSwordMod.items.ModItems;

import com.biggles2206.rocketSwordMod.lib.Refence;

import com.biggles2206.rocketSwordMod.proxy.CommonProxy;

 

import cpw.mods.fml.common.Mod;

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

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;

 

 

@Mod(name = Refence.NAME, modid = Refence.MODID, version = Refence.VERSION)

@NetworkMod(clientSideRequired = true, serverSideRequired = false)

public class RSM {

 

@SidedProxy(clientSide = Refence.CLIENT_PROXY_LOC, serverSide = Refence.COMMON_PROXY_LOC)

public static CommonProxy proxy;

@EventHandler

public void preInit(FMLPreInitializationEvent event){

ModBlocks.init();

ModItems.init();

ModItems.addNames();

ConfigHandler.init(file1);

}

 

@EventHandler

public void Init(FMLInitializationEvent event){

 

 

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent event){

 

 

}

}

 

this should actually be :

 

  Quote
package com.biggles2206.rocketSwordMod;

 

/**

* @author biggles2206

*/

 

import com.biggles2206.rocketSwordMod.blocks.ModBlocks;

import com.biggles2206.rocketSwordMod.config.ConfigHandler;

import com.biggles2206.rocketSwordMod.items.ModItems;

import com.biggles2206.rocketSwordMod.lib.Refence;

import com.biggles2206.rocketSwordMod.proxy.CommonProxy;

 

import cpw.mods.fml.common.Mod;

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

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;

 

 

@Mod(name = Refence.NAME, modid = Refence.MODID, version = Refence.VERSION)

@NetworkMod(clientSideRequired = true, serverSideRequired = false)

public class RSM {

 

@SidedProxy(clientSide = Refence.CLIENT_PROXY_LOC, serverSide = Refence.COMMON_PROXY_LOC)

public static CommonProxy proxy;

@EventHandler

public void preInit(FMLPreInitializationEvent event){

ModBlocks.init();

ModItems.init();

ModItems.addNames();

File file1 = new File("fileName.cfg");

ConfigHandler.init(file1);

 

}

 

@EventHandler

public void Init(FMLInitializationEvent event){

 

 

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent event){

 

 

}

}

 

in your first version file1 doesnt exists anywhere, the compiler dont know wtf you're talking about

 

in version 2 i create one and this reference is passed to the method

 

BTW THIS BASIC JAVA

i suggest you go at least over the basics before going any further, itll help in the long run. because if you think you can do ASM in this state, wake up will be hard

 

good modding :)

 

All fixed. Thank you very much!  I am not going to learn java from VSWE's java course

 

Thank you again,

- Thomas

Lets make forge modding the best it can be!

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.