#[Solved?] How can i change an entity texture depending on the entity health

1 messages · Page 1 of 1 (latest)

lament isle
#

Basically i want to make an entity have the same damaged texture as iron golem did

#

Never found anyone ask for it.

#

So why dont I...

#

Eh wait a min.. Should i put it at #1067869022273667152?

night heron
#

@lament isle you have to use query.health in the render controller

#
{
  "format_version": "1.8.0",
  "render_controllers": {
    "controller.render.iron_golem_cracks": {
      "arrays": {
        "textures": {
          "Array.cracks": [
            "Texture.cracked_high",
            "Texture.cracked_med",
            "Texture.cracked_low",
            "Texture.cracked_none"
          ]
        }
      },
      "geometry": "Geometry.default",
      "textures": [ "Array.cracks[math.clamp(query.health / 25, 0, 3)]" ]
    }
  }
}```
lament isle
night heron
#

What part?

lament isle
#

The math.clamp

night heron
#

So iron golem has a health value of 100

lament isle
#

mhm

night heron
#

If you divide that by 25

#

It turns to 4

lament isle
#

ok...

#

What thats 4 for?

night heron
#

The number of textures that you're going to be using

#

The array helps with adding those 4 textures

lament isle
#

So it gonna use texture.cracked_none?

night heron
#

Yeah so that's the regular iron golem texture

lament isle
#

Oh ok
What about the 0 and 3?

night heron
#

0 is texture.cracked_high

#

3 is texture.cracked_none

lament isle
#

hm..

night heron
#

So look at the texture list

#

The array always starts as a value of 0

lament isle
#

Oooh so its 0 first

night heron
#

math.clamp(value, min, max) = Clamp value to between min and max inclusive

lament isle
#

mhm

night heron
#

and as the health goes down, the 3 goes to 2 then 1 and 0 below or at a health value of 25

lament isle
#

ohh oke ok

night heron
#

good to go?

lament isle
#

Alr

#

Thx

lament isle
#

[Solved?] How can i change an entity texture depending on the entity health

night heron
#

@lament isle let me know if you have questions

lament isle
night heron
#

Also send me a picture of your mob

#

We may need to create a custom material for this

lament isle
night heron
#

Hmm I think it would be a bit tricky with the shulker because it has several textures, you may need to add an overlay texture to optimize it

night heron
lament isle