Skip to content

Commit 5aa3aac

Browse files
committedSep 4, 2023
Loot world random (#120)
1 parent becbb7a commit 5aa3aac

12 files changed

+69
-32
lines changed
 

‎patches/server/0004-Leaves-Server-Config-And-Command.patch

+27-12
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ index e1c99d941c7bb954bf3ac83d5002dbf58fd833b0..4760b943da08771a42fcb22eba4d586d
129129
.withRequiredArg()
130130
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
131131
new file mode 100644
132-
index 0000000000000000000000000000000000000000..c02c51f824be1173d24b20394b5855fc857fc0a4
132+
index 0000000000000000000000000000000000000000..d739f8b96caea228335543f412546d187c7f246c
133133
--- /dev/null
134134
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
135-
@@ -0,0 +1,1005 @@
135+
@@ -0,0 +1,1020 @@
136136
+package top.leavesmc.leaves;
137137
+
138138
+import com.destroystokyo.paper.util.SneakyThrow;
@@ -160,7 +160,7 @@ index 0000000000000000000000000000000000000000..c02c51f824be1173d24b20394b5855fc
160160
+public final class LeavesConfig {
161161
+
162162
+ public static final String CONFIG_HEADER = "Configuration file for Leaves.";
163-
+ public static final int CURRENT_CONFIG_VERSION = 4;
163+
+ public static final int CURRENT_CONFIG_VERSION = 5;
164164
+
165165
+ private static final Object[] EMPTY = new Object[0];
166166
+
@@ -266,6 +266,20 @@ index 0000000000000000000000000000000000000000..c02c51f824be1173d24b20394b5855fc
266266
+ alternativeBlockPlacement = carpetAlternative ? "CARPET" : "NONE";
267267
+ config.set("settings.protocol.carpet-alternative-block-placement", null);
268268
+ }
269+
+
270+
+ case 4 -> {
271+
+ shearsInDispenserCanZeroAmount = config.getBoolean("settings.modify.shears-in-dispenser-can-zero-amount", shearsInDispenserCanZeroAmount);
272+
+ instantBlockUpdaterReintroduced = config.getBoolean("settings.modify.instant-block-updater-reintroduced", instantBlockUpdaterReintroduced);
273+
+ redstoneDontCantOnTrapDoor = config.getBoolean("settings.modify.redstone-wire-dont-connect-if-on-trapdoor", redstoneDontCantOnTrapDoor);
274+
+ mendingCompatibilityInfinity = config.getBoolean("settings.modify.mending-compatibility-infinity", mendingCompatibilityInfinity);
275+
+ zeroTickPlants = config.getBoolean("settings.modify.zero-tick-plants", zeroTickPlants);
276+
+
277+
+ config.set("settings.modify.shears-in-dispenser-can-zero-amount", null);
278+
+ config.set("settings.modify.instant-block-updater-reintroduced", null);
279+
+ config.set("settings.modify.redstone-wire-dont-connect-if-on-trapdoor", null);
280+
+ config.set("settings.modify.mending-compatibility-infinity", null);
281+
+ config.set("settings.modify.zero-tick-plants", null);
282+
+ }
269283
+ }
270284
+ }
271285
+ }
@@ -340,7 +354,7 @@ index 0000000000000000000000000000000000000000..c02c51f824be1173d24b20394b5855fc
340354
+
341355
+ public static boolean shearsInDispenserCanZeroAmount = false;
342356
+ private static void shearsInDispenserCanZeroAmount() {
343-
+ shearsInDispenserCanZeroAmount = getBoolean("settings.modify.shears-in-dispenser-can-zero-amount", shearsInDispenserCanZeroAmount);
357+
+ shearsInDispenserCanZeroAmount = getBoolean("settings.modify.minecraft-old.shears-in-dispenser-can-zero-amount", shearsInDispenserCanZeroAmount);
344358
+ }
345359
+
346360
+ public static boolean redstoneShearsWrench = true;
@@ -365,10 +379,6 @@ index 0000000000000000000000000000000000000000..c02c51f824be1173d24b20394b5855fc
365379
+
366380
+ public static boolean noChatSign = true;
367381
+ private static void noChatSign() {
368-
+ if (LeavesConfig.config.contains("settings.modify.no-chat-sign")) {
369-
+ noChatSign = LeavesConfig.config.getBoolean("settings.modify.no-chat-sign");
370-
+ LeavesConfig.config.set("settings.modify.no-chat-sign", null);
371-
+ }
372382
+ noChatSign = getBoolean("settings.misc.no-chat-sign", noChatSign);
373383
+ }
374384
+
@@ -547,7 +557,7 @@ index 0000000000000000000000000000000000000000..c02c51f824be1173d24b20394b5855fc
547557
+ private static boolean instantBlockUpdaterReintroducedLock = false;
548558
+ private static void instantBlockUpdaterReintroduced() {
549559
+ if (!instantBlockUpdaterReintroducedLock) {
550-
+ instantBlockUpdaterReintroduced = getBoolean("settings.modify.instant-block-updater-reintroduced", instantBlockUpdaterReintroduced);
560+
+ instantBlockUpdaterReintroduced = getBoolean("settings.modify.minecraft-old.instant-block-updater-reintroduced", instantBlockUpdaterReintroduced);
551561
+ instantBlockUpdaterReintroducedLock = true;
552562
+ }
553563
+ }
@@ -692,7 +702,7 @@ index 0000000000000000000000000000000000000000..c02c51f824be1173d24b20394b5855fc
692702
+
693703
+ public static boolean redstoneDontCantOnTrapDoor = false;
694704
+ private static void redstoneDontCantOnTrapDoor() {
695-
+ redstoneDontCantOnTrapDoor = getBoolean("settings.modify.redstone-wire-dont-connect-if-on-trapdoor", redstoneDontCantOnTrapDoor);
705+
+ redstoneDontCantOnTrapDoor = getBoolean("settings.modify.minecraft-old.redstone-wire-dont-connect-if-on-trapdoor", redstoneDontCantOnTrapDoor);
696706
+ }
697707
+
698708
+ public static boolean disableCheckOutOfOrderCommand = false;
@@ -725,7 +735,7 @@ index 0000000000000000000000000000000000000000..c02c51f824be1173d24b20394b5855fc
725735
+
726736
+ public static boolean mendingCompatibilityInfinity = false;
727737
+ private static void mendingCompatibilityInfinity() {
728-
+ mendingCompatibilityInfinity = getBoolean("settings.modify.mending-compatibility-infinity", mendingCompatibilityInfinity);
738+
+ mendingCompatibilityInfinity = getBoolean("settings.modify.minecraft-old.mending-compatibility-infinity", mendingCompatibilityInfinity);
729739
+ }
730740
+
731741
+ public static boolean shaveSnowLayers = true;
@@ -912,7 +922,7 @@ index 0000000000000000000000000000000000000000..c02c51f824be1173d24b20394b5855fc
912922
+
913923
+ public static boolean zeroTickPlants = false;
914924
+ private static void zeroTickPlants() {
915-
+ zeroTickPlants = getBoolean("settings.modify.zero-tick-plants", zeroTickPlants);
925+
+ zeroTickPlants = getBoolean("settings.modify.minecraft-old.zero-tick-plants", zeroTickPlants);
916926
+ }
917927
+
918928
+ public static boolean bstatsPrivacyMode = false;
@@ -963,6 +973,11 @@ index 0000000000000000000000000000000000000000..c02c51f824be1173d24b20394b5855fc
963973
+ hopperCounter = getBoolean("settings.modify.hopper-counter", hopperCounter);
964974
+ }
965975
+
976+
+ public static boolean lootWorldRandom = false;
977+
+ private static void lootWorldRandom() {
978+
+ lootWorldRandom = getBoolean("settings.modify.minecraft-old.loot-world-random", lootWorldRandom);
979+
+ }
980+
+
966981
+ public static final class WorldConfig {
967982
+
968983
+ public final String worldName;

‎patches/server/0019-Multithreaded-Tracker.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Subject: [PATCH] Multithreaded Tracker
66
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
77

88
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
9-
index 8b19b4c7d3d14d57a2eb3674b63ff352b0fe83bd..1db1d2ac599c561d86716de0ce58712a63658fe3 100644
9+
index 904d1fe0bf325c09b67e43bdaa81c902d57b8e26..f9ef4451b43d6e37d91edfcbeb5d1fbf564e596c 100644
1010
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
1111
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
12-
@@ -259,7 +259,7 @@ public final class LeavesConfig {
12+
@@ -269,7 +269,7 @@ public final class LeavesConfig {
1313
dontSendUselessEntityPackets = getBoolean("settings.performance.dont-send-useless-entity-packets", dontSendUselessEntityPackets);
1414
}
1515

‎patches/server/0037-Async-Pathfinding.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
77
But Pufferfish patch was ported downstream from the Petal fork
88

99
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
10-
index 1db1d2ac599c561d86716de0ce58712a63658fe3..4a7ac6933e98528db90763426d87682c76b9f50c 100644
10+
index f9ef4451b43d6e37d91edfcbeb5d1fbf564e596c..cb84db4e1160c8cfdb41ff3196f7e13e1533f1b6 100644
1111
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
1212
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
13-
@@ -360,7 +360,7 @@ public final class LeavesConfig {
13+
@@ -370,7 +370,7 @@ public final class LeavesConfig {
1414
// only config now
1515
public static boolean asyncPathfinding = false;
1616
private static boolean asyncPathfindingLock = false;

‎patches/server/0052-MC-Technical-Survival-Mode.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ index 9af07ebff3a510a4e3fc71ab4d08897db02b7299..81eaa7ead4821929f20e4c5fcb822504
109109
entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) {
110110
continue;
111111
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
112-
index 4a7ac6933e98528db90763426d87682c76b9f50c..abd00fd34486e9c347773c7d0122cbdd5170c87a 100644
112+
index cb84db4e1160c8cfdb41ff3196f7e13e1533f1b6..120bb8cfefe64ae806d23c885fd3c4765f35214d 100644
113113
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
114114
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
115115
@@ -2,6 +2,7 @@ package top.leavesmc.leaves;
@@ -120,7 +120,7 @@ index 4a7ac6933e98528db90763426d87682c76b9f50c..abd00fd34486e9c347773c7d0122cbdd
120120
import net.minecraft.server.MinecraftServer;
121121
import org.bukkit.Bukkit;
122122
import org.bukkit.command.Command;
123-
@@ -480,6 +481,14 @@ public final class LeavesConfig {
123+
@@ -490,6 +491,14 @@ public final class LeavesConfig {
124124

125125
public static void doMcTechnicalMode() {
126126
if (mcTechnicalMode) {

‎patches/server/0056-Leaves-Extra-Yggdrasil-Service.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ index c748b29bf2d4382215bffd41854f70fd15f9411e..43638595413bbcc5dcaf04daa8c1df05
4444
public final Thread serverThread;
4545
private long nextTickTime;
4646
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
47-
index abd00fd34486e9c347773c7d0122cbdd5170c87a..8d7022e12387ffc8f06c0d3ed24a46a87970a8f4 100644
47+
index 120bb8cfefe64ae806d23c885fd3c4765f35214d..c5a4d1439d8df12fa2fe5157fcac92c74d1ddad9 100644
4848
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
4949
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
5050
@@ -11,6 +11,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
@@ -55,7 +55,7 @@ index abd00fd34486e9c347773c7d0122cbdd5170c87a..8d7022e12387ffc8f06c0d3ed24a46a8
5555
import top.leavesmc.leaves.util.MathUtils;
5656

5757
import java.io.File;
58-
@@ -517,6 +518,9 @@ public final class LeavesConfig {
58+
@@ -527,6 +528,9 @@ public final class LeavesConfig {
5959
extraYggdrasilLoginProtect = getBoolean("settings.misc.extra-yggdrasil-service.login-protect", extraYggdrasilLoginProtect);
6060
extraYggdrasilServiceList = getList("settings.misc.extra-yggdrasil-service.urls", extraYggdrasilServiceList);
6161
if (extraYggdrasilService) {

‎patches/server/0060-Syncmatica-Protocol.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ index bb0e97bd0f4332a2da1b9f077d61b6f81fbeaaad..b2be14056502a902f8fd2caaacaffc5d
5454
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
5555
this.disconnect("Invalid custom payload!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD);
5656
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
57-
index 8d7022e12387ffc8f06c0d3ed24a46a87970a8f4..18156eaee7e7523db74a01d0870269ce0cd0a3a4 100644
57+
index c5a4d1439d8df12fa2fe5157fcac92c74d1ddad9..b5f69089f91d842f0e3a1224b26fb17e162d796d 100644
5858
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
5959
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
6060
@@ -12,6 +12,7 @@ import top.leavesmc.leaves.command.LeavesCommand;
@@ -65,7 +65,7 @@ index 8d7022e12387ffc8f06c0d3ed24a46a87970a8f4..18156eaee7e7523db74a01d0870269ce
6565
import top.leavesmc.leaves.util.MathUtils;
6666

6767
import java.io.File;
68-
@@ -555,6 +556,7 @@ public final class LeavesConfig {
68+
@@ -565,6 +566,7 @@ public final class LeavesConfig {
6969
syncmaticaQuota = getBoolean("settings.protocol.syncmatica.quota", syncmaticaQuota);
7070
syncmaticaQuotaLimit = getInt("settings.protocol.syncmatica.quota-limit", syncmaticaQuotaLimit);
7171
if (syncmaticaProtocol) {

‎patches/server/0070-Creative-fly-no-clip.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ index 1ec80f9c901dff1c9f29befa5a8e3c3f6f37aaf7..f26e5626c0823c041eeb388cbcd78e52
8585

8686
public boolean isSpawning() {
8787
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
88-
index 23854dc256ff28adece0b6b4438fb1038b138244..14f1ec1ac00b9ca461edc27902def45cd34b585f 100644
88+
index 3616400f69d41d3c7bf46f490f24e65af541c336..279dd789dc4ef7e6824a171b652c07a730391a2b 100644
8989
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
9090
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
91-
@@ -601,6 +601,7 @@ public final class LeavesConfig {
91+
@@ -611,6 +611,7 @@ public final class LeavesConfig {
9292
}
9393

9494
public static void registerCarpetRules() {

‎patches/server/0077-Bladeren-mspt-sync-protocol.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ index 47b27712c6ed11fc5c2cd7de04482870207545e7..93054a59f14fee933a908944e93b462b
4141

4242
public boolean getCommandBlockOverride(String command) {
4343
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
44-
index 14f1ec1ac00b9ca461edc27902def45cd34b585f..a768a49f701c4045c4729c5b8893b9aff41a275b 100644
44+
index 279dd789dc4ef7e6824a171b652c07a730391a2b..94b946b7d2586d6db874f6e70d36800766ae9523 100644
4545
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
4646
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
47-
@@ -847,6 +847,7 @@ public final class LeavesConfig {
47+
@@ -857,6 +857,7 @@ public final class LeavesConfig {
4848
}
4949

5050
public static void registerLeavesFeatures() {

‎patches/server/0081-Lava-riptide.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ index 8078f127ff4b6e0aafb5804b9c02e237f79445b5..801f066878d6ffe5dabe01d20513db90
2727
} else {
2828
user.startUsingItem(hand);
2929
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
30-
index 871ab6819f3c98c2f705689939115f0f53cedbc8..837c76768e6e93c5f8df7817cf644f7e0c53237a 100644
30+
index 7db8506c5c6bca2a1cbd1abf4c0d65f93f45a52f..a95ee1dbad7dc689def803f55cb9a62ed821a789 100644
3131
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
3232
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
33-
@@ -851,6 +851,7 @@ public final class LeavesConfig {
33+
@@ -861,6 +861,7 @@ public final class LeavesConfig {
3434

3535
public static void registerLeavesFeatures() {
3636
LeavesFeatureSet.register(LeavesFeature.of("mspt_sync", msptSyncProtocol));

‎patches/server/0110-Avoid-anvil-too-expensive.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ index e0c3a4ba27e21c3692e601acd0af60873bcbb84c..b9fcf49ed88c62265d9aa8926c1228b9
1818
}
1919

2020
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
21-
index 7c2e19d10c28eaf776bc552c9742a847fce9ab66..17731c91e6e55666fd5795dba924f6eff20755f4 100644
21+
index 0d43652e2ac7a0680aa50c212c75ff6b9496e9f3..63ddd86a124b27e128dbf1cef60eab1b4750e251 100644
2222
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
2323
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
24-
@@ -610,6 +610,7 @@ public final class LeavesConfig {
24+
@@ -620,6 +620,7 @@ public final class LeavesConfig {
2525

2626
public static void registerCarpetRules() {
2727
CarpetRules.register(CarpetRule.of("carpet", "creativeNoClip", creativeNoClip));

‎patches/server/0115-Add-Leaves-Auto-Update.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Subject: [PATCH] Add Leaves Auto Update
55

66

77
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
8-
index 17731c91e6e55666fd5795dba924f6eff20755f4..55df063d02e33f6f115e4866fffe1fe161954e02 100644
8+
index 63ddd86a124b27e128dbf1cef60eab1b4750e251..6fa8261ba02df4571a533c70eb83eed676169c10 100644
99
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
1010
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
1111
@@ -14,6 +14,7 @@ import top.leavesmc.leaves.bot.agent.Actions;
@@ -16,7 +16,7 @@ index 17731c91e6e55666fd5795dba924f6eff20755f4..55df063d02e33f6f115e4866fffe1fe1
1616
import top.leavesmc.leaves.util.MathUtils;
1717
import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRule;
1818
import top.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRules;
19-
@@ -825,6 +826,7 @@ public final class LeavesConfig {
19+
@@ -835,6 +836,7 @@ public final class LeavesConfig {
2020
private static void autoUpdate() {
2121
autoUpdate = getBoolean("settings.misc.auto-update.enable", autoUpdate);
2222
autoUpdateTime = getList("settings.misc.auto-update.time", autoUpdateTime);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: violetc <58360096+s-yh-china@users.noreply.github.com>
3+
Date: Mon, 4 Sep 2023 22:09:10 +0800
4+
Subject: [PATCH] Loot world random
5+
6+
7+
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java b/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java
8+
index 17df8b341c65ca24fd2a18424f221918d0a7a111..d5eea5d36b9fac6001cca262e9a7c397852e4bdb 100644
9+
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java
10+
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java
11+
@@ -113,6 +113,11 @@ public class LootContext {
12+
ServerLevel serverLevel = this.getLevel();
13+
MinecraftServer minecraftServer = serverLevel.getServer();
14+
RandomSource randomSource;
15+
+ // Leaves start - world random
16+
+ if (top.leavesmc.leaves.LeavesConfig.lootWorldRandom) {
17+
+ return new LootContext(this.params, serverLevel.getRandom(), minecraftServer.getLootData());
18+
+ }
19+
+ // Leaves end - world random
20+
if (this.random != null) {
21+
randomSource = this.random;
22+
} else if (randomSequenceId != null) {

0 commit comments

Comments
 (0)
Please sign in to comment.