45 lines
2.4 KiB
Diff
45 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
|
Date: Wed, 23 Jul 2025 20:28:40 +0800
|
|
Subject: [PATCH] Leaves: Redstone Shears Wrench
|
|
|
|
Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
As a part of : Leaves (https://github.com/LeavesMC/Leaves/blob/79d9ef74c2684eb49060f07e1ab31c827326c9a5/leaves-server/minecraft-patches/features/0009-Redstone-Shears-Wrench.patch)
|
|
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
|
|
diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java
|
|
index 6db566adf2d0df1d26221eda04aa01738df6d3d2..24ebfdf98e343a7892af621d032c35819156deec 100644
|
|
--- a/net/minecraft/world/item/BlockItem.java
|
|
+++ b/net/minecraft/world/item/BlockItem.java
|
|
@@ -56,6 +56,14 @@ public class BlockItem extends Item {
|
|
if (blockPlaceContext == null) {
|
|
return InteractionResult.FAIL;
|
|
} else {
|
|
+ // Leaves start - shears wrench
|
|
+ if (org.leavesmc.leaves.util.ShearsWrenchUtil.shouldSkipPlace(context)) {
|
|
+ if (context.getPlayer() != null) {
|
|
+ context.getPlayer().containerMenu.forceHeldSlot(blockPlaceContext.getHand());
|
|
+ }
|
|
+ return InteractionResult.FAIL;
|
|
+ }
|
|
+ // Leaves end - shears wrench
|
|
BlockState placementState = this.getPlacementState(blockPlaceContext);
|
|
// CraftBukkit start - special case for handling block placement with water lilies and snow buckets
|
|
org.bukkit.block.BlockState bukkitState = null;
|
|
diff --git a/net/minecraft/world/item/ShearsItem.java b/net/minecraft/world/item/ShearsItem.java
|
|
index 8cf3e51e12f9cf98836657e722edb23943f9e866..5fd5e9fd4e1a79dd1a9d62a5cf0c308805979420 100644
|
|
--- a/net/minecraft/world/item/ShearsItem.java
|
|
+++ b/net/minecraft/world/item/ShearsItem.java
|
|
@@ -80,7 +80,10 @@ public class ShearsItem extends Item {
|
|
|
|
return InteractionResult.SUCCESS;
|
|
} else {
|
|
- return super.useOn(context);
|
|
+ // Leaves start - shears wrench
|
|
+ InteractionResult result = org.leavesmc.leaves.util.ShearsWrenchUtil.tryApplyRotate(context, blockState);
|
|
+ return result == null ? super.useOn(context) : result;
|
|
+ // Leaves end - shears wrench
|
|
}
|
|
}
|
|
}
|