How to change model layer based on health/aggression?

Started by BryAstro on

Topic category: Help with Minecraft modding (Java Edition)

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to change model layer based on health/aggression?

Hello, I am trying to make the mob "change texture" (via model layering) based on its health AND whether it is targeting someone.

The on entity tick is as follows:

If the mob has over 10 HP and is targeting someone, set the textureState (from synced data) to 1. If the mob has less than 10 HP and is targeting someone, set the textureState (from synced data) to 2. Otherwise, set it to 0. I've even used a send chat message telling me the mob state just to see if it works, and the chat indicates the it does indeed change the synced data variable.

As for the display conditions of the additional textures, it's simply return whether the synced data = # (1 for the first model layer and 2 for the second respectively, each number in their own display conditions).

So far, I've only seen the texture appear for a split-second, if at all. How do I fix this?

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make your entity base…
Tue, 07/07/2026 - 21:10

Make your entity base texture blank, then add the original base texture as another model layer, ie synced data = 0 and see if that fixes it