9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-21 15:59:26 +00:00
Files
SakuraMC/patches/server/0036-Consistent-Explosion-Radius.patch
2024-12-01 17:09:32 +00:00

36 lines
2.0 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/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 06d6ed111de0349f4e4f382021f91056ae71fb86..0157727b9849e40d555460faf33e8a88da60ada9 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -68,6 +68,7 @@ public class Explosion {
private final ObjectArrayList<BlockPos> toBlow;
private final Map<Player, Vec3> hitPlayers;
public boolean wasCanceled = false; // CraftBukkit - add field
+ private final boolean consistentRadius; // Sakura - consistent explosion radius
public Explosion(Level world, @Nullable Entity entity, double x, double y, double z, float power, List<BlockPos> affectedBlocks) {
this(world, entity, x, y, z, power, false, Explosion.BlockInteraction.DESTROY_WITH_DECAY, affectedBlocks);
@@ -96,6 +97,7 @@ public class Explosion {
this.blockInteraction = destructionType;
this.damageSource = damageSource == null ? DamageSource.explosion(this) : damageSource;
this.damageCalculator = behavior == null ? this.makeDamageCalculator(entity) : behavior;
+ this.consistentRadius = world.localConfig().config(new BlockPos(x, y, z)).consistentRadius; // Sakura - consistent explosion radius
}
// Sakura start - optimise vanilla explosions
@@ -172,7 +174,7 @@ public class Explosion {
double rayY = explosionRays[ray++];
double rayZ = explosionRays[ray++];
- 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
double x = this.x;
double y = this.y;
double z = this.z;