Jump to content

IExtendedProperties Error


Jdb100

Recommended Posts

I was trying out the IExtendedProperties for my mod when i started crashing well calling an instance in my class. I have been using this tutorial to http://www.minecraftforum.net/topic/1952901-eventhandler-and-iextendedentityproperties/

 

my error log is here: http://gw.minecraftforge.net/tRpo

 

 

the lines of code in there error log:

 

at com.jdb100.mod.player.ExtendedPlayerProperties.<init>(ExtendedPlayerProperties.java:42)

this.currentMana = SpiritBase.instance.getMana();

 

at com.jdb100.mod.player.ExtendedPlayerProperties.register(ExtendedPlayerProperties.java:52)

	public static final void register(EntityPlayer player)
{
	player.registerExtendedProperties(spirit, new ExtendedPlayerProperties(player));
}

 

at com.jdb100.mod.events.EntityConstructingEvent.onEntityConstructing(EntityConstructingEvent.java:23)

			ExtendedPlayerProperties.register((EntityPlayer) event.entity);

 

at com.jdb100.mod.player.ExtendedPlayerProperties.get(ExtendedPlayerProperties.java:57)

		return (ExtendedPlayerProperties) player.getExtendedProperties(spirit);

 

at com.jdb100.mod.core.tech.SpiritBase.<init>(SpiritBase.java:10)

	ExtendedPlayerProperties props = ExtendedPlayerProperties.get(Core.mc.thePlayer);

 

at com.jdb100.mod.core.tech.SpiritBase.<clinit>(SpiritBase.java:9)

public static SpiritBase instance = new SpiritBase();

 

sorry i dont like doing this but since i am a noob with this topic i cant figure it out

Link to comment
Share on other sites

public static SpiritBase instance = new SpiritBase();

If you have @Instance("modid"), you don't need to initialize.

 

ExtendedPlayerProperties props = ExtendedPlayerProperties.get(Core.mc.thePlayer);

What do you do with this ?

Do you expect Core.mc.thePlayer to be a player, without any player being connected yet ?

At best, "props" is going to be null.

 

Then i suppose you registered your EntityContrusctionEvent class.

 

 

Link to comment
Share on other sites

Looks like 'SpiritBase' is your mod? Why are you using your mod instance to getMana()? Shouldn't mana be from each instance of an EntityPlayer or some other Entity, rather than what looks like a static method with no parameters? Additionally, it looks like you're trying to make a call to getMana() in the constructor for the IExtendedEntityProperties, which is called while the parent entity is still loading - like GotoLink said, whatever player object you get at this point will not work.

Link to comment
Share on other sites

Sorry for not being clear but my main mod file is called core which has an instance of minecraft i am calling to get the player.

 

I get the instance using this method:

Minecraft.getMinecraft();

 

Then I have a file that is called SpiritBase which holds all of the math calculation that I have the instance that I use to call all the math.

 

 

From what I can tell is that it is probably with how I call the player or how I call the instance of SpiritBase.

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.