Files
Purpur/patches/server/0079-Implement-bed-explosion-options.patch
William Blake Galbreath 17368d1aa9 Updated Upstream (Paper & Tuinity)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
12dec20 Bump paerweight to 1.1.7
e33ed89 Get short commit ref using a more proper method
7d6147d Remove now unneeded patch due to paperweight 1.1.7
e72fa41 Update task dependency for includeMappings so the new task isn't skipped
0ad5526 Trim whitspace off of git hash (oops)

Tuinity Changes:
e878ba9 Update paper
2bd2849 Bring back fix codec spam patch
2021-06-27 00:42:39 -05:00

56 lines
4.0 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:12:43 -0500
Subject: [PATCH] Implement bed explosion options
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
index 163a7861f987c3832aac51cc6df950c768546731..bf5765b6af9c7807d50f7daaacb5d52477ebf291 100644
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
@@ -97,7 +97,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
world.removeBlock(blockposition1, false);
}
- world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), (ExplosionDamageCalculator) null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, 5.0F, true, Explosion.BlockInteraction.DESTROY);
+ if (world.purpurConfig.bedExplode) world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (float) world.purpurConfig.bedExplosionPower, world.purpurConfig.bedExplosionFire, world.purpurConfig.bedExplosionEffect); // Purpur
return InteractionResult.SUCCESS;
} else if ((Boolean) state.getValue(BedBlock.OCCUPIED)) {
if (!this.kickVillagerOutOfBed(world, pos)) {
@@ -146,7 +146,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
world.removeBlock(blockposition1, false);
}
- world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), (ExplosionDamageCalculator) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.BlockInteraction.DESTROY);
+ if (world.purpurConfig.bedExplode) world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (float) world.purpurConfig.bedExplosionPower, world.purpurConfig.bedExplosionFire, world.purpurConfig.bedExplosionEffect); // Purpur
return InteractionResult.SUCCESS;
}
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 506e7198de3a339545bebb508d96ca95f5fc8fc1..c3ec6d09e952f55e1e098f59d9764bc6cbe7c444 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -265,6 +265,22 @@ public class PurpurWorldConfig {
voidDamageDealt = getDouble("gameplay-mechanics.void-damage-dealt", voidDamageDealt);
}
+ public boolean bedExplode = true;
+ public double bedExplosionPower = 5.0D;
+ public boolean bedExplosionFire = true;
+ public Explosion.BlockInteraction bedExplosionEffect = Explosion.BlockInteraction.DESTROY;
+ private void bedSettings() {
+ bedExplode = getBoolean("blocks.bed.explode", bedExplode);
+ bedExplosionPower = getDouble("blocks.bed.explosion-power", bedExplosionPower);
+ bedExplosionFire = getBoolean("blocks.bed.explosion-fire", bedExplosionFire);
+ try {
+ bedExplosionEffect = Explosion.BlockInteraction.valueOf(getString("blocks.bed.explosion-effect", bedExplosionEffect.name()));
+ } catch (IllegalArgumentException e) {
+ log(Level.SEVERE, "Unknown value for `blocks.bed.explosion-effect`! Using default of `DESTROY`");
+ bedExplosionEffect = Explosion.BlockInteraction.DESTROY;
+ }
+ }
+
public boolean dispenserApplyCursedArmor = true;
private void dispenserSettings() {
dispenserApplyCursedArmor = getBoolean("blocks.dispenser.apply-cursed-to-armor-slots", dispenserApplyCursedArmor);