Option for chests to open even with a solid block on top

This commit is contained in:
Jason Penilla
2025-01-10 00:44:46 -08:00
committed by granny
parent 33fe2966e6
commit 55eb63b89c
3 changed files with 15 additions and 34 deletions

View File

@@ -1,34 +0,0 @@
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/net/minecraft/world/level/block/ChestBlock.java b/net/minecraft/world/level/block/ChestBlock.java
index ca69a9fbd4942f9079aeaab7cead2d7a2c3b8659..54f351f1cbb50a5b1aa3167e3a0b10bb0456c1cf 100644
--- a/net/minecraft/world/level/block/ChestBlock.java
+++ b/net/minecraft/world/level/block/ChestBlock.java
@@ -336,6 +336,7 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
}
public 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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 739402d4e7b2b99ced75f62df33e4f4b4b9bdd6c..012bdd66052eb30a185804a36e4cbde323bb1d68 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -376,6 +376,11 @@ public class PurpurWorldConfig {
}
}
+ 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() {

View File

@@ -0,0 +1,10 @@
--- a/net/minecraft/world/level/block/ChestBlock.java
+++ b/net/minecraft/world/level/block/ChestBlock.java
@@ -361,6 +_,7 @@
}
public static boolean isBlockedChestByBlock(BlockGetter level, BlockPos pos) {
+ if (level instanceof Level level1 && level1.purpurConfig.chestOpenWithBlockOnTop) return false; // Purpur - Option for chests to open even with a solid block on top
BlockPos blockPos = pos.above();
return level.getBlockState(blockPos).isRedstoneConductor(level, blockPos);
}

View File

@@ -368,6 +368,11 @@ public class PurpurWorldConfig {
}
}
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() {