Skip to content

Commit

Permalink
Fix budding amethyst can push by piston
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Jul 6, 2023
1 parent 9df669b commit 7b5c023
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 27 deletions.
45 changes: 33 additions & 12 deletions patches/server/0012-Budding-Amethyst-can-push-by-piston.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,53 @@ 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
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 void setPushReaction(net.minecraft.world.level.material.PushReaction pushReaction) {
+ properties.pushReaction(pushReaction);
+ 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 b097f72c1009d4c9618e1eece839f53d7429b528..38a547e221be452e5227a855e9a59abf7ab87dd4 100644
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;
Expand All @@ -34,11 +63,3 @@ index b097f72c1009d4c9618e1eece839f53d7429b528..38a547e221be452e5227a855e9a59abf
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;
4 changes: 2 additions & 2 deletions patches/server/0017-Optimize-mob-spawning.patch
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ index 089dd93d4cd4c1f72e63c4944b3b82c1e2ba732d..73bf34c3ce7e55e9fd15a3af90bf107e
// CraftBukkit end
Objects.requireNonNull(info);
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 38a547e221be452e5227a855e9a59abf7ab87dd4..a5091db99c663cb0dcbd35897f70d3f9a07fc4ba 100644
index 6d52de1c0d989d7d968bb0797148bf98b3d6d05d..3379d39526512c40650784414e81aaa0d4a2dfca 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -237,7 +237,7 @@ public final class LeavesConfig {
@@ -236,7 +236,7 @@ public final class LeavesConfig {
noChatSign = getBoolean("settings.misc.no-chat-sign", noChatSign);
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0019-Multithreaded-Tracker.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Subject: [PATCH] Multithreaded Tracker
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)

diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index a5091db99c663cb0dcbd35897f70d3f9a07fc4ba..383f1eddb640c80de5bb737f90d947d546685039 100644
index 3379d39526512c40650784414e81aaa0d4a2dfca..2a41ea2d7b52b17015e6a5ffc05044bd9d46a504 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -256,7 +256,7 @@ public final class LeavesConfig {
@@ -255,7 +255,7 @@ public final class LeavesConfig {
dontSendUselessEntityPackets = getBoolean("settings.performance.dont-send-useless-entity-packets", dontSendUselessEntityPackets);
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0037-Async-Pathfinding.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
But Pufferfish patch was ported downstream from the Petal fork

diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 383f1eddb640c80de5bb737f90d947d546685039..2aa2f773de6a981c5f035ef2bfdc568b04ebf190 100644
index 2a41ea2d7b52b17015e6a5ffc05044bd9d46a504..774402b89c2eb1daee2e7cbedb4a2461f19ae9b8 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -357,7 +357,7 @@ public final class LeavesConfig {
@@ -356,7 +356,7 @@ public final class LeavesConfig {
// only config now
public static boolean asyncPathfinding = false;
private static boolean asyncPathfindingLock = false;
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0053-MC-Technical-Survival-Mode.patch
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ index c767257b56acbe2cde391f405c010f5b2f62a17c..4327ec0948fb82939272f2dc1bbde8b1
entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) {
continue;
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 67d05e317c2140fcfa5591e6fd6e7e28cfafe1ee..ae49a4d1316c26450cb672ced3342887bda61fde 100644
index 774402b89c2eb1daee2e7cbedb4a2461f19ae9b8..ffe31cf433c26264ab4d2e80bdbea166f79b614d 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -2,6 +2,7 @@ package top.leavesmc.leaves;
Expand All @@ -81,7 +81,7 @@ index 67d05e317c2140fcfa5591e6fd6e7e28cfafe1ee..ae49a4d1316c26450cb672ced3342887
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.PushReaction;
@@ -477,6 +478,13 @@ public final class LeavesConfig {
@@ -476,6 +477,13 @@ public final class LeavesConfig {

public static void doMcTechnicalMode() {
if (mcTechnicalMode) {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0057-Leaves-Extra-Yggdrasil-Service.patch
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ index dae36c6452ccd57a436dd918547b64d59957ab0a..973ecf723e4239307600b42f2d12c264
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 8cc74b1eb94ca5e246a667aada013de3af3a4c45..01cc4ae723d5681c17d6a65412987199029fe36b 100644
index ffe31cf433c26264ab4d2e80bdbea166f79b614d..b5c0ad9065ab28b669ab602b8fe520b67f072c2c 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -12,6 +12,7 @@ import org.bukkit.configuration.ConfigurationSection;
Expand All @@ -42,7 +42,7 @@ index 8cc74b1eb94ca5e246a667aada013de3af3a4c45..01cc4ae723d5681c17d6a65412987199
import top.leavesmc.leaves.util.MathUtils;

import java.io.File;
@@ -511,6 +512,9 @@ public final class LeavesConfig {
@@ -510,6 +511,9 @@ public final class LeavesConfig {
extraYggdrasilService = getBoolean("settings.misc.extra-yggdrasil-service.enable", extraYggdrasilService);
extraYggdrasilServiceList = getList("settings.misc.extra-yggdrasil-service.urls", extraYggdrasilServiceList);
if (extraYggdrasilService) {
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0061-Syncmatica-Protocol.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Syncmatica Protocol
This patch is Powered by Syncmatica(https://github.com/End-Tech/syncmatica)

diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0acb073649a286f9756974e941aa5da7ed09ed0d..b616b819a1434fe76a6fa36e70cdc1c22dc70876 100644
index 35295d8577acf11bd701ef2a7aa1bab3784c7274..16433351834ec562debcc1062ad1c0cf1d4b4d06 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -322,6 +322,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
Expand Down Expand Up @@ -54,7 +54,7 @@ index 0acb073649a286f9756974e941aa5da7ed09ed0d..b616b819a1434fe76a6fa36e70cdc1c2
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
this.disconnect("Invalid custom payload!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD);
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 01cc4ae723d5681c17d6a65412987199029fe36b..61597ff3c16fbfc6f4c5bcf8455b43724aaeb2d0 100644
index b5c0ad9065ab28b669ab602b8fe520b67f072c2c..12394d7ef3c2372fb8634a0b78d4da89912efe59 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -13,6 +13,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
Expand All @@ -65,7 +65,7 @@ index 01cc4ae723d5681c17d6a65412987199029fe36b..61597ff3c16fbfc6f4c5bcf8455b4372
import top.leavesmc.leaves.util.MathUtils;

import java.io.File;
@@ -549,6 +550,7 @@ public final class LeavesConfig {
@@ -548,6 +549,7 @@ public final class LeavesConfig {
syncmaticaQuota = getBoolean("settings.protocol.syncmatica.quota", syncmaticaQuota);
syncmaticaQuotaLimit = getInt("settings.protocol.syncmatica.quota-limit", syncmaticaQuotaLimit);
if (syncmaticaProtocol) {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0071-Creative-fly-no-clip.patch
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ index d9baa85962236c42219cf09d4f3129be93ff069c..c1bd06fbc2c5683888f7264c35c25feb

public boolean isSpawning() {
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index d5f5a9f61a4a030246c12bf48c93139196475540..627bc22798ad6bbdb599f55a2a296920573bcaa6 100644
index c69a2efafd31b2367cc9f20652585a801eecea0c..9badc03ac95064824a8dc3e8fbc74b88d6939d2e 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -595,6 +595,7 @@ public final class LeavesConfig {
@@ -594,6 +594,7 @@ public final class LeavesConfig {
}

public static void registerCarpetRules() {
Expand Down

0 comments on commit 7b5c023

Please sign in to comment.