Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make lever and cocoa wrench-able by shear #351

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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