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
2023-09-28 18:12:42 +08:00

53 lines
2.9 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 3ed0c227e1df184a84ecf1bdde9c598fabc329c7..065fbac30d22ec45cd3f5b66599c8500ae5c278d 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -586,6 +586,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 2548244c089dff583c8c424dcaa5504caedf3f10..e53624d9f2372fceab44bd1c881a6f3cf5862b8c 100644
--- a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
@@ -53,4 +53,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 top.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 e6a4a5898ffdcb2aa2bc01371a6d7dbc06d610ce..22eae4a483b437c75082d889d4ea2904bf2093fc 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
@@ -1090,7 +1090,7 @@ public abstract class BlockBehaviour implements FeatureElement {
}
public PushReaction getPistonPushReaction() {
- return !this.isDestroyable() ? PushReaction.BLOCK : this.pushReaction; // Paper
+ return !this.isDestroyable() ? PushReaction.BLOCK : this.getBlock().getResetPushReaction() == null ? this.pushReaction : this.getBlock().getResetPushReaction(); // Paper // Leaves - can reset
}
public boolean isSolidRender(BlockGetter world, BlockPos pos) {