Skip to content

Commit

Permalink
Make lever and cocoa wrench-able by shear (LeavesMC#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluemangoo authored Oct 3, 2024
1 parent b8cd2ec commit 95e6661
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions patches/server/0012-Redstone-Shears-Wrench.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Redstone Shears Wrench


diff --git a/src/main/java/net/minecraft/world/item/ShearsItem.java b/src/main/java/net/minecraft/world/item/ShearsItem.java
index cb809796372a4658aa617404f9fddffff9b45cb7..8ebd9da5c6acf9bd220f09922ea27a7c97f4ea2f 100644
index cb809796372a4658aa617404f9fddffff9b45cb7..6ec6f786fda5a6d3f28e4e3d29a9754edb0356d0 100644
--- a/src/main/java/net/minecraft/world/item/ShearsItem.java
+++ b/src/main/java/net/minecraft/world/item/ShearsItem.java
@@ -19,6 +19,21 @@ import net.minecraft.world.level.block.GrowingPlantHeadBlock;
@@ -19,6 +19,23 @@ import net.minecraft.world.level.block.GrowingPlantHeadBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.gameevent.GameEvent;

Expand All @@ -22,6 +22,8 @@ index cb809796372a4658aa617404f9fddffff9b45cb7..8ebd9da5c6acf9bd220f09922ea27a7c
+import net.minecraft.world.level.block.ObserverBlock;
+import net.minecraft.world.level.block.RepeaterBlock;
+import net.minecraft.world.level.block.CrafterBlock;
+import net.minecraft.world.level.block.LeverBlock;
+import net.minecraft.world.level.block.CocoaBlock;
+import net.minecraft.world.level.block.piston.PistonBaseBlock;
+import net.minecraft.world.level.block.state.StateDefinition;
+import net.minecraft.world.level.block.state.properties.Property;
Expand All @@ -30,15 +32,15 @@ index cb809796372a4658aa617404f9fddffff9b45cb7..8ebd9da5c6acf9bd220f09922ea27a7c
public class ShearsItem extends Item {
public ShearsItem(Item.Properties settings) {
super(settings);
@@ -77,6 +92,67 @@ public class ShearsItem extends Item {
@@ -77,6 +94,67 @@ public class ShearsItem extends Item {
return InteractionResult.sidedSuccess(level.isClientSide);
}

+ // Leaves start - shears wrench
+ Block block = blockState.getBlock();
+ if (org.leavesmc.leaves.LeavesConfig.redstoneShearsWrench && block instanceof ObserverBlock || block instanceof DispenserBlock ||
+ block instanceof PistonBaseBlock || block instanceof HopperBlock || block instanceof RepeaterBlock || block instanceof ComparatorBlock ||
+ block instanceof CrafterBlock) {
+ block instanceof CrafterBlock || block instanceof LeverBlock || block instanceof CocoaBlock) {
+ StateDefinition<Block, BlockState> blockstatelist = block.getStateDefinition();
+ Property<?> iblockstate = block instanceof CrafterBlock ? blockstatelist.getProperty("orientation") : blockstatelist.getProperty("facing");
+ Player player = context.getPlayer();
Expand Down

0 comments on commit 95e6661

Please sign in to comment.