diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/EnderChestBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/EnderChestBlock.java.patch new file mode 100644 index 0000000000..ae4e2ba35f --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/block/EnderChestBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/level/block/EnderChestBlock.java ++++ b/net/minecraft/world/level/block/EnderChestBlock.java +@@ -78,7 +78,7 @@ + PlayerEnderChestContainer playerEnderChestContainer = player.getEnderChestInventory(); + if (playerEnderChestContainer != null && world.getBlockEntity(pos) instanceof EnderChestBlockEntity enderChestBlockEntity) { + BlockPos blockPos = pos.above(); +- if (world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) { ++ if (world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) { // Paper - diff on change; make sure that EnderChest#isBlocked uses the same logic + return InteractionResult.SUCCESS; + } else { + if (world instanceof ServerLevel serverLevel) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java index 6e98a00d52..cc7bf4d39b 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -99,4 +99,29 @@ public class CraftChest extends CraftLootable implements Chest return getTileEntity().openersCounter.opened; } // Paper end - More Lidded Block API + + // Paper start - More Chest Block API + @Override + public boolean isBlocked() { + // Method mimics vanilla logic in ChestBlock and DoubleBlockCombiner when trying to open chest's container + if (!isPlaced()) { + return false; + } + net.minecraft.world.level.LevelAccessor world = getWorldHandle(); + if (ChestBlock.isChestBlockedAt(world, getPosition())) { + return true; + } + if (ChestBlock.getBlockType(this.data) == net.minecraft.world.level.block.DoubleBlockCombiner.BlockType.SINGLE) { + return false; + } + net.minecraft.core.Direction direction = ChestBlock.getConnectedDirection(this.data); + net.minecraft.core.BlockPos neighbourBlockPos = getPosition().relative(direction); + BlockState neighbourBlockState = world.getBlockStateIfLoaded(neighbourBlockPos); + return neighbourBlockState != null + && neighbourBlockState.is(this.data.getBlock()) + && ChestBlock.getBlockType(neighbourBlockState) != net.minecraft.world.level.block.DoubleBlockCombiner.BlockType.SINGLE + && ChestBlock.getConnectedDirection(neighbourBlockState) == direction.getOpposite() + && ChestBlock.isChestBlockedAt(world, neighbourBlockPos); + } + // Paper end - More Chest Block API } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java index b64adbba3e..f45ee675a1 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java @@ -58,4 +58,13 @@ public class CraftEnderChest extends CraftBlockEntityState