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/server/BlockBed.java b/src/main/java/net/minecraft/server/BlockBed.java
index 24a5c64b65f0098b1395d352cc2f99bbbbaf9c94..738535d01adf8bfd895b5057e595042253f32f87 100644
--- a/src/main/java/net/minecraft/server/BlockBed.java
+++ b/src/main/java/net/minecraft/server/BlockBed.java
@@ -88,7 +88,7 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
                     world.a(blockposition1, false);
                 }
 
-                world.createExplosion((Entity) null, DamageSource.a(), (ExplosionDamageCalculator) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.Effect.DESTROY);
+                if (world.purpurConfig.bedExplode) world.createExplosion(null, DamageSource.a(), 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 EnumInteractionResult.SUCCESS;
             }
         }
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index fedc39bdbbd328296c5c08d220d6695fe08fdf91..35e4f4160358b12b61d2763b8d2f5ff51022b666 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -2,6 +2,7 @@ package net.pl3x.purpur;
 
 import net.minecraft.server.Block;
 import net.minecraft.server.Blocks;
+import net.minecraft.server.Explosion;
 import net.minecraft.server.IRegistry;
 import net.minecraft.server.Item;
 import net.minecraft.server.Items;
@@ -12,6 +13,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Level;
 
 import static net.pl3x.purpur.PurpurConfig.log;
 
@@ -212,6 +214,22 @@ public class PurpurWorldConfig {
         });
     }
 
+    public boolean bedExplode = true;
+    public double bedExplosionPower = 5.0D;
+    public boolean bedExplosionFire = true;
+    public Explosion.Effect bedExplosionEffect = Explosion.Effect.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.Effect.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.Effect.DESTROY;
+        }
+    }
+
     public boolean dispenserApplyCursedArmor = true;
     private void dispenserSettings() {
         dispenserApplyCursedArmor = getBoolean("blocks.dispenser.apply-cursed-to-armor-slots", dispenserApplyCursedArmor);
