From fb3f2c1b8e1729af2efe3d6d055acf11ed99eb51 Mon Sep 17 00:00:00 2001 From: Sudzzy Date: Wed, 2 Mar 2016 14:48:03 -0600 Subject: [PATCH] Disable explosion knockback --- .../world/level/ServerExplosion.java.patch | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/paper-server/patches/sources/net/minecraft/world/level/ServerExplosion.java.patch b/paper-server/patches/sources/net/minecraft/world/level/ServerExplosion.java.patch index d32cd7be53..0921dea01b 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/ServerExplosion.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/ServerExplosion.java.patch @@ -102,7 +102,16 @@ } double d5 = (1.0D - d0) * (double) f2 * (double) f1; -@@ -214,6 +256,17 @@ +@@ -204,7 +246,7 @@ + if (entity instanceof LivingEntity) { + LivingEntity entityliving = (LivingEntity) entity; + +- d6 = d5 * (1.0D - entityliving.getAttributeValue(Attributes.EXPLOSION_KNOCKBACK_RESISTANCE)); ++ d6 = entity instanceof Player && this.level.paperConfig().environment.disableExplosionKnockback ? 0 : d5 * (1.0D - entityliving.getAttributeValue(Attributes.EXPLOSION_KNOCKBACK_RESISTANCE)); // Paper + } else { + d6 = d5; + } +@@ -214,11 +256,22 @@ d3 *= d6; Vec3 vec3d = new Vec3(d1, d2, d3); @@ -120,6 +129,12 @@ entity.push(vec3d); 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 - Option to disable explosion knockback + this.hitPlayers.put(entityhuman, vec3d); + } + } @@ -235,10 +288,62 @@ List list1 = new ArrayList();