9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-27 19:09:22 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0241-Flush-location-while-knockback.patch
Dreeam ccf2f9c0d2 Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@a9399451 Fixup sendAllDataToRemote calls
PaperMC/Paper@cb47e018 Remove more dead code, fix pre-existing desync when cancelling and closing container
PaperMC/Paper@40764534 Specify the class loader when loading services (#12829)
PaperMC/Paper@1bf6364b Update Mache for horse decompile fix
PaperMC/Paper@76fb5060 Add vanilla error message to precondition for DialogBaseImpl (#12831)

Purpur Changes:
PurpurMC/Purpur@5b26bab8 Updated Upstream (Paper)
PurpurMC/Purpur@8734844b sigh...
PurpurMC/Purpur@09ea9cb9 fix mobs not burning in daylight (#1689)
PurpurMC/Purpur@4d5a8e6e Updated Upstream (Paper)
PurpurMC/Purpur@7dbe4153 Add support for "/chase", a disabled Minecraft command. (#1690)
PurpurMC/Purpur@11c030a8 Updated Upstream (Paper)
2025-07-12 18:14:29 +08:00

38 lines
2.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taiyou06 <kaandindar21@gmail.com>
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 6c9dfd76596b2e890b0b0dad5d98e8785a68c5a1..731f50fa6786557db0a1745442b2ad61a6685375 100644
--- a/net/minecraft/world/entity/player/Player.java
+++ b/net/minecraft/world/entity/player/Player.java
@@ -1363,6 +1363,13 @@ public abstract class Player extends LivingEntity {
}
if (!cancelled) {
+ // Leaf start - Flush location while knockback
+ 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 - Flush location while knockback
((ServerPlayer)target).connection.send(new ClientboundSetEntityMotionPacket(target));
target.hurtMarked = false;
target.setDeltaMovement(deltaMovement);
@@ -1431,6 +1438,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 - Flush location while knockback
+ 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 - Flush location while knockback
} else {
sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
// CraftBukkit end