mirror of
https://github.com/neoforged/NeoForge
synced 2026-08-20 08:23:13 -04:00
Co-authored-by: Apex <robsonlawson3@gmail.com> Co-authored-by: coehlrich <coehlrich@users.noreply.github.com> Co-authored-by: embeddedt <42941056+embeddedt@users.noreply.github.com> Co-authored-by: Matyrobbrt <matyrobbrt@gmail.com> Co-authored-by: Minecraftschurli <minecraftschurli@gmail.com> Co-authored-by: Sara Freimer <sara@freimer.com> Co-authored-by: Sebastian Hartte <shartte@users.noreply.github.com> Co-authored-by: Technici4n <13494793+Technici4n@users.noreply.github.com> Co-authored-by: XFactHD <xfacthd@gmx.de>
81 lines
3.8 KiB
Diff
81 lines
3.8 KiB
Diff
--- a/net/minecraft/client/gui/components/DebugScreenOverlay.java
|
|
+++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java
|
|
@@ -185,8 +_,14 @@
|
|
Entity entity = this.minecraft.getCameraEntity();
|
|
this.block = entity.pick(20.0, 0.0F, false);
|
|
this.liquid = entity.pick(20.0, 0.0F, true);
|
|
- this.drawGameInformation(p_281427_);
|
|
- this.drawSystemInformation(p_281427_);
|
|
+
|
|
+ final List<String> gameInformation = this.collectGameInformationText();
|
|
+ final List<String> systemInformation = this.collectSystemInformationText();
|
|
+ var event = new net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent.DebugText(minecraft.getWindow(), p_281427_, minecraft.getDeltaTracker(), gameInformation, systemInformation);
|
|
+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(event);
|
|
+ this.renderLines(p_281427_, gameInformation, true);
|
|
+ this.renderLines(p_281427_, systemInformation, false);
|
|
+
|
|
this.profilerPieChart.setBottomOffset(10);
|
|
if (this.renderFpsCharts) {
|
|
int i = p_281427_.guiWidth();
|
|
@@ -219,7 +_,11 @@
|
|
profilerfiller.pop();
|
|
}
|
|
|
|
- protected void drawGameInformation(GuiGraphics p_281525_) {
|
|
+ /**
|
|
+ * Neo: Extracted body of {@link DebugScreenOverlay#drawGameInformation} to return game information
|
|
+ * without drawing for {@link net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent.DebugText} to modify
|
|
+ */
|
|
+ protected List<String> collectGameInformationText() {
|
|
List<String> list = this.getGameInformation();
|
|
list.add("");
|
|
boolean flag = this.minecraft.getSingleplayerServer() != null;
|
|
@@ -234,11 +_,25 @@
|
|
+ (this.renderNetworkCharts ? " visible" : " hidden")
|
|
);
|
|
list.add("For help: press F3 + Q");
|
|
+ return list;
|
|
+ }
|
|
+
|
|
+ protected void drawGameInformation(GuiGraphics p_281525_) {
|
|
+ List<String> list = this.collectGameInformationText();
|
|
this.renderLines(p_281525_, list, true);
|
|
}
|
|
|
|
- protected void drawSystemInformation(GuiGraphics p_281261_) {
|
|
+ /**
|
|
+ * Neo: Extracted body of {@link DebugScreenOverlay#drawSystemInformation} to return system information
|
|
+ * without drawing for {@link net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent.DebugText} to modify
|
|
+ */
|
|
+ protected List<String> collectSystemInformationText() {
|
|
List<String> list = this.getSystemInformation();
|
|
+ return list;
|
|
+ }
|
|
+
|
|
+ protected void drawSystemInformation(GuiGraphics p_281261_) {
|
|
+ List<String> list = this.collectSystemInformationText();
|
|
this.renderLines(p_281261_, list, false);
|
|
}
|
|
|
|
@@ -568,6 +_,13 @@
|
|
gpudevice.getRenderer(),
|
|
String.format(Locale.ROOT, "%s %s", gpudevice.getBackendName(), gpudevice.getVersion())
|
|
);
|
|
+ if (this.minecraft.isDemo()) {
|
|
+ if (this.minecraft.level.getGameTime() >= 120500L) {
|
|
+ list.add(0, net.minecraft.network.chat.Component.translatable("demo.demoExpired").getString());
|
|
+ } else {
|
|
+ list.add(0, net.minecraft.network.chat.Component.translatable("demo.remainingTime", net.minecraft.util.StringUtil.formatTickDuration((int)(120500L - this.minecraft.level.getGameTime()), this.minecraft.level.tickRateManager().tickrate())).getString());
|
|
+ }
|
|
+ }
|
|
if (this.minecraft.showOnlyReducedInfo()) {
|
|
return list;
|
|
} else {
|
|
@@ -604,6 +_,7 @@
|
|
list.add("");
|
|
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
|
|
list.add(String.valueOf(BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType())));
|
|
+ entity.getType().builtInRegistryHolder().tags().forEach(t -> list.add("#" + t.location()));
|
|
}
|
|
|
|
return list;
|