9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-31 04:46:38 +00:00

cleanup and rebase

This commit is contained in:
hayanesuru
2025-05-12 14:56:01 +09:00
parent af016b1178
commit aab1f8db99
5 changed files with 38 additions and 37 deletions

View File

@@ -0,0 +1,37 @@
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 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

View File

@@ -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 {

View File

@@ -1,36 +0,0 @@
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] 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
}