24 lines
1.3 KiB
Diff
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 433cca813b5c56aadc6c4b44ff5eb19b4d1f67a6..2a6a85519c63bd3f879a8dbe146a9d05310cee3c 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
|