Jump to content

Player's EntityData in LivingHurt and LivingUpdate events return different values?


Recommended Posts

Posted

I have two prints for the player tags in LivingUpdate and LivingHurt

@SubscribeEvent
public static void EventLivingHurt(LivingHurtEvent event) {
  if (event.getEntityLiving() instanceof EntityPlayer){
  	System.out.println("LivingHurt: " + event.getEntityLiving().getEntityData());
  }
}

@SubscribeEvent
public static void EventLivingUpdate(LivingUpdateEvent event) {
  if (event.getEntityLiving() instanceof EntityPlayer){
  	System.out.println("LivingUpdate: " + event.getEntityLiving().getEntityData());
  }
}

 

One returns a set of tags, the other one, one other set.

Posted
4 minutes ago, Insane96MCP said:

Saving some timers, a "weight" value for the player.

Use Capabilities.

And EntityData was never intended for mods to store their own data in anyway.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
8 minutes ago, diesieben07 said:

Yes, it was. It's the precursor to IExtendedEntityProperties, which is now superseded by capabilities.

My mistake.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
1 hour ago, Draco18s said:

Use Capabilities.

And EntityData was never intended for mods to store their own data in anyway.

Wow, capabilities are pretty useful BUT, the problem still persist.

In LivingHurtEvent I set an int and if I read it in LivingUpdateEvent it always reads 0.

 

You can check the code for living hurt here where I set the damageSlownessDuration

And here when I get the damageSlownessDuration.

Posted
11 hours ago, diesieben07 said:

You should only write and read it on the server unless you have a specific reason to. If so, only write it on the server and use packets to send it to the client.

Yep, I was writing only on client in the Update. I have misdone the if (world.isRemote)

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.