mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
70 lines
4.0 KiB
Diff
70 lines
4.0 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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index 73dda3becdf29dac35f4a0ceea070d174c546c8b..1d91adcfa636455bf67c6f7ac7d51baaa6db047f 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -217,4 +217,9 @@ public class PaperWorldConfig {
|
|
optimizeExplosions = getBoolean("optimize-explosions", false);
|
|
log("Optimize explosions: " + optimizeExplosions);
|
|
}
|
|
+
|
|
+ public boolean disableExplosionKnockback;
|
|
+ private void disableExplosionKnockback(){
|
|
+ disableExplosionKnockback = getBoolean("disable-explosion-knockback", false);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index c7017b86a3268aef0baff2ae0a56155aafc6a067..062d8c0d48798199319da5ccb422af2f1564f6f6 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -1399,6 +1399,7 @@ public abstract class LivingEntity extends Entity {
|
|
}
|
|
}
|
|
|
|
+ boolean knockbackCancelled = level.paperConfig.disableExplosionKnockback && source.isExplosion() && this instanceof net.minecraft.world.entity.player.Player; // Paper - Disable explosion knockback
|
|
if (flag1) {
|
|
if (flag) {
|
|
this.level.broadcastEntityEvent(this, (byte) 29);
|
|
@@ -1419,6 +1420,7 @@ public abstract class LivingEntity extends Entity {
|
|
b0 = 2;
|
|
}
|
|
|
|
+ if (!knockbackCancelled) // Paper - Disable explosion knockback
|
|
this.level.broadcastEntityEvent(this, b0);
|
|
}
|
|
|
|
@@ -1442,6 +1444,7 @@ public abstract class LivingEntity extends Entity {
|
|
}
|
|
}
|
|
|
|
+ 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 95e59d7c45bb5128b9176e3c172bd51d98449050..2a10a50381b6d6229b7c6e1d32f0d8f96db70bd5 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
@@ -260,14 +260,14 @@ public class Explosion {
|
|
double d14 = d13;
|
|
|
|
if (entity instanceof LivingEntity) {
|
|
- d14 = ProtectionEnchantment.getExplosionKnockbackAfterDampener((LivingEntity) entity, d13);
|
|
+ d14 = entity instanceof Player && level.paperConfig.disableExplosionKnockback ? 0 : ProtectionEnchantment.getExplosionKnockbackAfterDampener((LivingEntity) entity, d13); // Paper - Disable explosion knockback
|
|
}
|
|
|
|
entity.setDeltaMovement(entity.getDeltaMovement().add(d8 * d14, d9 * d14, d10 * d14));
|
|
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.disableExplosionKnockback) { // Paper - Disable explosion knockback
|
|
this.hitPlayers.put(entityhuman, new Vec3(d8 * d13, d9 * d13, d10 * d13));
|
|
}
|
|
}
|