From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cryptite Date: Tue, 25 Apr 2023 08:17:39 -0500 Subject: [PATCH] Add Preventing KB Bonus to PlayerPreAttackEntityEvent diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java index 32d6615ea73c1c149049d16dfd1b395621ad634b..0325086157b846da7da0ca291fd33c55fc91f229 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1275,7 +1275,11 @@ public abstract class Player extends LivingEntity { boolean flag = f2 > 0.9F; boolean flag1 = false; byte b0 = 0; - int i = b0 + EnchantmentHelper.getKnockbackBonus(this); + int i = b0; // Slice start + if (!playerAttackEntityEvent.isPreventKnockbackBonus()) { + i += EnchantmentHelper.getKnockbackBonus(this); + } + // Slice end if (this.isSprinting() && flag) { sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility