How to make a entity never stop moving?

Started by Pruinosus on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make a entity never stop moving?

I'm trying to make a fish that will not stop swimming ever, because my fish will kinda just float in the water when its not moving. Any chance there is a way to do this?

Thanks!

 

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could manually add…
Tue, 07/18/2023 - 02:38

You could manually add velocity if the fish's velocity gets too low. I custom coded dragonflies in a similar way: make a procedure for the entity's update tick. In that procedure:

  • You first need to check if the mob's velocity is below your desired amount. To do this, take the absolute value of the mob's x, y, and z velocities, and add them all together, then check if this is less than your desired speed.
  • If it is, use the Attempt to Override Motion Vector block to add velocity to the entity. There are a couple of ways you can do this. If you want it to look sort of natural, I recommend first randomizing the mob's rotation, adding slightly randomized y velocity, then adding x and z velocity equal to the X Look Angle Vector and Z Look Angle Vector; which will cause the entity to move in the direction it's looking. (You can multiply or divide these to decrease the strength of the movement.)
  • ...Alternatively, you could create an invisible entity that despawns after a couple of seconds. In the AI setting have your fish avoid this entity, and in the update tick, have it create one of these if it's moving too slowly and there isn't another one nearby.
Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you, ill try that! (:
Tue, 07/18/2023 - 23:04

Thank you, ill try that! (:

Joined Jul 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Would somebody mind posting…
Fri, 08/16/2024 - 19:23

Would somebody mind posting a visual example of this procedure? I'm really struggling to translate this into a procedure rn with my lizard brain?