Files
Purpur/patches/server/0215-Big-dripleaf-tilt-delay.patch
2021-12-02 19:15:58 -05:00

53 lines
2.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 16 Jul 2021 22:47:29 -0500
Subject: [PATCH] Big dripleaf tilt delay
Makes the tilt delays configurable. There are only 3 types of tilts used by this setting. When an entity steps on a
big_dripleaf with no tilt it will immediately change to an UNSTABLE tilt. Each change after that is on a tick timer:
UNSTABLE: big_dripleaf with UNSTABLE tilt will change to PARTIAL tilt after 10 ticks
PARTIAL: big_dripleaf with PARTIAL tilt will change to FULL tilt after 10 ticks
UNSTABLE: big_dripleaf with FULL tilt will change back to no tilt after 100 ticks
diff --git a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
index 3f434ac77611a81889b15c118a0fca57cc10a6bb..36d65d85d3cc030551fc0957c1ebbff66d80f244 100644
--- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
@@ -237,7 +237,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone
BigDripleafBlock.playTiltSound(world, blockposition, soundeffect);
}
- int i = BigDripleafBlock.DELAY_UNTIL_NEXT_TILT_STATE.getInt(tilt);
+ int i = world.purpurConfig.bigDripleafTiltDelay.getOrDefault(tilt, -1); // Purpur
if (i != -1) {
world.scheduleTick(blockposition, (Block) this, i);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 8012730d0f82b9ecdee59241c87c9ed56f7f3c67..76e599962983c840e3db08f77e54a62b48999d43 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -696,6 +696,22 @@ public class PurpurWorldConfig {
}
}
+ public Map<Tilt, Integer> bigDripleafTiltDelay = new HashMap<>();
+ private void bigDripleafSettings() {
+ bigDripleafTiltDelay.clear();
+ getMap("blocks.big_dripleaf.tilt-delay", Map.ofEntries(
+ Map.entry("UNSTABLE", 10),
+ Map.entry("PARTIAL", 10),
+ Map.entry("FULL", 100))
+ ).forEach((tilt, delay) -> {
+ try {
+ bigDripleafTiltDelay.put(Tilt.valueOf(tilt), (int) delay);
+ } catch (IllegalArgumentException e) {
+ PurpurConfig.log(Level.SEVERE, "Invalid big_dripleaf tilt key: " + tilt);
+ }
+ });
+ }
+
public boolean buddingAmethystSilkTouch = false;
private void buddingAmethystSettings() {
buddingAmethystSilkTouch = getBoolean("blocks.budding_amethyst.silk-touch", buddingAmethystSilkTouch);