9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-26 10:29:13 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0134-Matter-Secure-Seed-command.patch
Dreeam 9a4efaa230 Drop patch that causes performance regression
Originally vanilla logic is to use stream, and Mojang switched it to Guava's Collections2
since 1.21.4. It is much faster than using stream or manually adding to a new ArrayList.
Manually adding to a new ArrayList requires allocating a new object array. However, the Collections2
lazy handles filter condition on iteration, so much better.
2025-08-04 19:25:56 +08:00

29 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Apehum <apehumchik@gmail.com>
Date: Thu, 16 Dec 2021 04:23:40 +0800
Subject: [PATCH] Matter: Secure Seed command
Original license: GPLv3
Original project: https://github.com/plasmoapp/matter
diff --git a/net/minecraft/server/commands/SeedCommand.java b/net/minecraft/server/commands/SeedCommand.java
index 7c1e18d8362be5ae885c32b05e98b9ef45942d93..e54ed64059956555767c0c01057a8319e671b1d2 100644
--- a/net/minecraft/server/commands/SeedCommand.java
+++ b/net/minecraft/server/commands/SeedCommand.java
@@ -12,6 +12,15 @@ public class SeedCommand {
long seed = commandContext.getSource().getLevel().getSeed();
Component component = ComponentUtils.copyOnClickText(String.valueOf(seed));
commandContext.getSource().sendSuccess(() -> Component.translatable("commands.seed.success", component), false);
+ // Leaf start - Matter - Secure Seed command
+ if (org.dreeam.leaf.config.modules.misc.SecureSeed.enabled) {
+ su.plo.matter.Globals.setupGlobals(commandContext.getSource().getLevel());
+ String seedStr = su.plo.matter.Globals.seedToString(su.plo.matter.Globals.worldSeed);
+ Component featureSeedComponent = ComponentUtils.copyOnClickText(seedStr);
+
+ commandContext.getSource().sendSuccess(() -> Component.translatable(("Feature seed: %s"), featureSeedComponent), false);
+ }
+ // Leaf end - Matter - Secure Seed command
return (int)seed;
}));
}