Jump to content

Crash on opening GUI with IExtendedEntityProperties


Knux14

Recommended Posts

Hello everyone,

 

I'm making a mod which need to save the player's money, so I made a IExtendedEntityProperties which contain the getter and the variable.

Here's my classes:

  - GuiMenu: http://paste.minecraftforge.net/view/a7b5d273

  - EntityCustomPlayer: http://paste.minecraftforge.net/view/451bc4d3

 

And it crashes on GuiMenu:29 (Where i drawString) because of pl is null ...

I dont understand why. I also need a good tutorial about PacketHandling (I found the one on the Forge's wiki but its not enough comprehensible :(

 

Link to comment
Share on other sites

well this line

pl = (EntityCustomPlayer)pl2.getExtendedProperties("knux Custom Player");

could possibly return null, are how are you registering the extended properties ?

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

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

Here's the event:

@ForgeSubscribe
public void entityConstructing(EntityConstructing evt)
{
	Entity et = evt.entity;

	if (et instanceof EntityPlayer) 
	{
		et.registerExtendedProperties("JetpackJoycraft Custom Player", new EntityCustomPlayer(et.worldObj));
	}
}

but it do not seems to run ....

oh wait... I didn't registred the event -_-

 

YEY its seems to work :)

Thanks man, sorry for this noob-question :(

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.