Skip to content

Commit

Permalink
fix: bobbing in water not resetting fall-distance
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Sep 2, 2024
1 parent 3e94fb1 commit 7faafe5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions patches/server/0002-Block-Falldamage-tweaks.patch
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ index 0e0c9a54df98413b0ad4d195dd5ba21132cf4065..027d4e5dffb0d7f085b9a7792ad61b90
return this.tags;
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 6c280abdef5f80b668d6090f9d35283a33e21e0c..460091ab362965032ea64823c24fc872dbc84c93 100644
index 6c280abdef5f80b668d6090f9d35283a33e21e0c..ae6cb670bcd24a422a5b126a38d4633968d70e5c 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -333,6 +333,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
Expand All @@ -91,19 +91,20 @@ index 6c280abdef5f80b668d6090f9d35283a33e21e0c..460091ab362965032ea64823c24fc872
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
this.chatVisibility = ChatVisiblity.FULL;
@@ -1645,6 +1649,11 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
@@ -1645,6 +1649,12 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
this.spawnExtraParticlesOnFall = false;
}

+ if (hasLandedInLiquid()) {
+ if (fallDistance < getMaxFallDistance() || getBlockStateOn().liquid()) onGround = false;
+ if (getBlockStateOn().liquid() && isEyeInFluid(FluidTags.WATER)) onGround = true;
+ if (fallDistance < getMaxFallDistance() && level().getBlockStates(this.getBoundingBox().move(0,-2,0)).allMatch(b -> b.liquid() || b.isSolid())) onGround = true;
+ else if (fallDistance < getMaxFallDistance() || getBlockStateOn().liquid()) onGround = false;
+ if (getBlockStateOn().liquid() && (isEyeInFluid(FluidTags.WATER))) onGround = true;
+ if (getBlockStateOn().isSolid()) onGround = true;
+ }
super.checkFallDamage(yDifference, onGround, iblockdata, blockposition);
}
}
@@ -1654,7 +1663,8 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
@@ -1654,7 +1664,8 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
super.onExplosionHit(entity);
this.currentImpulseImpactPos = this.position();
this.currentExplosionCause = entity;
Expand Down

0 comments on commit 7faafe5

Please sign in to comment.