Files
Purpur/patches/server/0081-Implement-respawn-anchor-explosion-options.patch
2021-09-29 14:50:07 -04:00

47 lines
3.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 4 Jul 2020 13:23:19 -0500
Subject: [PATCH] Implement respawn anchor explosion options
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
index 0a5d563700c9f806139001181f01fa9d0111f792..1aae3d27ed6c0433312502a59fe1eb70b7d14ac3 100644
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
@@ -120,7 +120,7 @@ public class RespawnAnchorBlock extends Block {
return pos.equals(explodedPos) && bl2 ? Optional.of(Blocks.WATER.getExplosionResistance()) : super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState);
}
};
- world.explode((Entity)null, DamageSource.badRespawnPointExplosion(), explosionDamageCalculator, (double)explodedPos.getX() + 0.5D, (double)explodedPos.getY() + 0.5D, (double)explodedPos.getZ() + 0.5D, 5.0F, true, Explosion.BlockInteraction.DESTROY);
+ if (world.purpurConfig.respawnAnchorExplode) world.explode(null, DamageSource.badRespawnPointExplosion(), explosionDamageCalculator, (double) explodedPos.getX() + 0.5D, (double) explodedPos.getY() + 0.5D, (double) explodedPos.getZ() + 0.5D, (float) world.purpurConfig.respawnAnchorExplosionPower, world.purpurConfig.respawnAnchorExplosionFire, world.purpurConfig.respawnAnchorExplosionEffect); // Purpur
}
public static boolean canSetSpawn(Level world) {
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 4405108543e36b74be2678d6e5b1de9363db5151..45e2c201f4d6768e029d075dfcb3716c92d394a4 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -336,6 +336,22 @@ public class PurpurWorldConfig {
waterInfiniteRequiredSources = getInt("blocks.water.infinite-required-sources", waterInfiniteRequiredSources);
}
+ public boolean respawnAnchorExplode = true;
+ public double respawnAnchorExplosionPower = 5.0D;
+ public boolean respawnAnchorExplosionFire = true;
+ public Explosion.BlockInteraction respawnAnchorExplosionEffect = Explosion.BlockInteraction.DESTROY;
+ private void respawnAnchorSettings() {
+ respawnAnchorExplode = getBoolean("blocks.respawn_anchor.explode", respawnAnchorExplode);
+ respawnAnchorExplosionPower = getDouble("blocks.respawn_anchor.explosion-power", respawnAnchorExplosionPower);
+ respawnAnchorExplosionFire = getBoolean("blocks.respawn_anchor.explosion-fire", respawnAnchorExplosionFire);
+ try {
+ respawnAnchorExplosionEffect = Explosion.BlockInteraction.valueOf(getString("blocks.respawn_anchor.explosion-effect", respawnAnchorExplosionEffect.name()));
+ } catch (IllegalArgumentException e) {
+ log(Level.SEVERE, "Unknown value for `blocks.respawn_anchor.explosion-effect`! Using default of `DESTROY`");
+ respawnAnchorExplosionEffect = Explosion.BlockInteraction.DESTROY;
+ }
+ }
+
public boolean signAllowColors = false;
public boolean signRightClickEdit = false;
private void signSettings() {