48 lines
2.8 KiB
Diff
48 lines
2.8 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] Seed Command
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/commands/SeedCommand.java b/src/main/java/net/minecraft/server/commands/SeedCommand.java
|
|
index 9ca33c07a261316febdb0bd67cd716848064878e..5752b6fb33d0c27fc57d6e6f2fb3660fce4f1dee 100644
|
|
--- a/src/main/java/net/minecraft/server/commands/SeedCommand.java
|
|
+++ b/src/main/java/net/minecraft/server/commands/SeedCommand.java
|
|
@@ -6,14 +6,34 @@ import net.minecraft.commands.Commands;
|
|
import net.minecraft.network.chat.Component;
|
|
import net.minecraft.network.chat.ComponentUtils;
|
|
|
|
+// Matter start
|
|
+import net.minecraft.ChatFormatting;
|
|
+import net.minecraft.network.chat.ClickEvent;
|
|
+import net.minecraft.network.chat.HoverEvent;
|
|
+import su.plo.matter.Globals;
|
|
+// Matter end
|
|
+
|
|
public class SeedCommand {
|
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean dedicated) {
|
|
dispatcher.register(Commands.literal("seed").requires((source) -> {
|
|
return !dedicated || source.hasPermission(2);
|
|
}).executes((context) -> {
|
|
long l = context.getSource().getLevel().getSeed();
|
|
- Component component = ComponentUtils.copyOnClickText(String.valueOf(l));
|
|
- context.getSource().sendSuccess(Component.translatable("commands.seed.success", component), false);
|
|
+ // Matter start - Seed Command
|
|
+ Globals.setupGlobals(context.getSource().getLevel());
|
|
+ String seedStr = Globals.seedToString(Globals.worldSeed);
|
|
+
|
|
+ Component seedComponent = ComponentUtils.wrapInSquareBrackets(Component.literal(String.valueOf(l)).withStyle((style) -> {
|
|
+ return style.withColor(ChatFormatting.GREEN).withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, String.valueOf(l))).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("chat.copy.click"))).withInsertion(String.valueOf(l));
|
|
+ }));
|
|
+
|
|
+ Component featureSeedComponent = ComponentUtils.wrapInSquareBrackets(Component.translatable("chat.copy.click").withStyle((style) -> {
|
|
+ return style.withColor(ChatFormatting.GREEN).withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, seedStr)).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("chat.copy.click"))).withInsertion(seedStr);
|
|
+ }));
|
|
+
|
|
+ context.getSource().sendSuccess(Component.translatable("commands.seed.success", seedComponent), false);
|
|
+ context.getSource().sendSuccess(Component.translatable("Feature seed: %s", featureSeedComponent), false);
|
|
+ // Matter end
|
|
return (int)l;
|
|
}));
|
|
}
|