
Glider often opens unintentionally (with code fix suggestion)
Tim1Blau opened this issue ยท 1 comments
When jumping, the glider often opens unintentionally.
This can be very irritating, especially if the 3rd person switch is enabled.
This is because the glider opens when there is air below the player.
But this check does not work as intended.
Untitled.video.-.Made.with.Clipchamp.mp4
The problem is this, that this code checks the block below the player but the player might be standing on a different block
code:
in: common/src/main/java/net/venturecraft/gliders/util/GliderUtil.java
public static boolean canDeployHere(LivingEntity livingEntity) {
boolean isAir = livingEntity.level.getBlockState(livingEntity.blockPosition().below(2)).isAir() && livingEntity.level.getBlockState(livingEntity.blockPosition().below()).isAir();
boolean updraftAround = nearUpdraft(livingEntity);
boolean isUpdraft = livingEntity.level.getBlockState(livingEntity.blockPosition().below()).is(VCGliderTags.UPDRAFT_BLOCKS);
return isUpdraft || isAir || updraftAround || livingEntity.fallDistance > 2;
}
Fix Suggestion:
Additional check if player is on ground
boolean isAir = !livingEntity.isOnGround() && livingEntity.level.getBlockState(livingEntity.blockPosition().below(2)).isAir() && livingEntity.level.getBlockState(livingEntity.blockPosition().below()).isAir();
Additional Fix for glider not closing when too close to the ground:
return isUpdraft || isAir || updraftAround || livingEntity.fallDistance > 2 || isGliderActive(livingEntity);
Hope you implement this fix :)
Unfortunately i can't open a pull request for this myself.