From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Sun, 3 Apr 2022 11:31:04 +0800 Subject: [PATCH] Budding Amethyst can push by piston diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java index 3a68a32a359f13850262ac1ec07810053f806f7c..997280cd6131b14396d6fb37c293a6d4cc118412 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java @@ -589,6 +589,12 @@ public class Block extends BlockBehaviour implements ItemLike { } // Spigot end + // Leaves start - reset push reaction + public net.minecraft.world.level.material.PushReaction getResetPushReaction() { + return null; + } + // Leaves end - reset push reaction + public static final class BlockStatePairKey { private final BlockState first; diff --git a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java index 8920855b07a31715327b8102c7faafc9f916825d..32d926a1b952b8069c5bf48c88e3c108b08b4ab1 100644 --- a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java @@ -60,4 +60,11 @@ public class BuddingAmethystBlock extends AmethystBlock { public static boolean canClusterGrowAtState(BlockState state) { return state.isAir() || state.is(Blocks.WATER) && state.getFluidState().getAmount() == 8; } + + // Leaves start - budding amethyst can push by piston + @Override + public net.minecraft.world.level.material.PushReaction getResetPushReaction() { + return org.leavesmc.leaves.LeavesConfig.buddingAmethystCanPushByPiston ? net.minecraft.world.level.material.PushReaction.PUSH_ONLY : null; + } + // Leaves end - budding amethyst can push by piston } diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java index ded6d148110fe3fbb6272ce44582a28472dd49a6..2d44010e51b214c6c58a57e17cd565d2262397b2 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -1098,7 +1098,7 @@ public abstract class BlockBehaviour implements FeatureElement { } public PushReaction getPistonPushReaction() { - return !this.isDestroyable() ? PushReaction.BLOCK : this.pushReaction; // Paper - Protect Bedrock and End Portal/Frames from being destroyed + return !this.isDestroyable() ? PushReaction.BLOCK : this.getBlock().getResetPushReaction() == null ? this.pushReaction : this.getBlock().getResetPushReaction(); // Paper - Protect Bedrock and End Portal/Frames from being destroyed // Leaves - can reset } public boolean isSolidRender(BlockGetter world, BlockPos pos) {