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.

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

Featured Replies

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.

  • Author
5 hours ago, diesieben07 said:
  • You get two, because one is the server and one is the client.

I mean one for each event

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.

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.

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

  • Author
3 minutes ago, diesieben07 said:

Make sure you read and write the data on the server.

Didn't check anywhere if client or server so it should write it in both

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

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.