From f955b1f2aec82fc180d5fcfa781b34bbe7b2285e Mon Sep 17 00:00:00 2001 From: Bloepiloepi <59421074+Bloepiloepi@users.noreply.github.com> Date: Wed, 18 Aug 2021 20:37:16 +0200 Subject: [PATCH 1/3] Fix knockback strength --- src/main/java/net/minestom/server/entity/Entity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minestom/server/entity/Entity.java b/src/main/java/net/minestom/server/entity/Entity.java index 467ba35ad..efc050fa9 100644 --- a/src/main/java/net/minestom/server/entity/Entity.java +++ b/src/main/java/net/minestom/server/entity/Entity.java @@ -1431,7 +1431,7 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler //TODO check possible side effects of unnatural TPS (other than 20TPS) final Vec velocityModifier = new Vec(x, z) .normalize() - .mul(strength * MinecraftServer.TICK_PER_SECOND / 2); + .mul(strength * MinecraftServer.TICK_PER_SECOND); setVelocity(new Vec(velocity.x() / 2d - velocityModifier.x(), onGround ? Math.min(.4d, velocity.y() / 2d + strength) * MinecraftServer.TICK_PER_SECOND : velocity.y(), velocity.z() / 2d - velocityModifier.z() From 1b8cc19a545fc96a662dd4c06e3d2c53d569851f Mon Sep 17 00:00:00 2001 From: Bloepiloepi <59421074+Bloepiloepi@users.noreply.github.com> Date: Wed, 18 Aug 2021 20:44:45 +0200 Subject: [PATCH 2/3] Fix air drag when not onground --- src/main/java/net/minestom/server/entity/Entity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minestom/server/entity/Entity.java b/src/main/java/net/minestom/server/entity/Entity.java index efc050fa9..9057fd52d 100644 --- a/src/main/java/net/minestom/server/entity/Entity.java +++ b/src/main/java/net/minestom/server/entity/Entity.java @@ -556,8 +556,9 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler // Stop player velocity this.velocity = Vec.ZERO; } else { + final double airDrag = this instanceof LivingEntity ? 0.91 : 0.98; final double drag = this.onGround ? - finalChunk.getBlock(position).registry().friction() : 0.91; + finalChunk.getBlock(position).registry().friction() : airDrag; this.velocity = newVelocity // Convert from block/tick to block/sec .mul(tps) From 66fab0672c737cb6dfbfe59a7fc718ebf4726918 Mon Sep 17 00:00:00 2001 From: Bloepiloepi <59421074+Bloepiloepi@users.noreply.github.com> Date: Fri, 20 Aug 2021 14:56:27 +0200 Subject: [PATCH 3/3] Revert "Fix knockback strength" This reverts commit f955b1f2 --- src/main/java/net/minestom/server/entity/Entity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minestom/server/entity/Entity.java b/src/main/java/net/minestom/server/entity/Entity.java index 9057fd52d..5192774cc 100644 --- a/src/main/java/net/minestom/server/entity/Entity.java +++ b/src/main/java/net/minestom/server/entity/Entity.java @@ -1432,7 +1432,7 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler //TODO check possible side effects of unnatural TPS (other than 20TPS) final Vec velocityModifier = new Vec(x, z) .normalize() - .mul(strength * MinecraftServer.TICK_PER_SECOND); + .mul(strength * MinecraftServer.TICK_PER_SECOND / 2); setVelocity(new Vec(velocity.x() / 2d - velocityModifier.x(), onGround ? Math.min(.4d, velocity.y() / 2d + strength) * MinecraftServer.TICK_PER_SECOND : velocity.y(), velocity.z() / 2d - velocityModifier.z()