Paper/patches/server/0035-Disable-explosion-knockback.patch

56 lines
3.3 KiB
Diff
Raw Normal View History

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
index c7017b86a3268aef0baff2ae0a56155aafc6a067..4731869c1bd3b8abdd2a5133fd551a2a534a6b41 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
2022-06-07 21:15:06 +02:00
@@ -1399,6 +1399,7 @@ public abstract class LivingEntity extends Entity {
2021-06-11 14:02:28 +02:00
}
}
+ boolean knockbackCancelled = level.paperConfig().environment.disableExplosionKnockback && source.isExplosion() && this instanceof net.minecraft.world.entity.player.Player; // Paper - Disable explosion knockback
2021-06-11 14:02:28 +02:00
if (flag1) {
if (flag) {
this.level.broadcastEntityEvent(this, (byte) 29);
2022-06-07 21:15:06 +02:00
@@ -1419,6 +1420,7 @@ public abstract class LivingEntity extends Entity {
2021-06-11 14:02:28 +02:00
b0 = 2;
}
+ if (!knockbackCancelled) // Paper - Disable explosion knockback
this.level.broadcastEntityEvent(this, b0);
}
2022-06-07 21:15:06 +02:00
@@ -1442,6 +1444,7 @@ public abstract class LivingEntity extends Entity {
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
index db7a025cd064c898e33037133b65eecc3702542d..af9645a3ef9dab1134977b30937f15fa3fa27a95 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
2022-06-07 21:15:06 +02:00
@@ -260,14 +260,14 @@ public class Explosion {
2021-06-11 14:02:28 +02:00
double d14 = d13;
if (entity instanceof LivingEntity) {
- d14 = ProtectionEnchantment.getExplosionKnockbackAfterDampener((LivingEntity) entity, d13);
+ d14 = entity instanceof Player && level.paperConfig().environment.disableExplosionKnockback ? 0 : ProtectionEnchantment.getExplosionKnockbackAfterDampener((LivingEntity) entity, d13); // Paper - Disable explosion knockback
2021-06-11 14:02:28 +02:00
}
entity.setDeltaMovement(entity.getDeltaMovement().add(d8 * d14, d9 * d14, d10 * d14));
if (entity instanceof Player) {
Player entityhuman = (Player) entity;
2021-06-12 02:57:04 +02:00
- if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying)) {
+ if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying) && !level.paperConfig().environment.disableExplosionKnockback) { // Paper - Disable explosion knockback
2021-06-11 14:02:28 +02:00
this.hitPlayers.put(entityhuman, new Vec3(d8 * d13, d9 * d13, d10 * d13));
}
}