Fix #673, remove DebugText event, mods should register directly to DebugScreenEntries.register

This commit is contained in:
shedaniel
2025-10-26 03:54:15 +08:00
parent 039d516849
commit 679a665be3
9 changed files with 9 additions and 75 deletions

View File

@@ -8,6 +8,7 @@ on:
- '**/src/**'
branches:
- "1.21.9"
- "1.21.10"
types: [ opened, synchronize, reopened ]
jobs:
validate-gradle:

View File

@@ -9,6 +9,7 @@ on:
- '.github/**'
branches:
- "1.21.9"
- "1.21.10"
workflow_dispatch:
inputs:
norelease:

View File

@@ -29,18 +29,11 @@ import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import java.util.List;
public interface ClientGuiEvent {
/**
* @see RenderHud#renderHud(GuiGraphics, float)
* @see RenderHud#renderHud(GuiGraphics, DeltaTracker)
*/
Event<RenderHud> RENDER_HUD = EventFactory.createLoop();
/**
* @see DebugText#gatherText(List)
*/
Event<DebugText> DEBUG_TEXT_LEFT = EventFactory.createLoop();
Event<DebugText> DEBUG_TEXT_RIGHT = EventFactory.createLoop();
/**
* @see ScreenInitPre#init(Screen, ScreenAccess)
*/
@@ -81,17 +74,6 @@ public interface ClientGuiEvent {
void renderHud(GuiGraphics graphics, DeltaTracker deltaTracker);
}
interface DebugText {
/**
* Invoked when the debug text is being gathered for rendering.
* There are two different versions of this event, one for the left and one for the right side.
* Equivalent to Forge's {@code RenderGameOverlayEvent.Text}, when {@code Minecraft.getInstance().options.renderDebug} is true.
*
* @param strings The current debug text strings.
*/
void gatherText(List<String> strings);
}
interface ScreenInitPre {
/**
* Invoked when a screen is being initialized and after the previous widgets have been cleared.

View File

@@ -126,6 +126,7 @@ transitive-accessible class net/minecraft/world/item/CreativeModeTab$Output
transitive-accessible class net/minecraft/world/item/CreativeModeTab$TabVisibility
accessible field net/minecraft/client/multiplayer/MultiPlayerGameMode connection Lnet/minecraft/client/multiplayer/ClientPacketListener;
accessible field net/minecraft/client/Minecraft particleResources Lnet/minecraft/client/particle/ParticleResources;
transitive-accessible method net/minecraft/client/gui/components/debug/DebugScreenEntries register (Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/gui/components/debug/DebugScreenEntry;)Lnet/minecraft/resources/ResourceLocation;
##############################
# This section is generated automatically with Gradle task generateAccessWidener!!!

View File

@@ -1,42 +0,0 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021, 2022 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package dev.architectury.mixin.fabric.client;
import dev.architectury.event.events.client.ClientGuiEvent;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.DebugScreenOverlay;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.List;
@Mixin(DebugScreenOverlay.class)
public class MixinDebugScreenOverlay {
@Inject(method = "renderLines", at = @At("RETURN"))
private void getLeftTexts(GuiGraphics guiGraphics, List<String> list, boolean bl, CallbackInfo ci) {
if (bl) {
ClientGuiEvent.DEBUG_TEXT_LEFT.invoker().gatherText(list);
} else {
ClientGuiEvent.DEBUG_TEXT_RIGHT.invoker().gatherText(list);
}
}
}

View File

@@ -10,7 +10,6 @@
"client.MixinChatListener",
"client.MixinClientLevel",
"client.MixinClientPacketListener",
"client.MixinDebugScreenOverlay",
"client.MixinFabricClientCommandSource",
"client.MixinGameRenderer",
"client.MixinGuiGraphics",

View File

@@ -3,8 +3,8 @@ org.gradle.daemon=false
platforms=fabric,neoforge
minecraft_version=1.21.9
supported_version=1.21.9
minecraft_version=1.21.10
supported_version=1.21.10
artifact_type=release
@@ -15,11 +15,11 @@ maven_group=dev.architectury
version_suffix=
fabric_loader_version=0.17.2
fabric_api_version=0.133.14+1.21.9
fabric_api_version=0.136.0+1.21.10
mod_menu_version=15.0.0-beta.1
forge_version=51.0.0
neoforge_version=21.9.2-beta
neoforge_version=21.10.32-beta
# Set to empty if not snapshots
neoforge_pr=

View File

@@ -121,7 +121,7 @@ unifiedPublishing {
displayName = "[NeoForge $rootProject.supported_version] v$project.version"
releaseType = "$rootProject.artifact_type"
changelog = releaseChangelog()
gameVersions = ["1.21.9"]
gameVersions = ["1.21.10"]
gameLoaders = ["neoforge"]
mainPublication renameJarForPublication

View File

@@ -92,14 +92,6 @@ public class EventHandlerImplClient {
ClientGuiEvent.INIT_POST.invoker().init(event.getScreen(), new ScreenAccessImpl(event.getScreen()));
}
@SubscribeEvent(priority = EventPriority.HIGH)
public static void eventRenderGameOverlayEvent(CustomizeGuiOverlayEvent.DebugText event) {
if (Minecraft.getInstance().gui.getDebugOverlay().showDebugScreen()) {
ClientGuiEvent.DEBUG_TEXT_LEFT.invoker().gatherText(event.getLeft());
ClientGuiEvent.DEBUG_TEXT_RIGHT.invoker().gatherText(event.getRight());
}
}
@SubscribeEvent(priority = EventPriority.HIGH)
public static void event(net.neoforged.neoforge.client.event.ClientChatEvent event) {
EventResult process = ClientChatEvent.SEND.invoker().send(event.getMessage(), null);