From 9d779a4879dbad2c0d18d5c4a6ad9179549e879a Mon Sep 17 00:00:00 2001 From: jannis Date: Wed, 28 Oct 2026 22:07:45 +0100 Subject: [PATCH] fixed root cause of knockback issue in high ground --- .../types/highGround/HighGround.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/eu/mhsl/minenet/minigames/instance/game/stateless/types/highGround/HighGround.java b/src/main/java/eu/mhsl/minenet/minigames/instance/game/stateless/types/highGround/HighGround.java index 712f8c4..e13986e 100644 --- a/src/main/java/eu/mhsl/minenet/minigames/instance/game/stateless/types/highGround/HighGround.java +++ b/src/main/java/eu/mhsl/minenet/minigames/instance/game/stateless/types/highGround/HighGround.java @@ -9,6 +9,7 @@ import io.github.togar2.pvp.events.FinalAttackEvent; import io.github.togar2.pvp.events.PrepareAttackEvent; import io.github.togar2.pvp.feature.CombatFeatures; import io.github.togar2.pvp.feature.knockback.KnockbackSettings; +import net.minestom.server.ServerFlag; import net.minestom.server.coordinate.Pos; import net.minestom.server.entity.Player; import net.minestom.server.event.instance.InstanceTickEvent; @@ -52,16 +53,16 @@ class HighGround extends StatelessGame { this.eventNode().addListener( EntityKnockbackEvent.class, entityKnockbackEvent -> { - if(entityKnockbackEvent.getEntity().getVelocity().y() > 4) { entityKnockbackEvent.setCancelled(true); return; } + double tps = ServerFlag.SERVER_TICKS_PER_SECOND; entityKnockbackEvent.setSettings( - KnockbackSettings.builder() - .horizontal(1.1) - .vertical(0) - .verticalLimit(0) - .extraHorizontal(0.5) - .extraVertical(0) - .build() - ); + KnockbackSettings.builder() + .horizontal(1.1) + .vertical(KnockbackSettings.DEFAULT.vertical() / tps) + .verticalLimit(KnockbackSettings.DEFAULT.verticalLimit() / tps) + .extraHorizontal(KnockbackSettings.DEFAULT.extraHorizontal() / tps) + .extraVertical(KnockbackSettings.DEFAULT.extraVertical() / tps) + .build() + ); } );