From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Mon, 17 Jul 2023 11:41:50 +0800 Subject: [PATCH] Container open passthrough diff --git a/src/main/java/net/minecraft/world/level/block/SignBlock.java b/src/main/java/net/minecraft/world/level/block/SignBlock.java index e20c24c86db023ad269f15fe04963608e3fb3fe5..d2455f798a00580ebbb45e85ad2a6dcd7671207e 100644 --- a/src/main/java/net/minecraft/world/level/block/SignBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java @@ -96,6 +96,22 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo return InteractionResult.SUCCESS; } else if (bl3) { return InteractionResult.SUCCESS; + // Leaves start - signContainerPassthrough + } else if (top.leavesmc.leaves.LeavesConfig.containerPassthrough) { + if (item == net.minecraft.world.item.Items.AIR && player.isShiftKeyDown()) { + if (!this.otherPlayerIsEditingSign(player, signBlockEntity) && player.mayBuild() && this.hasEditableText(player, signBlockEntity, bl2)) { + this.openTextEdit(player, signBlockEntity, bl2); + return InteractionResult.SUCCESS; + } + } + + BlockPos pos1 = pos.relative(hit.getDirection().getOpposite()); + if (world.getBlockEntity(pos1) instanceof net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity) { + BlockState state1 = world.getBlockState(pos1); + return state1.use(world, player, hand, hit.withPosition(pos1)); + } + return InteractionResult.PASS; + // Leaves end - signContainerPassthrough } else if (!this.otherPlayerIsEditingSign(player, signBlockEntity) && player.mayBuild() && this.hasEditableText(player, signBlockEntity, bl2)) { this.openTextEdit(player, signBlockEntity, bl2, io.papermc.paper.event.player.PlayerOpenSignEvent.Cause.INTERACT); // Paper return InteractionResult.SUCCESS;