Files
OldSliceMC/patches/server/0023-Add-Preventing-KB-Bonus-to-PlayerPreAttackEntityEven.patch
2023-12-28 09:58:26 -06:00

24 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
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 04a68a4f0c642984bd2b95bfb0d7d2bd887d18f0..c12b9b70d093217c9c796663341edcfa7fd29932 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1270,7 +1270,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