mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-23 08:59:31 +00:00
66 lines
3.6 KiB
Diff
66 lines
3.6 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 9522e646529f3d849471931b4b3c0d133e7fcfc5..72cece40c531372954ab07b2fa99ed50dc3ff3cc 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
|
@@ -585,6 +585,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 4dae2a98070affd84bc4523a927dc9cbfe7379c6..063a7b39438b9ee0e201a22f0238a55d17365520 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
|
|
@@ -47,4 +47,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 de4c1e4701236e7d5ec77339c51ad6a9d8288bb6..5757457fc46aa4a785e559a140ebf0da40ef7405 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
|
|
@@ -1042,7 +1042,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) {
|
|
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
|
index 10a1f6c6b6511859472cc4a60a34a2efe379ccb8..6d52de1c0d989d7d968bb0797148bf98b3d6d05d 100644
|
|
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
|
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
|
@@ -3,6 +3,8 @@ package top.leavesmc.leaves;
|
|
import com.destroystokyo.paper.util.SneakyThrow;
|
|
import com.google.common.base.Throwables;
|
|
import net.minecraft.server.MinecraftServer;
|
|
+import net.minecraft.world.level.block.Blocks;
|
|
+import net.minecraft.world.level.material.PushReaction;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.configuration.ConfigurationSection;
|