From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Samsuik <40902469+Samsuik@users.noreply.github.com> Date: Mon, 20 Nov 2023 19:32:31 +0000 Subject: [PATCH] Consistent Explosion Radius diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java index b32f377079a7c97840079b0a6b541be936c822dd..fa142719b1c4f6434466141128c475ef945edbb7 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -77,6 +77,7 @@ public class Explosion { public float yield; // CraftBukkit end public boolean excludeSourceFromDamage = true; // Paper - Allow explosions to damage source + private final boolean consistentRadius; // Sakura - consistent explosion radius // Paper start - optimise collisions private static final double[] CACHED_RAYS; @@ -451,6 +452,7 @@ public class Explosion { this.largeExplosionParticles = emitterParticle; this.explosionSound = soundEvent; this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit + this.consistentRadius = world.localConfig().config(BlockPos.containing(x, y, z)).consistentRadius; // Sakura - consistent explosion radius } private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) { @@ -559,7 +561,7 @@ public class Explosion { final double incZ = CACHED_RAYS[ray + 2]; ray += 3; - float power = this.radius * (0.7F + this.level.random.nextFloat() * 0.6F); + float power = this.radius * (0.7F + (this.consistentRadius ? 0.7F : this.level.random.nextFloat()) * 0.6F); // Sakura - consistent explosion radius do { final int blockX = Mth.floor(currX); final int blockY = Mth.floor(currY);