From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Sat, 12 Dec 2020 14:34:18 -0800
Subject: [PATCH] Option for chests to open even with a solid block on top


diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
index eecb8c089b5f426b1395b47f714af32c210555ef..ac82e2b0f4ca1232cc7ec6e4c7dd261308f61aaf 100644
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
@@ -349,6 +349,7 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
     }
 
     private static boolean isBlockedChestByBlock(BlockGetter world, BlockPos pos) {
+        if (world instanceof Level && ((Level) world).purpurConfig.chestOpenWithBlockOnTop) return false; // Purpur
         BlockPos blockposition1 = pos.above();
 
         return world.getBlockState(blockposition1).isRedstoneConductor(world, blockposition1);
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index fde7aa8d1da2a5d9517c8ac23e3624506b3c5ee8..03d2d735b3e8839b467d93696d1a6f4481f57a41 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -429,6 +429,11 @@ public class PurpurWorldConfig {
         caveVinesMaxGrowthAge = getInt("blocks.cave_vines.max-growth-age", caveVinesMaxGrowthAge);
     }
 
+    public boolean chestOpenWithBlockOnTop = false;
+    private void chestSettings() {
+        chestOpenWithBlockOnTop = getBoolean("blocks.chest.open-with-solid-block-on-top", chestOpenWithBlockOnTop);
+    }
+
     public boolean dispenserApplyCursedArmor = true;
     public boolean dispenserPlaceAnvils = false;
     private void dispenserSettings() {
