#underwater entity that hides

1 messages · Page 1 of 1 (latest)

mild glade
#

i need an underwater entity when scared (detects an entity nearby) will play an animation, sink to the bottom and stay still until not scared

placid flume
#

Do you want it to play an animation or just sink to the bottom?

noble plume
#

minecraft:timer - to play an event after the animation plays
minecraft:behavior.avoid_mob_type - entity avoiding the player

mild glade
placid flume
#

Here's how I would do it.

If it's a floating entity that is on the surface of the water all the time. Use "minecraft:buoyant"

What you can do is add it in a component group that spawns alongside this entity. Add two events after that decided when to remove this component group.

Something like:
"component_groups": {
"sample:is_floating": {
"minecraft:buoyant":{}
}
},

and the Events:

"events":{
"minecraft:entity_spawned":{
"add":{
"component_groups":[
"sample:is_floating"
]
},
"sample:sink_to_bottom":{
"remove":{
"component_groups":[
"sample:is_floating"
]
},
"run_command":{
"command":[
"/playanimation (whatever animation you want it to play)"
]
}
}

You can try this out I suppose. Haven't tried it myself or checked for errors in the syntax.

#

If you want an entity that CAN float, something that swims around. Same concept, just add the components that make it float in the component group and once you remove/replace those components it should force the entity to sink.