9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-23 17:09:26 +00:00
Files
LeavesMC/patches/server/0012-Budding-Amethyst-can-push-by-piston.patch
2023-06-27 02:06:57 +08:00

45 lines
2.2 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..e8e5be743f1303589ad0d3bcb14d6f3782802a3e 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 void setPushReaction(net.minecraft.world.level.material.PushReaction pushReaction) {
+ properties.pushReaction(pushReaction);
+ }
+ // Leaves end - reset push reaction
+
public static final class BlockStatePairKey {
private final BlockState first;
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index b097f72c1009d4c9618e1eece839f53d7429b528..38a547e221be452e5227a855e9a59abf7ab87dd4 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;
@@ -213,6 +215,7 @@ public final class LeavesConfig {
public static boolean buddingAmethystCanPushByPiston = false;
private static void buddingAmethystCanPushByPiston() {
buddingAmethystCanPushByPiston = getBoolean("settings.modify.budding-amethyst-can-push-by-piston", buddingAmethystCanPushByPiston);
+ Blocks.BUDDING_AMETHYST.setPushReaction(buddingAmethystCanPushByPiston ? PushReaction.PUSH_ONLY : PushReaction.DESTROY);
}
public static boolean spectatorDontGetAdvancement = false;