mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-06 02:42:14 +01:00
54 lines
3.3 KiB
Diff
54 lines
3.3 KiB
Diff
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 5bdebdd16939480afac536ce7aaa4fe720021e74..5dda05f7bf08dec8b48fe0b87aa227c3e0392c6f 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -1444,10 +1444,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
}
|
|
}
|
|
|
|
+ boolean knockbackCancelled = this.level().paperConfig().environment.disableExplosionKnockback && source.is(DamageTypeTags.IS_EXPLOSION) && this instanceof net.minecraft.world.entity.player.Player; // Paper - Disable explosion knockback
|
|
if (flag1) {
|
|
if (flag) {
|
|
this.level().broadcastEntityEvent(this, (byte) 29);
|
|
} else {
|
|
+ if (!knockbackCancelled) // Paper - Disable explosion knockback
|
|
this.level().broadcastDamageEvent(this, source);
|
|
}
|
|
|
|
@@ -1471,6 +1473,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
}
|
|
}
|
|
|
|
+ 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 925d37ca684e7e6a3ad88e6e040f3599225f0b1d..401076c5350429052994d98c414a83a21f908010 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
@@ -262,7 +262,7 @@ public class Explosion {
|
|
if (entity instanceof LivingEntity) {
|
|
LivingEntity entityliving = (LivingEntity) entity;
|
|
|
|
- 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 {
|
|
if (entity instanceof Player) {
|
|
Player entityhuman = (Player) entity;
|
|
|
|
- if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying)) {
|
|
+ if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying) && !level.paperConfig().environment.disableExplosionKnockback) { // Paper - Disable explosion knockback
|
|
this.hitPlayers.put(entityhuman, vec3d1);
|
|
}
|
|
}
|