Debuginfo Tweaks

This commit is contained in:
simibubi 2023-10-22 11:34:43 +02:00
parent 7eea02854e
commit 8672231703
7 changed files with 51 additions and 47 deletions

View file

@ -582,8 +582,8 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo
5616dda664dd106d576848124fc0fc1de18d0fd3 assets/create/blockstates/yellow_valve_handle.json
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
fb5edeb33c43fb1aa36cfe84e376da287ae23b51 assets/create/lang/en_ud.json
eac32f8a9ed3c1b652916191c96c0ee446fd97ca assets/create/lang/en_us.json
d09a8a181fa472e6ae66bdd8d937d1464aee102f assets/create/lang/en_ud.json
71b5b55d73d5bd7fb39bd352338d9e1ad7184ea9 assets/create/lang/en_us.json
487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json
b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json
3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json

View file

@ -858,6 +858,8 @@
"create.clipboard.pasted_to": "%1$s o\u0287 sbu\u0131\u0287\u0287\u01DDs p\u01DD\u0131\u05DFdd\u2C6F",
"create.clipboard.to_copy": "sbu\u0131\u0287\u0287\u01DDs \u028Edo\u0186 o\u0287 %1$s",
"create.clipboard.to_paste": "sbu\u0131\u0287\u0287\u01DDs \u01DD\u0287s\u0250\u0500 o\u0287 %1$s",
"create.command.debuginfo.saved_to_clipboard": "\u02D9p\u0279\u0250oqd\u0131\u05DF\u0254 \u0279no\u028E o\u0287 p\u01DD\u0131do\u0254 u\u01DD\u01DDq s\u0250\u0265 uo\u0131\u0287\u0250\u026F\u0279o\u025Fu\u0131 bnq\u01DD\u15E1",
"create.command.debuginfo.sending": "\u02D9\u02D9\u02D9uo\u0131\u0287\u0250\u026F\u0279o\u025Fu\u0131 bnq\u01DDp bu\u0131\u0287\u0254\u01DD\u05DF\u05DFo\u0186",
"create.command.killTPSCommand": "sd\u0287\u05DF\u05DF\u0131\u029E",
"create.command.killTPSCommand.argument.tickTime": "\u01DD\u026F\u0131\u27D8\u029E\u0254\u0131\u0287",
"create.command.killTPSCommand.status.slowed_by.0": "o: s\u026F %s \u028Eq p\u01DD\u028Do\u05DFs \u028E\u05DF\u0287u\u01DD\u0279\u0279n\u0254 s\u0131 \u029E\u0254\u0131\u0287 \u0279\u01DD\u028C\u0279\u01DDS :]\u01DD\u0287\u0250\u01DD\u0279\u0186[",

View file

@ -858,6 +858,8 @@
"create.clipboard.pasted_to": "Applied settings to %1$s",
"create.clipboard.to_copy": "%1$s to Copy settings",
"create.clipboard.to_paste": "%1$s to Paste settings",
"create.command.debuginfo.saved_to_clipboard": "Debug information has been copied to your clipboard.",
"create.command.debuginfo.sending": "Collecting debug information...",
"create.command.killTPSCommand": "killtps",
"create.command.killTPSCommand.argument.tickTime": "tickTime",
"create.command.killTPSCommand.status.slowed_by.0": "[Create]: Server tick is currently slowed by %s ms :o",

View file

