From aab1f8db99b8006903e219bc235bbfd2c0604b06 Mon Sep 17 00:00:00 2001 From: hayanesuru Date: Mon, 12 May 2025 14:56:01 +0900 Subject: [PATCH] cleanup and rebase --- .../0171-flush-location-while-knockback.patch | 37 +++++++++++++++++++ ...tch => 0172-Only-tick-items-at-hand.patch} | 2 +- ...art-sort-items-in-NearestItemSensor.patch} | 0 ...174-Optimise-player-movement-checks.patch} | 0 ...e-and-flush-location-while-knockback.patch | 36 ------------------ 5 files changed, 38 insertions(+), 37 deletions(-) create mode 100644 leaf-server/minecraft-patches/features/0171-flush-location-while-knockback.patch rename leaf-server/minecraft-patches/features/{0171-Only-tick-items-at-hand.patch => 0172-Only-tick-items-at-hand.patch} (95%) rename leaf-server/minecraft-patches/features/{0172-Smart-sort-items-in-NearestItemSensor.patch => 0173-Smart-sort-items-in-NearestItemSensor.patch} (100%) rename leaf-server/minecraft-patches/features/{0173-Optimise-player-movement-checks.patch => 0174-Optimise-player-movement-checks.patch} (100%) delete mode 100644 leaf-server/minecraft-patches/features/0174-move-and-flush-location-while-knockback.patch diff --git a/leaf-server/minecraft-patches/features/0171-flush-location-while-knockback.patch b/leaf-server/minecraft-patches/features/0171-flush-location-while-knockback.patch new file mode 100644 index 00000000..27a24946 --- /dev/null +++ b/leaf-server/minecraft-patches/features/0171-flush-location-while-knockback.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Taiyou06 +Date: Sun, 11 May 2025 19:45:58 +0200 +Subject: [PATCH] flush location while knockback + + +diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java +index 477455fdfcc591a89823e88983eb12dabb078d9b..67c4cbb8ed6131b639b01e4fc0cbf56057a3fe03 100644 +--- a/net/minecraft/world/entity/player/Player.java ++++ b/net/minecraft/world/entity/player/Player.java +@@ -1412,6 +1412,13 @@ public abstract class Player extends LivingEntity { + } + + if (!cancelled) { ++ // Leaf start ++ if (org.dreeam.leaf.config.modules.gameplay.Knockback.flushKnockback && target instanceof ServerPlayer targetPlayer && this instanceof ServerPlayer player1) { ++ targetPlayer.connection.send(net.minecraft.network.protocol.game.ClientboundEntityPositionSyncPacket.of(this)); ++ player1.connection.send(new net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket(targetPlayer)); ++ player1.connection.send(net.minecraft.network.protocol.game.ClientboundEntityPositionSyncPacket.of(targetPlayer)); ++ } ++ // Leaf end + ((ServerPlayer)target).connection.send(new ClientboundSetEntityMotionPacket(target)); + target.hurtMarked = false; + target.setDeltaMovement(deltaMovement); +@@ -1480,6 +1487,12 @@ public abstract class Player extends LivingEntity { + } + + this.causeFoodExhaustion(this.level().spigotConfig.combatExhaustion, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value ++ // Leaf start ++ if (org.dreeam.leaf.config.modules.gameplay.Knockback.flushKnockback && this instanceof ServerPlayer player1 && target instanceof ServerPlayer target1) { ++ target1.connection.connection.flushChannel(); ++ player1.connection.connection.flushChannel(); ++ } ++ // Leaf end + } else { + this.sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility + // CraftBukkit start - resync on cancelled event diff --git a/leaf-server/minecraft-patches/features/0171-Only-tick-items-at-hand.patch b/leaf-server/minecraft-patches/features/0172-Only-tick-items-at-hand.patch similarity index 95% rename from leaf-server/minecraft-patches/features/0171-Only-tick-items-at-hand.patch rename to leaf-server/minecraft-patches/features/0172-Only-tick-items-at-hand.patch index 431f852c..93a52c64 100644 --- a/leaf-server/minecraft-patches/features/0171-Only-tick-items-at-hand.patch +++ b/leaf-server/minecraft-patches/features/0172-Only-tick-items-at-hand.patch @@ -26,7 +26,7 @@ index 95e03045bcbee74ddac36ae36ce8c8c2f5769fa4..6eee16dccef1d0f04ba3532f5ee06447 } } diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java -index 477455fdfcc591a89823e88983eb12dabb078d9b..9e62fe46eb9883ade81c1c9ff0f8220ed34b5d85 100644 +index 67c4cbb8ed6131b639b01e4fc0cbf56057a3fe03..8bab487a1d77d8227bf9426d0218e906db034982 100644 --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java @@ -631,7 +631,12 @@ public abstract class Player extends LivingEntity { diff --git a/leaf-server/minecraft-patches/features/0172-Smart-sort-items-in-NearestItemSensor.patch b/leaf-server/minecraft-patches/features/0173-Smart-sort-items-in-NearestItemSensor.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0172-Smart-sort-items-in-NearestItemSensor.patch rename to leaf-server/minecraft-patches/features/0173-Smart-sort-items-in-NearestItemSensor.patch diff --git a/leaf-server/minecraft-patches/features/0173-Optimise-player-movement-checks.patch b/leaf-server/minecraft-patches/features/0174-Optimise-player-movement-checks.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0173-Optimise-player-movement-checks.patch rename to leaf-server/minecraft-patches/features/0174-Optimise-player-movement-checks.patch diff --git a/leaf-server/minecraft-patches/features/0174-move-and-flush-location-while-knockback.patch b/leaf-server/minecraft-patches/features/0174-move-and-flush-location-while-knockback.patch deleted file mode 100644 index 00f995a1..00000000 --- a/leaf-server/minecraft-patches/features/0174-move-and-flush-location-while-knockback.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Taiyou06 -Date: Sun, 11 May 2025 19:45:58 +0200 -Subject: [PATCH] move and flush location while knockback - - -diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java -index 9e62fe46eb9883ade81c1c9ff0f8220ed34b5d85..fb61bf4b69033d856e2ed424a0557d1f6a27e4e7 100644 ---- a/net/minecraft/world/entity/player/Player.java -+++ b/net/minecraft/world/entity/player/Player.java -@@ -1420,6 +1420,25 @@ public abstract class Player extends LivingEntity { - ((ServerPlayer)target).connection.send(new ClientboundSetEntityMotionPacket(target)); - target.hurtMarked = false; - target.setDeltaMovement(deltaMovement); -+ -+ // Leaf start -+ if (org.dreeam.leaf.config.modules.gameplay.Knockback.flushKnockback) { -+ ServerPlayer targetPlayer = (ServerPlayer) target; -+ Vec3 before = targetPlayer.getDeltaMovement(); -+ targetPlayer.aiStep(); -+ targetPlayer.setDeltaMovement(before); -+ targetPlayer.connection.send(new net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket(this)); -+ targetPlayer.connection.send(net.minecraft.network.protocol.game.ClientboundEntityPositionSyncPacket.of(this)); -+ targetPlayer.connection.resumeFlushing(); -+ targetPlayer.hasImpulse = true; -+ if (this instanceof ServerPlayer player1) { -+ player1.connection.send(new net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket(targetPlayer)); -+ player1.connection.send(net.minecraft.network.protocol.game.ClientboundEntityPositionSyncPacket.of(targetPlayer)); -+ player1.connection.resumeFlushing(); -+ player1.hasImpulse = true; -+ } -+ } -+ // Leaf end - } - // CraftBukkit end - }