geforkt von Mirrors/Paper
70 Zeilen
4.0 KiB
Diff
70 Zeilen
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 4881b03d470646843bad1bc343eb6a6ab9072d8e..2222c1bb5f8625eee4d88946e4bfdfa2fe598977 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -161,4 +161,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 e5f8cee6726ea9a90c540bb10fd8594a35bb5e40..afd114e1ce00db72534d470fed12101bb237f266 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -1280,6 +1280,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);
|
|
@@ -1298,6 +1299,7 @@ public abstract class LivingEntity extends Entity {
|
|
b0 = 2;
|
|
}
|
|
|
|
+ if (!knockbackCancelled) // Paper - Disable explosion knockback
|
|
this.level.broadcastEntityEvent(this, b0);
|
|
}
|
|
|
|
@@ -1321,6 +1323,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 db46caaa5ad5f129d313c65c5006cb24853768be..45a75f7be308678336e192828becf6cf5c9047bc 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
@@ -215,14 +215,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.abilities.flying)) {
|
|
+ if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.abilities.flying) && !level.paperConfig.disableExplosionKnockback) { // Paper - Disable explosion knockback
|
|
this.hitPlayers.put(entityhuman, new Vec3(d8 * d13, d9 * d13, d10 * d13));
|
|
}
|
|
}
|