mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-06 15:51:31 +00:00
update flush knockback
This commit is contained in:
@@ -5,32 +5,40 @@ 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
|
||||
index 477455fdfcc591a89823e88983eb12dabb078d9b..fdc9c68a0ed30b8b342ceaca5d988e82524d6bf9 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 {
|
||||
@@ -1411,6 +1411,20 @@ public abstract class Player extends LivingEntity {
|
||||
player.setVelocity(event.getVelocity());
|
||||
}
|
||||
|
||||
+
|
||||
+ // Leaf start
|
||||
+ if (org.dreeam.leaf.config.modules.gameplay.Knockback.flushKnockback) {
|
||||
+ if (org.dreeam.leaf.config.modules.gameplay.Knockback.flushKnockback && !cancelled && this instanceof ServerPlayer player1) {
|
||||
+ ServerPlayer target1 = (ServerPlayer) target;
|
||||
+ Vec3 before = target1.getDeltaMovement();
|
||||
+ var targetV = target1.getDeltaMovement();
|
||||
+ target1.aiStep();
|
||||
+ target1.setDeltaMovement(before);
|
||||
+ target1.connection.send(new net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket(this));
|
||||
+ target1.setDeltaMovement(targetV);
|
||||
+ target1.connection.send(net.minecraft.network.protocol.game.ClientboundEntityPositionSyncPacket.of(this));
|
||||
+ target1.connection.resumeFlushing();
|
||||
+ player1.connection.send(net.minecraft.network.protocol.game.ClientboundEntityPositionSyncPacket.of(target1));
|
||||
+ player1.connection.send(new ClientboundSetEntityMotionPacket(target1));
|
||||
+ player1.hasImpulse = true;
|
||||
+ 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;
|
||||
@@ -1480,6 +1494,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 && target instanceof ServerPlayer target1 && this instanceof ServerPlayer player1) {
|
||||
+ 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
|
||||
|
||||
Reference in New Issue
Block a user