Need help making a ground distance detector



  • I'm making a data pack where some players cannot take fall damage. I don't want to use resistance 5 or jump boost 255 as there needs to be PVP and jump boost 255 will launch you in the air with PVP.

    My solution is to calculate the amount of fall damage that will be taken. e.g 5 blocks, one heart, and add that on to their existing health with the /attribute command. However, I cannot find any tutorials on how to detect this distance. Can anybody link a multiplayer-friendly tutorial or give a better solution?

    TL;DR: Need no fall damage solution for one specific person in multiplayer



  • Since players can't jump while in the air, you can use a command block to give players them the jump boost effect only while in the air, where it will reduce fall damage but have no impact on jumping. To do this, run these commands every tick:

    /effect give @a[...,nbt={OnGround:0b}] jump_boost 1 255
    /effect clear @a[...,nbt={OnGround:1b}] jump_boost
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2