3

I am using a repeat command to simulate water breathing with particles, but the particles don't look realistic when the player is swimming with crtl activated, when the player is in walk position it Works perfectly but I didn't find any relative position with x y and z to make it good for both at the same time

The command that I'm using:

/execute as @a at @s run execute if block ~ ~2 ~ water run execute if score aguaa aguaa < 80 constante run particle minecraft:bubble_column_up ~ ~1.8 ~ 0 0 0 0.1 5 force

enter image description here

4
  • 1
    You need to provide the commands you're currently using before we can really help you.
    – MBraedley
    Jan 7, 2020 at 19:13
  • /execute as @a at @s run execute if block ~ ~2 ~ water run execute if score aguaa aguaa < 80 constante run particle minecraft:bubble_column_up ~ ~1.8 ~ 0 0 0 0.1 5 force
    – D3T0NA
    Jan 7, 2020 at 19:49
  • @D3T0NA That doesn't differentiate between walk-swimming and proper swimming. Jan 7, 2020 at 19:51
  • i don´t know how to differentiate that, that´s the problem here, if i knew how to i would have 2 commands ready to display the particle
    – D3T0NA
    Jan 7, 2020 at 19:53

1 Answer 1

4

/execute anchored eyes can do this (and it seems to be the only way to detect when a player is swimming).
This command does something at the nearest player's head position, which is properly adjusted to swimming, crawling, elytra and sneaking:

/execute as @p at @s anchored eyes run <command>

Now the trick: The anchor only works with the rotationally relative coordinates (^ ^ ^), not with the axis relative coordinates (~ ~ ~), so if you don't use those coordinates in your "<command>" part anyway, you need to align it like this:

/execute as @p at @s anchored eyes positioned ^ ^ ^ run <command>

The "as" part is also needed, because the anchor needs an entity reference to know the eye height.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .