mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
* init 1.21.4, and boom! * build change, but weight not work * just work * Build changes, and delete timings * Fix API patches (#406) * Fix API patches * merge --------- Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com> * 0006/0129 * 0009/0129 * 0011/0129 * 0018/0129 * 0030/0129 * 0035/0129 * 0043/0129 * 0048/0129 * 0049/0129 * 0057/0129 * 0065/0129 * 0086/0129 (#408) * 0072/0129 * 0080/0129 * Readd patch infos * 0086/0129 * Delete applied patches * 0087/0129 * 0091/0129 * 0097/0129 * 0101/0129 * 102/129 * 0107/0129 * 0112/0129 * 0118/0129 * 0129/0129, 100% patched * fix some * server work * Protocol... (#409) * Jade v7 * Fix changed part for Jade * Formatting imports, add Lms Paster protocol * REI payloads 5/8 * Add REI support, remove unnecessary content in Jade * Rename * Make jade better * Make action work * fix action jar * Fix some protocol * Fix bot action, and entity tickCount * Fix Warden GameEventListener register on load * Fix extra Raider drop * Fix grindstone overstacking * Update Paper, and some doc * Merge * [ci skip] Update Action --------- Co-authored-by: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
81 lines
5.4 KiB
Diff
81 lines
5.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Mon, 3 Feb 2025 21:31:03 +0800
|
|
Subject: [PATCH] Container open passthrough
|
|
|
|
|
|
diff --git a/net/minecraft/world/entity/decoration/ItemFrame.java b/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
index 65e1d7c5ac94b1cfb921fa009be59d3e5872f0b5..34a60bc540cd08da0ebec3a37ec0a01da3dd24de 100644
|
|
--- a/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
+++ b/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
@@ -408,6 +408,20 @@ public class ItemFrame extends HangingEntity {
|
|
return InteractionResult.PASS;
|
|
}
|
|
} else {
|
|
+ // Leaves start - itemFrameContainerPassthrough
|
|
+ if (org.leavesmc.leaves.LeavesConfig.modify.containerPassthrough && !player.isShiftKeyDown()) {
|
|
+ BlockPos pos1 = this.pos.relative(this.direction.getOpposite());
|
|
+ if (level().getBlockEntity(pos1) instanceof net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity) {
|
|
+ BlockState blockState = level().getBlockState(pos1);
|
|
+ net.minecraft.world.phys.BlockHitResult hitResult = new net.minecraft.world.phys.BlockHitResult(Vec3.atCenterOf(pos1), this.direction, pos1, false);
|
|
+ if (flag1) {
|
|
+ return blockState.useItemOn(itemInHand, level(), player, hand, hitResult);
|
|
+ } else {
|
|
+ return blockState.useWithoutItem(level(), player, hitResult);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Leaves end - itemFrameContainerPassthrough
|
|
// Paper start - Add PlayerItemFrameChangeEvent
|
|
io.papermc.paper.event.player.PlayerItemFrameChangeEvent event = new io.papermc.paper.event.player.PlayerItemFrameChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.ItemFrame) this.getBukkitEntity(), this.getItem().asBukkitCopy(), io.papermc.paper.event.player.PlayerItemFrameChangeEvent.ItemFrameChangeAction.ROTATE);
|
|
if (!event.callEvent()) {
|
|
diff --git a/net/minecraft/world/level/block/SignBlock.java b/net/minecraft/world/level/block/SignBlock.java
|
|
index f33a42b4888dbf46175e0be409aa6c8688d552b9..da815a9a5e447e9a1cf44f54e4fcbb9481d65d86 100644
|
|
--- a/net/minecraft/world/level/block/SignBlock.java
|
|
+++ b/net/minecraft/world/level/block/SignBlock.java
|
|
@@ -106,6 +106,18 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
|
|
} else {
|
|
return InteractionResult.TRY_WITH_EMPTY_HAND;
|
|
}
|
|
+ // Leaves start - signContainerPassthrough
|
|
+ } else if (org.leavesmc.leaves.LeavesConfig.modify.containerPassthrough) {
|
|
+ BlockPos pos1 = pos.relative(hitResult.getDirection().getOpposite());
|
|
+ if (this instanceof WallSignBlock || this instanceof WallHangingSignBlock) {
|
|
+ pos1 = pos.relative(state.getValue(HorizontalDirectionalBlock.FACING).getOpposite());
|
|
+ }
|
|
+ if (level.getBlockEntity(pos1) instanceof net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity) {
|
|
+ BlockState state1 = level.getBlockState(pos1);
|
|
+ return state1.useItemOn(stack, level, player, hand, hitResult.withPosition(pos1));
|
|
+ }
|
|
+ return InteractionResult.PASS;
|
|
+ // Leaves end - signContainerPassthrough
|
|
} else {
|
|
return InteractionResult.TRY_WITH_EMPTY_HAND;
|
|
}
|
|
@@ -131,6 +143,25 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
|
|
return InteractionResult.SUCCESS_SERVER;
|
|
} else if (flag) {
|
|
return InteractionResult.SUCCESS_SERVER;
|
|
+ // Leaves start - signContainerPassthrough
|
|
+ } else if (org.leavesmc.leaves.LeavesConfig.modify.containerPassthrough) {
|
|
+ if (player.isShiftKeyDown()) {
|
|
+ if (!this.otherPlayerIsEditingSign(player, signBlockEntity) && player.mayBuild() && this.hasEditableText(player, signBlockEntity, isFacingFrontText)) {
|
|
+ this.openTextEdit(player, signBlockEntity, isFacingFrontText);
|
|
+ return InteractionResult.SUCCESS;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ BlockPos pos1 = pos.relative(hitResult.getDirection().getOpposite());
|
|
+ if (this instanceof WallSignBlock || this instanceof WallHangingSignBlock) {
|
|
+ pos1 = pos.relative(state.getValue(HorizontalDirectionalBlock.FACING).getOpposite());
|
|
+ }
|
|
+ if (level.getBlockEntity(pos1) instanceof net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity) {
|
|
+ BlockState state1 = level.getBlockState(pos1);
|
|
+ return state1.useWithoutItem(level, player, hitResult.withPosition(pos1));
|
|
+ }
|
|
+ return InteractionResult.PASS;
|
|
+ // Leaves end - signContainerPassthrough
|
|
} else if (!this.otherPlayerIsEditingSign(player, signBlockEntity)
|
|
&& player.mayBuild()
|
|
&& this.hasEditableText(player, signBlockEntity, isFacingFrontText)) {
|