Madis0 / OneBar

A Minecraft HUD mod for Fabric Loader
Other
7 stars 2 forks source link

Levitation #45

Closed Madis0 closed 1 year ago

Madis0 commented 1 year ago

Levitation is considered a harmful effect due to potential fall damage.

Is there a way to show something useful from it on OneBar?

  1. Destination Y-level - not too hard, example code is below Problems:
    • not very contextual if the user does not have coordinate view enabled
      if(playerEntity.hasStatusEffect(StatusEffects.LEVITATION)){
          var effect = playerEntity.getStatusEffect(StatusEffects.LEVITATION);
          var estHeight = (float) ((effect.getAmplifier() + 1) * 0.9) * ((float) effect.getDuration() / 20);
          estFallDistance = (float) (playerEntity.getY() + estHeight);
      }
  2. Fall height - calculate the distance between est. height and ground level. Problems:
    • Not sure how to get ground level
    • Not sure how to get the ground block (e.g. nullify on water)
    • Distance does not always equal damage, especially for FF4 boots

See also: LivingEntity.class for implementation details

Madis0 commented 1 year ago

Point of consideration: what if levitation displayed it's time as a bar like air/freezing/poison instead of focusing on falling distance at all? Though distance estimate would still be beneficial.

The time should either be a literal effect time or based on shulker bullet's defaults (10 sec). Bar color: dark purple (per elytra's durability color or shulkers' color).

The number/bar width could be the height difference instead of any timely value.

Madis0 commented 1 year ago

Added both levitation and falling distance estimate as separate options in 3.5.0