Jump to content

Can't set name for worldtype


Blade Avuari

Recommended Posts

I am unable to set a name for a my worldtype. Does anyone know what method I'm supposed to use?

 

My mod class

 

package net.minecraft.src;
import java.util.Random;

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.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod( modid = "DigDeeper", name="Digging Deeper!", version="Mod 1.3 MC 1.3.2")
public class BladeDepthMod
{
public  WorldType Deeper;

@Init
public void DepthLoad(FMLInitializationEvent evt)
{
	LanguageRegistry.addName(Deeper, "Dig Deeper!");//This is the method that appears to be the problem
    Deeper = new WorldTypeDeeper(11, "deeper");
}
}

 

 

And the error report

 

 

 

      Minecraft has crashed!     

      ----------------------     

 

Minecraft has stopped running because it encountered a problem; Failed to start game

This error has been saved to C:\Users\Jonathan\Documents\moddingcraft13\jars\.\crash-reports\crash-2012-08-17_14.31.22-client.txt for your convenience. Please include a copy of this file if you report this crash to anyone.

 

 

 

--- BEGIN ERROR REPORT b2b0f27 --------

Generated 8/17/12 2:31 PM

 

- Minecraft Version: 1.3.2

- Operating System: Windows 7 (amd64) version 6.1

- Java Version: 1.7.0, Oracle Corporation

- Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

- Memory: 805258432 bytes (767 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

- JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

- LWJGL: 2.4.2

- OpenGL: GeForce 6150SE nForce 430/PCI/SSE2 GL version 2.1.2, NVIDIA Corporation

- Is Modded: Definitely; 'forge,fml'

- Type: Client

- Texture Pack: Default

- Profiler Position: N/A (disabled)

 

cpw.mods.fml.common.LoaderException: java.lang.reflect.InvocationTargetException

at cpw.mods.fml.common.LoadController.transition(LoadController.java:106)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:603)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:217)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:447)

at net.minecraft.client.Minecraft.run(Minecraft.java:734)

at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.reflect.InvocationTargetException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:308)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)

at com.google.common.eventbus.EventBus.post(EventBus.java:268)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:127)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)

at com.google.common.eventbus.EventBus.post(EventBus.java:268)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:85)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:602)

... 4 more

Caused by: java.lang.IllegalArgumentException: Illegal object for naming null

at cpw.mods.fml.common.registry.LanguageRegistry.addNameForObject(LanguageRegistry.java:56)

at cpw.mods.fml.common.registry.LanguageRegistry.addName(LanguageRegistry.java:64)

at net.minecraft.src.BladeDepthMod.DepthLoad(BladeDepthMod.java:18)

... 30 more

--- END ERROR REPORT 817eb19f ----------

 

 

 

 

 

width=300 height=100http://i.imgur.com/ivK3J.png[/img]

I'm a little surprised that I am still ranked as a "Forge Modder," having not posted a single mod since my animals mod... I have to complete Digging Deeper!, fast!

Link to comment
Share on other sites

It throws an error, because you try to add a name to an object which isn't initialized yet. You initialize it first after the name register. Try this:

 

@Init
public void DepthLoad(FMLInitializationEvent evt)
{
    Deeper = new WorldTypeDeeper(11, "deeper");
	LanguageRegistry.addName(Deeper, "Dig Deeper!");
}

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

It doesn't help, it just says "Illegal object for naming"

 

Code:

package net.minecraft.src;
import java.util.Random;

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.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod( modid = "DigDeeper", name="Digging Deeper!", version="Mod 1.3 MC 1.3.2")
public class BladeDepthMod
{
public  WorldType Deeper;

@Init
public void DepthLoad(FMLInitializationEvent evt)
{
	Deeper = new WorldTypeDeeper(11, "deeper");
    LanguageRegistry.addName(Deeper, "Dig Deeper!");
}
}

 

Error:

 


      Minecraft has crashed!      
      ----------------------      

Minecraft has stopped running because it encountered a problem; Failed to start game
This error has been saved to C:\Users\Jonathan\Documents\moddingcraft13\jars\.\crash-reports\crash-2012-08-17_15.25.08-client.txt for your convenience. Please include a copy of this file if you report this crash to anyone.



--- BEGIN ERROR REPORT eb26e2b --------
Generated 8/17/12 3:25 PM

