mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-28 19:39:17 +00:00
54 lines
3.0 KiB
Diff
54 lines
3.0 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: Seed Command
|
|
|
|
Original license: GPLv3
|
|
Original project: https://github.com/plasmoapp/matter
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/commands/SeedCommand.java b/src/main/java/net/minecraft/server/commands/SeedCommand.java
|
|
index 342362c217df5476a927eb54cef3cafcea3889fd..ac859a340dfb26de094a09e117e899a4da2e06a2 100644
|
|
--- a/src/main/java/net/minecraft/server/commands/SeedCommand.java
|
|
+++ b/src/main/java/net/minecraft/server/commands/SeedCommand.java
|
|
@@ -5,17 +5,37 @@ import net.minecraft.commands.CommandSourceStack;
|
|
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));
|
|
+ // 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(() -> {
|
|
+ return Component.translatable("commands.seed.success", seedComponent);
|
|
+ }, false);
|
|
context.getSource().sendSuccess(() -> {
|
|
- return Component.translatable("commands.seed.success", component);
|
|
+ return Component.translatable(("Feature seed: %s"), featureSeedComponent);
|
|
}, false);
|
|
+ // Matter end
|
|
return (int)l;
|
|
}));
|
|
}
|