Skip to content

Commit

Permalink
Disable terrain, stall and void damage detection when touching water
Browse files Browse the repository at this point in the history
Signed-off-by: Octol1ttle <[email protected]>
  • Loading branch information
Octol1ttle committed Mar 1, 2024
1 parent 2a73f19 commit 83207b4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public boolean shouldBlockPitchChanges() {
}

private float computeDescentImpactTime() {
if (!data.isFlying) {
if (!data.isFlying || data.player.isTouchingWater()) {
return STATUS_UNKNOWN;
}
if (data.player.isInvulnerableTo(data.player.getDamageSources().fall())) {
Expand All @@ -94,7 +94,7 @@ private float computeDescentImpactTime() {
}

private float computeTerrainImpactTime() {
if (!data.isFlying) {
if (!data.isFlying || data.player.isTouchingWater()) {
return STATUS_UNKNOWN;
}
if (data.player.isInvulnerableTo(data.player.getDamageSources().flyIntoWall())) {
Expand All @@ -120,7 +120,7 @@ private float computeTerrainImpactTime() {
}

private boolean computeFireworkUseSafe() {
if (!data.isFlying) {
if (!data.isFlying || data.player.isTouchingWater()) {
return true;
}
if (data.player.isInvulnerableTo(data.player.getDamageSources().flyIntoWall())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void tick() {
}

private StallStatus computeStalling() {
if (!data.isFlying) {
if (!data.isFlying || data.player.isTouchingWater()) {
return StallStatus.UNKNOWN;
}
if (data.player.isInvulnerableTo(data.player.getDamageSources().fall())) {
Expand All @@ -46,7 +46,7 @@ private StallStatus computeStalling() {
}

private float computeMaximumSafePitch() {
if (!data.isFlying) {
if (!data.isFlying || status == StallStatus.UNKNOWN || status == StallStatus.PLAYER_INVULNERABLE) {
return 90.0f;
}
return status == StallStatus.STALL ? -90.0f : MathHelper.clamp(data.speed * 3.0f, 0.0f, 90.0f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void tick() {
}

private VoidLevelStatus computeStatus() {
if (!data.isFlying) {
if (!data.isFlying || data.player.isTouchingWater()) {
return VoidLevelStatus.UNKNOWN;
}
if (data.player.isInvulnerableTo(data.player.getDamageSources().outOfWorld())) {
Expand Down

0 comments on commit 83207b4

Please sign in to comment.