9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/patches/server/0014-Budding-Amethyst-can-push-by-piston.patch
2024-07-12 22:01:02 +08:00

53 lines
3.0 KiB
Diff

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 0f289d8f9bda2fb2ca2cd2dfd667a975529b3e4c..7426ad401d611a345eb0bee0b49012fcf5b970d5 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
@@ -1104,7 +1104,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) {