From e1c21d3f288b79659cec4e6deffaf63f31dbe321 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Mon, 30 Jun 2025 22:52:58 +0800 Subject: [PATCH] Movable Budding Amethyst bind carpet rule (#561) --- ...-ex-data.patch => 0003-Leaves-Utils.patch} | 33 +++++++++++- ...-Budding-Amethyst-can-push-by-piston.patch | 54 ------------------- .../0011-Movable-Budding-Amethyst.patch | 23 ++++++++ .../org/leavesmc/leaves/LeavesConfig.java | 12 ++++- 4 files changed, 65 insertions(+), 57 deletions(-) rename leaves-server/minecraft-patches/features/{0003-Leaves-entity-ex-data.patch => 0003-Leaves-Utils.patch} (56%) delete mode 100644 leaves-server/minecraft-patches/features/0011-Budding-Amethyst-can-push-by-piston.patch create mode 100644 leaves-server/minecraft-patches/features/0011-Movable-Budding-Amethyst.patch diff --git a/leaves-server/minecraft-patches/features/0003-Leaves-entity-ex-data.patch b/leaves-server/minecraft-patches/features/0003-Leaves-Utils.patch similarity index 56% rename from leaves-server/minecraft-patches/features/0003-Leaves-entity-ex-data.patch rename to leaves-server/minecraft-patches/features/0003-Leaves-Utils.patch index 759d8af8..62959243 100644 --- a/leaves-server/minecraft-patches/features/0003-Leaves-entity-ex-data.patch +++ b/leaves-server/minecraft-patches/features/0003-Leaves-Utils.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com> Date: Tue, 22 Apr 2025 23:32:41 +0800 -Subject: [PATCH] Leaves entity ex data +Subject: [PATCH] Leaves Utils diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java @@ -47,3 +47,34 @@ index 81a18b8e605bd4c28b48a32c80be231609182970..f8d45c1076852a0553c3dd7c5512f76a + } + // Leaves end - leaves ex data } +diff --git a/net/minecraft/world/level/block/Block.java b/net/minecraft/world/level/block/Block.java +index ae3e6e31171b1bcfba1ae51a0941b52dda270acd..f289e37f77e1c9d3b0f6c29da1b99f0d5f156e37 100644 +--- a/net/minecraft/world/level/block/Block.java ++++ b/net/minecraft/world/level/block/Block.java +@@ -610,6 +610,13 @@ public class Block extends BlockBehaviour implements ItemLike { + } + // CraftBukkit end + ++ // Leaves start - reset push reaction ++ @org.jetbrains.annotations.Nullable ++ public net.minecraft.world.level.material.PushReaction getResetPushReaction() { ++ return null; ++ } ++ // Leaves end - reset push reaction ++ + record ShapePairKey(VoxelShape first, VoxelShape second) { + @Override + public boolean equals(Object other) { +diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java +index 834e27ef2f7b342b074ff9e1e390e02f3ca1c399..be66f0f1cb1b0bcec8f9489a1fdd8777df1adb6b 100644 +--- a/net/minecraft/world/level/block/state/BlockBehaviour.java ++++ b/net/minecraft/world/level/block/state/BlockBehaviour.java +@@ -763,7 +763,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 - reset push reaction + } + + public boolean isSolidRender() { diff --git a/leaves-server/minecraft-patches/features/0011-Budding-Amethyst-can-push-by-piston.patch b/leaves-server/minecraft-patches/features/0011-Budding-Amethyst-can-push-by-piston.patch deleted file mode 100644 index f714beb9..00000000 --- a/leaves-server/minecraft-patches/features/0011-Budding-Amethyst-can-push-by-piston.patch +++ /dev/null @@ -1,54 +0,0 @@ -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/net/minecraft/world/level/block/Block.java b/net/minecraft/world/level/block/Block.java -index ae3e6e31171b1bcfba1ae51a0941b52dda270acd..f289e37f77e1c9d3b0f6c29da1b99f0d5f156e37 100644 ---- a/net/minecraft/world/level/block/Block.java -+++ b/net/minecraft/world/level/block/Block.java -@@ -610,6 +610,13 @@ public class Block extends BlockBehaviour implements ItemLike { - } - // CraftBukkit end - -+ // Leaves start - reset push reaction -+ @org.jetbrains.annotations.Nullable -+ public net.minecraft.world.level.material.PushReaction getResetPushReaction() { -+ return null; -+ } -+ // Leaves end - reset push reaction -+ - record ShapePairKey(VoxelShape first, VoxelShape second) { - @Override - public boolean equals(Object other) { -diff --git a/net/minecraft/world/level/block/BuddingAmethystBlock.java b/net/minecraft/world/level/block/BuddingAmethystBlock.java -index 9fc8e9e2b168954c8377bd1a8cf57f49fa137213..18b3ab3bfa4effed9ff22e5156349d86c7881849 100644 ---- a/net/minecraft/world/level/block/BuddingAmethystBlock.java -+++ b/net/minecraft/world/level/block/BuddingAmethystBlock.java -@@ -58,4 +58,12 @@ 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 -+ @org.jetbrains.annotations.Nullable -+ public net.minecraft.world.level.material.PushReaction getResetPushReaction() { -+ return org.leavesmc.leaves.LeavesConfig.modify.buddingAmethystCanPushByPiston ? net.minecraft.world.level.material.PushReaction.PUSH_ONLY : null; -+ } -+ // Leaves end - budding amethyst can push by piston - } -diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java -index 834e27ef2f7b342b074ff9e1e390e02f3ca1c399..bbb1abfbfe7afd7b631cf269c1e338697cd016d2 100644 ---- a/net/minecraft/world/level/block/state/BlockBehaviour.java -+++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -763,7 +763,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() { diff --git a/leaves-server/minecraft-patches/features/0011-Movable-Budding-Amethyst.patch b/leaves-server/minecraft-patches/features/0011-Movable-Budding-Amethyst.patch new file mode 100644 index 00000000..d5300a6f --- /dev/null +++ b/leaves-server/minecraft-patches/features/0011-Movable-Budding-Amethyst.patch @@ -0,0 +1,23 @@ +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] Movable Budding Amethyst + + +diff --git a/net/minecraft/world/level/block/BuddingAmethystBlock.java b/net/minecraft/world/level/block/BuddingAmethystBlock.java +index 9fc8e9e2b168954c8377bd1a8cf57f49fa137213..2f16d8ff58d3cbadeb210d75d60e46e9ed1f02f7 100644 +--- a/net/minecraft/world/level/block/BuddingAmethystBlock.java ++++ b/net/minecraft/world/level/block/BuddingAmethystBlock.java +@@ -58,4 +58,12 @@ 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 ++ @org.jetbrains.annotations.Nullable ++ public net.minecraft.world.level.material.PushReaction getResetPushReaction() { ++ return org.leavesmc.leaves.LeavesConfig.modify.movableBuddingAmethyst ? net.minecraft.world.level.material.PushReaction.NORMAL : null; ++ } ++ // Leaves end - budding amethyst can push by piston + } diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/LeavesConfig.java b/leaves-server/src/main/java/org/leavesmc/leaves/LeavesConfig.java index ba692445..3613da69 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/LeavesConfig.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/LeavesConfig.java @@ -378,8 +378,16 @@ public final class LeavesConfig { public boolean redstoneShearsWrench = true; @RemovedConfig(name = "budding-amethyst-can-push-by-piston", category = {}, transform = true) - @GlobalConfig("budding-amethyst-can-push-by-piston") - public boolean buddingAmethystCanPushByPiston = false; + @RemovedConfig(name = "budding-amethyst-can-push-by-piston", category = "modify", transform = true) + @GlobalConfig(value = "movable-budding-amethyst", validator = MovableBuddingAmethystValidator.class) + public boolean movableBuddingAmethyst = false; + + private static class MovableBuddingAmethystValidator extends BooleanConfigValidator { + @Override + public void verify(Boolean old, Boolean value) throws IllegalArgumentException { + CarpetRules.register(CarpetRule.of("carpet", "movableAmethyst", value)); + } + } @RemovedConfig(name = "spectator-dont-get-advancement", category = {}, transform = true) @GlobalConfig("spectator-dont-get-advancement")