2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Sudzzy <originmc@outlook.com>
|
|
|
|
Date: Wed, 2 Mar 2016 14:48:03 -0600
|
|
|
|
Subject: [PATCH] Disable explosion knockback
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
2023-06-07 20:31:32 +02:00
|
|
|
index 3fa9f639a598294b4956c6525fc8a630ae10da2d..da488c4dbf8f6c36cb7cfa64be1645be8a7e4ecf 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
2023-06-07 20:31:32 +02:00
|
|
|
@@ -1454,10 +1454,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-14 23:13:41 +01:00
|
|
|
+ boolean knockbackCancelled = level.paperConfig().environment.disableExplosionKnockback && source.is(DamageTypeTags.IS_EXPLOSION) && this instanceof net.minecraft.world.entity.player.Player; // Paper - Disable explosion knockback
|
2021-06-11 14:02:28 +02:00
|
|
|
if (flag1) {
|
|
|
|
if (flag) {
|
2023-06-07 20:31:32 +02:00
|
|
|
this.level().broadcastEntityEvent(this, (byte) 29);
|
2023-03-14 19:36:39 +01:00
|
|
|
} else {
|
2021-06-11 14:02:28 +02:00
|
|
|
+ if (!knockbackCancelled) // Paper - Disable explosion knockback
|
2023-06-07 20:31:32 +02:00
|
|
|
this.level().broadcastDamageEvent(this, source);
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2023-06-07 20:31:32 +02:00
|
|
|
@@ -1481,6 +1483,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (knockbackCancelled) this.level.broadcastEntityEvent(this, (byte) 2); // Paper - Disable explosion knockback
|
|
|
|
if (this.isDeadOrDying()) {
|
|
|
|
if (!this.checkTotemDeathProtection(source)) {
|
|
|
|
SoundEvent soundeffect = this.getDeathSound();
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
2023-06-07 20:31:32 +02:00
|
|
|
index 925d37ca684e7e6a3ad88e6e040f3599225f0b1d..401076c5350429052994d98c414a83a21f908010 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
2023-03-14 19:36:39 +01:00
|
|
|
@@ -262,7 +262,7 @@ public class Explosion {
|
2021-06-11 14:02:28 +02:00
|
|
|
if (entity instanceof LivingEntity) {
|
2023-03-14 19:36:39 +01:00
|
|
|
LivingEntity entityliving = (LivingEntity) entity;
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2023-03-14 19:36:39 +01:00
|
|
|
- d14 = ProtectionEnchantment.getExplosionKnockbackAfterDampener(entityliving, d13);
|
|
|
|
+ d14 = entity instanceof Player && level.paperConfig().environment.disableExplosionKnockback ? 0 : ProtectionEnchantment.getExplosionKnockbackAfterDampener(entityliving, d13); // Paper - disable explosion knockback
|
|
|
|
} else {
|
|
|
|
d14 = d13;
|
|
|
|
}
|
|
|
|
@@ -276,7 +276,7 @@ public class Explosion {
|
2021-06-11 14:02:28 +02:00
|
|
|
if (entity instanceof Player) {
|
|
|
|
Player entityhuman = (Player) entity;
|
|
|
|
|
2021-06-12 02:57:04 +02:00
|
|
|
- if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying)) {
|
2022-06-09 10:51:45 +02:00
|
|
|
+ if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying) && !level.paperConfig().environment.disableExplosionKnockback) { // Paper - Disable explosion knockback
|
2023-03-14 19:36:39 +01:00
|
|
|
this.hitPlayers.put(entityhuman, vec3d1);
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
}
|