- Minecraft Version: 1.3.2
- Operating System: Windows 7 (amd64) version 6.1
- Java Version: 1.7.0, Oracle Corporation
- Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
- Memory: 799626448 bytes (762 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
- JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
- LWJGL: 2.4.2
- OpenGL: GeForce 6150SE nForce 430/PCI/SSE2 GL version 2.1.2, NVIDIA Corporation
- Is Modded: Definitely; 'forge,fml'
- Type: Client
- Texture Pack: Default
- Profiler Position: N/A (disabled)

cpw.mods.fml.common.LoaderException: java.lang.reflect.InvocationTargetException
at cpw.mods.fml.common.LoadController.transition(LoadController.java:106)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:603)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:217)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:447)
at net.minecraft.client.Minecraft.run(Minecraft.java:734)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:308)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:85)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:602)
... 4 more
Caused by: java.lang.IllegalArgumentException: Illegal object for naming net.minecraft.src.WorldTypeDeeper@68d4ea21
at cpw.mods.fml.common.registry.LanguageRegistry.addNameForObject(LanguageRegistry.java:56)
at cpw.mods.fml.common.registry.LanguageRegistry.addName(LanguageRegistry.java:64)
at net.minecraft.src.BladeDepthMod.DepthLoad(BladeDepthMod.java:19)
... 30 more
--- END ERROR REPORT 1d7c6171 ----------


 

 

width=300 height=100http://i.imgur.com/ivK3J.png[/img]

I'm a little surprised that I am still ranked as a "Forge Modder," having not posted a single mod since my animals mod... I have to complete Digging Deeper!, fast!

Link to comment
Share on other sites

Then try instead of this:

LanguageRegistry.addName(Deeper, "Dig Deeper!");

, this:

LanguageRegistry.instance().addStringLocalization("deeper.name", "en_US", "Dig Deeper!");

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

Pretty close, it ran, but the name was "generator.deeper", so naturally, I used this:

LanguageRegistry.instance().addStringLocalization("generator.deeper", "en_US", "Dig Deeper!");

Thanks so very much! This is going to help alot with everything.

 

It seems that I still get the error when I use the normal minecraft client:

Error:

 


      Minecraft has crashed!      
      ----------------------      

Minecraft has stopped running because it encountered a problem; Failed to start game
This error has been saved to C:\Users\Jonathan\Awesomecraft\instances\Minecraft1.3\.minecraft\crash-reports\crash-2012-08-17_16.12.42-client.txt for your convenience. Please include a copy of this file if you report this crash to anyone.



--- BEGIN ERROR REPORT c920650b --------
Generated 8/17/12 4:12 PM

- Minecraft Version: 1.3.2
- Operating System: Windows 7 (amd64) version 6.1
- Java Version: 1.6.0_25, Sun Microsystems Inc.
- Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Sun Microsystems Inc.
- Memory: 416241624 bytes (396 MB) / 514523136 bytes (490 MB) up to 954466304 bytes (910 MB)
- JVM Flags: 2 total; -Xmx1024m -Xms512m
- LWJGL: 2.4.2
- OpenGL: GeForce 6150SE nForce 430/PCI/SSE2 GL version 2.1.2, NVIDIA Corporation
- Is Modded: Definitely; 'forge,fml'
- Type: Client
- Texture Pack: Default
- Profiler Position: N/A (disabled)

java.lang.NullPointerException
at cpw.mods.fml.common.FMLModContainer.getName(FMLModContainer.java:106)
at cpw.mods.fml.common.Loader.sortModList(Loader.java:236)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:416)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:192)
at net.minecraft.client.Minecraft.a(Minecraft.java:402)
at net.minecraft.client.Minecraft.run(Minecraft.java:734)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT 610227f2 ----------

 

width=300 height=100http://i.imgur.com/ivK3J.png[/img]

I'm a little surprised that I am still ranked as a "Forge Modder," having not posted a single mod since my animals mod... I have to complete Digging Deeper!, fast!

Link to comment
Share on other sites

I think you need a mcmod.info file in your package. Dunno how it works, because I'm not nearly done with my mods that I need it now.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

Yeah, that was the problem. I thought about it just after I posted, but I had to search for the file. One of your posts solved THAT, too.

There needs to be a link of at least an easy way to find it here in the Modder Support forum.

width=300 height=100http://i.imgur.com/ivK3J.png[/img]

I'm a little surprised that I am still ranked as a "Forge Modder," having not posted a single mod since my animals mod... I have to complete Digging Deeper!, fast!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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