Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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.

 

 

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.

  • Author

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.

I'd bet you anything that Core.mc.thePlayer is null.

Drop that shit, you don't need it at all.

 

Then Minecraft.getMinecraft() is client-side only. So drop it too, unless you don't want to be server compatible.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.