@ -1,34 +1,28 @@
package com.simibubi.create.infrastructure.command;
import static net.minecraft.commands.Commands.literal;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.builder.ArgumentBuilder;
import com.simibubi.create.AllPackets;
import com.simibubi.create.foundation.utility.Components;
import com.simibubi.create.infrastructure.debugInfo.DebugInformation;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.infrastructure.debugInfo.ServerDebugInfoPacket;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.network.PacketDistributor;
import static net.minecraft.commands.Commands.literal;
public class DebugInfoCommand {
public static ArgumentBuilder<CommandSourceStack, ?> register() {
return literal("debuginfo").executes(ctx -> {
CommandSourceStack source = ctx.getSource();
ServerPlayer player = source.getPlayerOrException();
source.sendSuccess(
Components.literal("Sending server debug information to your client..."), true
);
AllPackets.getChannel().send(
PacketDistributor.PLAYER.with(() -> player),
new ServerDebugInfoPacket(player)
);
Lang.translate("command.debuginfo.sending")
.sendChat(player);
AllPackets.getChannel()
.send(PacketDistributor.PLAYER.with(() -> player), new ServerDebugInfoPacket(player));
return Command.SINGLE_SUCCESS;
});
}

View file

@ -4,24 +4,20 @@ import java.util.List;
import java.util.Objects;
import com.simibubi.create.foundation.networking.SimplePacketBase;
import com.simibubi.create.foundation.utility.Components;
import com.simibubi.create.foundation.utility.DyeHelper;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.infrastructure.debugInfo.element.DebugInfoSection;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.DyeColor;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.network.NetworkEvent;
public class ServerDebugInfoPacket extends SimplePacketBase {
public static final Component COPIED = Components.literal(
"Debug information has been copied to your clipboard."
).withStyle(ChatFormatting.GREEN);
private final List<DebugInfoSection> serverInfo;
private final Player player;
@ -50,8 +46,12 @@ public class ServerDebugInfoPacket extends SimplePacketBase {
private void printInfo(String side, Player player, List<DebugInfoSection> sections, StringBuilder output) {
output.append("<details>");
output.append('\n');
output.append("<summary>").append(side).append(" Info").append("</summary>");
output.append('\n').append('\n');
output.append("<summary>")
.append(side)
.append(" Info")
.append("</summary>");
output.append('\n')
.append('\n');
output.append("```");
output.append('\n');
@ -59,11 +59,14 @@ public class ServerDebugInfoPacket extends SimplePacketBase {
if (i != 0) {
output.append('\n');
}
sections.get(i).print(player, line -> output.append(line).append('\n'));
sections.get(i)
.print(player, line -> output.append(line)
.append('\n'));
}
output.append("```");
output.append('\n').append('\n');
output.append('\n')
.append('\n');
output.append("</details>");
output.append('\n');
}
@ -80,6 +83,9 @@ public class ServerDebugInfoPacket extends SimplePacketBase {
String text = output.toString();
Minecraft.getInstance().keyboardHandler.setClipboard(text);
player.displayClientMessage(COPIED, true);
Lang.translate("command.debuginfo.saved_to_clipboard")
.color(DyeHelper.DYE_TABLE.get(DyeColor.LIME)
.getFirst())
.sendChat(player);
}
}

View file

@ -1,21 +1,18 @@
package com.simibubi.create.infrastructure.debugInfo.element;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.infrastructure.debugInfo.DebugInformation;
import com.simibubi.create.infrastructure.debugInfo.InfoProvider;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Player;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.jetbrains.annotations.Nullable;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.infrastructure.debugInfo.DebugInformation;
import com.simibubi.create.infrastructure.debugInfo.InfoProvider;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Player;
/**
* A section for organizing debug information. Can contain both information and other sections.

View file

@ -1001,6 +1001,9 @@
"create.gui.config.overlay7": "Run /create overlay reset",
"create.gui.config.overlay8": "to reset to the default position",
"create.command.debuginfo.sending": "Collecting debug information...",
"create.command.debuginfo.saved_to_clipboard": "Debug information has been copied to your clipboard.",
"create.command.killTPSCommand": "killtps",
"create.command.killTPSCommand.status.slowed_by.0": "[Create]: Server tick is currently slowed by %s ms :o",
"create.command.killTPSCommand.status.slowed_by.1": "[Create]: Server tick is slowed by %s ms now >:)",
@ -1013,12 +1016,12 @@
"create.contraption.minecart_contraption_illegal_pickup": "A mystical force is binding this Cart Contraption to the world",
"enchantment.create.capacity.desc": "Increases Backtank air capacity.",
"enchantment.create.potato_recovery.desc": "Potato Cannon projectiles have a chance to be reused.",
"enchantment.create.potato_recovery.desc": "Potato Cannon projectiles have a chance to be reused.",
"create.bogey.style.updated_style": "Updated style",
"create.bogey.style.updated_style_and_size": "Updated style and size",
"create.bogey.style.no_other_sizes": "No other sizes",
"create.bogey.style.invalid": "Unnamed style",
"create.bogey.style.standard": "Standard"
"create.bogey.style.updated_style": "Updated style",
"create.bogey.style.updated_style_and_size": "Updated style and size",
"create.bogey.style.no_other_sizes": "No other sizes",
"create.bogey.style.invalid": "Unnamed style",
"create.bogey.style.standard": "Standard"
}