9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-27 02:39:06 +00:00
Files
SakuraMC/migrate/server/source/applied/0034-Consistent-Explosion-Radius.patch
2025-01-16 19:35:17 +00:00

36 lines
2.2 KiB
Diff

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/ServerExplosion.java b/src/main/java/net/minecraft/world/level/ServerExplosion.java
index cc97e3a88ea99362ec043edf13c1f54c2c75daaa..1a912813ab7fa112379876ea1d4c903afe45c069 100644
--- a/src/main/java/net/minecraft/world/level/ServerExplosion.java
+++ b/src/main/java/net/minecraft/world/level/ServerExplosion.java
@@ -412,6 +412,7 @@ public class ServerExplosion implements Explosion {
return this.damageCalculator.getBlockExplosionResistance(this, this.level, pos, blockState, fluidState);
}
// Sakura end - explosion durable blocks
+ private final boolean consistentRadius; // Sakura - consistent explosion radius
public ServerExplosion(ServerLevel world, @Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, Vec3 pos, float power, boolean createFire, Explosion.BlockInteraction destructionType) {
this.level = world;
@@ -423,6 +424,7 @@ public class ServerExplosion implements Explosion {
this.damageSource = damageSource == null ? world.damageSources().explosion(this) : damageSource;
this.damageCalculator = behavior == null ? this.makeDamageCalculator(entity) : behavior;
this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit
+ this.consistentRadius = world.localConfig().config(BlockPos.containing(this.center)).consistentRadius; // Sakura - consistent explosion radius
}
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
@@ -533,7 +535,7 @@ public class ServerExplosion implements Explosion {
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);