mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-23 16:59:16 +00:00
Backport to 1.19.3
This commit is contained in:
35
patches/server/0036-Consistent-Explosion-Radius.patch
Normal file
35
patches/server/0036-Consistent-Explosion-Radius.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user