Fix riptide false positives, improved performance

This commit is contained in:
Rammelkast committed 2020-11-25 19:08:55 +01:00
1 parent bd1db83a98
commit 7e1f0d83ce
7 files changed
+29 -76

No files matched your search

@@ -93,6 +93,8 @@ public class MovementManager {
public boolean hasIncreasingEffect = false;
// If the player had a speed increasing effect previous tick
public boolean hadIncreasingEffect = false;
// Riptiding ticks
public int riptideTicks;
// Time of last update
public long lastUpdate;
@@ -182,6 +184,17 @@ public class MovementManager {
this.nearLiquidTicks = 0;
}
if (VersionUtil.CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
if (player.isRiptiding()) {
this.riptideTicks = 30;
} else {
if (this.riptideTicks > 0)
this.riptideTicks--;
else
this.riptideTicks = 0;
}
}
this.hadSpeedEffect = this.hasSpeedEffect;
this.hasSpeedEffect = player.hasPotionEffect(PotionEffectType.SPEED);