How do I limit a number from exceeding a certain value

Started by Disevro on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I limit a number from exceeding a certain value

In this case, I'm trying to keep a player's velocity from becoming too high since the system using the velocity is multiplying the current player velocity by a number to produce a sort of dash. The current solution I've come up with so far limits the speed well, but also limits the direction of dashing to only 4 directions, creating odd moments where dashing appears to send you at an angle instead of the direction you wanted to dash.

https://drive.google.com/file/d/1SX67BgaBp6Wu0MFGKr7ZH9V5W8zvVpy8/view?usp=sharing

Image of my solution so far.

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't have access to your…
Fri, 02/02/2024 - 01:05

I don't have access to your image, so my best advice is to use the Pythagorean theorem to calculate speed. That's all I can give you for now. 

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I can't find X and Z…
Fri, 02/02/2024 - 01:36

I can't find X and Z velocity in MCreator.

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
X and Z velocities are…
Fri, 02/02/2024 - 01:52

X and Z velocities are located in the entity data section