9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00

Movable Budding Amethyst bind carpet rule (#561)

This commit is contained in:
violetc
2025-06-30 22:52:58 +08:00
parent df8397c794
commit e1c21d3f28
4 changed files with 65 additions and 57 deletions

View File

@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com> From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
Date: Tue, 22 Apr 2025 23:32:41 +0800 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 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 + // 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() {

View File

@@ -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() {

View File

@@ -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
}

View File

@@ -378,8 +378,16 @@ public final class LeavesConfig {
public boolean redstoneShearsWrench = true; public boolean redstoneShearsWrench = true;
@RemovedConfig(name = "budding-amethyst-can-push-by-piston", category = {}, transform = true) @RemovedConfig(name = "budding-amethyst-can-push-by-piston", category = {}, transform = true)
@GlobalConfig("budding-amethyst-can-push-by-piston") @RemovedConfig(name = "budding-amethyst-can-push-by-piston", category = "modify", transform = true)
public boolean buddingAmethystCanPushByPiston = false; @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) @RemovedConfig(name = "spectator-dont-get-advancement", category = {}, transform = true)
@GlobalConfig("spectator-dont-get-advancement") @GlobalConfig("spectator-dont-get-advancement")