9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0171-send-and-flush-position-while-knockback-player.patch
2025-05-11 01:34:16 +09:00

37 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: hayanesuru <hayanesuru@outlook.jp>
Date: Thu, 8 May 2025 04:56:30 +0900
Subject: [PATCH] send and flush position while knockback player
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
index 477455fdfcc591a89823e88983eb12dabb078d9b..789eed2336c31c486ea09eff7744d2e2146506cc 100644
--- a/net/minecraft/world/entity/player/Player.java
+++ b/net/minecraft/world/entity/player/Player.java
@@ -1411,6 +1411,25 @@ public abstract class Player extends LivingEntity {
player.setVelocity(event.getVelocity());
}
+
+ // Leaf start
+ if (org.dreeam.leaf.config.modules.gameplay.Knockback.flushKnockback) {
+ ServerPlayer target1 = (ServerPlayer) target;
+ Vec3 before = target1.getDeltaMovement();
+ target1.aiStep();
+ target1.setDeltaMovement(before);
+ target1.connection.send(new net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket(this));
+ target1.connection.send(net.minecraft.network.protocol.game.ClientboundEntityPositionSyncPacket.of(this));
+ target1.connection.resumeFlushing();
+ target1.hasImpulse = true;
+ if (this instanceof ServerPlayer player1) {
+ player1.connection.send(new net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket(target1));
+ player1.connection.send(net.minecraft.network.protocol.game.ClientboundEntityPositionSyncPacket.of(target1));
+ player1.connection.resumeFlushing();
+ player1.hasImpulse = true;
+ }
+ }
+ // Leaf end
if (!cancelled) {
((ServerPlayer)target).connection.send(new ClientboundSetEntityMotionPacket(target));
target.hurtMarked = false;