How do I create a procedure that shows an entity's hp amount when the player looks at it?

Started by KingSolomon on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I create a procedure that shows an entity's hp amount when the player looks at it?

I've been trying to use raytracing blocks to lock on to an entity in the player's field of vision to display it's health, however I can't get it to work. I'd love to just add torohealth to my testing environment but I learned that I would need a deobfuscated version for it to work and can't find it. Is there anyone out there that could help me solve this?

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It's going to be a lot more…
Wed, 10/26/2022 - 00:01

It's going to be a lot more difficult if you want to display the health of the entity as an actual healthbar or something above the entity. (I honestly wouldn't know where to start.) 

If you just want to display the current health of an entity though, you can create overlays that indicate the target's healthbar, and have their display conditions be linked to raytracing procedures for the entity the player is looking at. However, this means that the healthbars will be displayed on your screen. (Like the player's healthbar or hungerbar.) 

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That would be fine, my only…
Wed, 10/26/2022 - 00:17

That would be fine, my only issue is I have little to no idea how to use the raytracing blocks that way. Is there an element I'm overlooking that displays mob health because everything I've tried comes up short. Heck I'd be more than happy if I could just set a variable that I could display in an overlay and call it a day just for testing purposes. Can you point me in the right direction?

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Never mind I figured it out…
Wed, 10/26/2022 - 11:50

Never mind I figured it out. I just had to replace the x, y, & z in the "current health of" area to the look position blocks and it works alright for the most part. Thanks!