Skip to content

Commit

Permalink
Fix #281
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Aug 14, 2024
1 parent a58f059 commit 1a110f5
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 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..f2fb88dd19b7d8e6dd3283266a80503502560fbf 100644
index cb809796372a4658aa617404f9fddffff9b45cb7..8ebd9da5c6acf9bd220f09922ea27a7c97f4ea2f 100644
--- a/src/main/java/net/minecraft/world/item/ShearsItem.java
+++ b/src/main/java/net/minecraft/world/item/ShearsItem.java
@@ -19,6 +19,20 @@ import net.minecraft.world.level.block.GrowingPlantHeadBlock;
@@ -19,6 +19,21 @@ import net.minecraft.world.level.block.GrowingPlantHeadBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.gameevent.GameEvent;

Expand All @@ -21,6 +21,7 @@ index cb809796372a4658aa617404f9fddffff9b45cb7..f2fb88dd19b7d8e6dd3283266a805035
+import net.minecraft.world.level.block.HopperBlock;
+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.piston.PistonBaseBlock;
+import net.minecraft.world.level.block.state.StateDefinition;
+import net.minecraft.world.level.block.state.properties.Property;
Expand All @@ -29,16 +30,17 @@ index cb809796372a4658aa617404f9fddffff9b45cb7..f2fb88dd19b7d8e6dd3283266a805035
public class ShearsItem extends Item {
public ShearsItem(Item.Properties settings) {
super(settings);
@@ -77,6 +91,60 @@ public class ShearsItem extends Item {
@@ -77,6 +92,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 PistonBaseBlock || block instanceof HopperBlock || block instanceof RepeaterBlock || block instanceof ComparatorBlock ||
+ block instanceof CrafterBlock) {
+ StateDefinition<Block, BlockState> blockstatelist = block.getStateDefinition();
+ Property<?> iblockstate = blockstatelist.getProperty("facing");
+ Property<?> iblockstate = block instanceof CrafterBlock ? blockstatelist.getProperty("orientation") : blockstatelist.getProperty("facing");
+ Player player = context.getPlayer();
+
+ if (iblockstate == null || player == null) {
Expand All @@ -62,6 +64,12 @@ index cb809796372a4658aa617404f9fddffff9b45cb7..f2fb88dd19b7d8e6dd3283266a805035
+ }
+ }
+
+ if (block instanceof CrafterBlock) {
+ if (getNameHelper(blockState, CrafterBlock.CRAFTING).equals("true")) {
+ return InteractionResult.FAIL;
+ }
+ }
+
+ BlockState iblockdata1 = ShearsItem.cycleState(blockState, iblockstate, player.isSecondaryUseActive());
+ level.setBlock(blockPos, iblockdata1, 18);
+ ShearsItem.message(player, Component.translatable("item.minecraft.debug_stick.update", iblockstate.getName(), ShearsItem.getNameHelper(iblockdata1, iblockstate)));
Expand Down

0 comments on commit 1a110f5

Please sign in to comment.