How to calculate a number of blocks (air) from surface block to player (for y coordinate)

Started by AAAAAAAAA on

Topic category: Help with MCreator software

Last seen on 10:27, 4. Mar 2023
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to calculate a number of blocks (air) from surface block to player (for y coordinate)

Hello, anyone can help me? How to calculate a number of blocks (air) from surface block to player (for y coordinate)

Last seen on 10:30, 28. Mar 2024
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
here's how I would approach…
Mon, 01/09/2023 - 18:50

here's how I would approach the problem:

first, subtract the player y value from the surface height. if the value is positive, start at the player, and make a loop that checks each block between the player and the surface. every time the loop detects air, add one to a variable. if the value for the initial subtraction is negative, do the same thing except starting at the surface and going up to the player.

Last seen on 10:27, 4. Mar 2023
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
But what if player fly or…
Mon, 01/09/2023 - 19:55

But what if player fly or very high?