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 ae86e1edde015e2ff6cd10c31e0a6065708241af..7130209f48c488e2d184f31335f0511735963c55 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java @@ -588,6 +588,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 d0109633e8bdf109cfc9178963d7b6cf92f8b189..e9b4e88caeb57cc67bfd027bb15585eff9a13e04 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 @@ -1099,7 +1099,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) {