Fix GUI backgrounds

This commit is contained in:
2026-04-11 02:19:50 +03:00
parent 3660c4dac7
commit cbbfc8eca3
4 changed files with 25 additions and 22 deletions

View File

@@ -27,7 +27,7 @@ public class RespawnBackoffClient implements ClientModInitializer {
} }
/** Invoked from a mixin after the toast manager draws (post-chat HUD), so opaque blackout sits above vanilla UI. */ /** Invoked from a mixin at the end of {@link net.minecraft.client.gui.Gui#render} (HUD + chat). Pause UI and toasts draw later. */
public static void renderPenaltyOverlay(GuiGraphics graphics) { public static void renderPenaltyOverlay(GuiGraphics graphics) {
if (!overlayActive) { if (!overlayActive) {
return; return;

View File

@@ -0,0 +1,23 @@
package net.respawnbackoff.mixin;
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 net.minecraft.client.DeltaTracker;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiGraphics;
import net.respawnbackoff.client.RespawnBackoffClient;
/**
* Draw the penalty screen after the in-game HUD (including chat). Vanilla then draws the pause
* menu and toasts on top, so we no longer paint over {@link net.minecraft.client.gui.screens.PauseScreen} widgets.
*/
@Mixin(Gui.class)
public class GuiMixin {
@Inject(method = "render", at = @At("RETURN"))
private void respawn_backoff$afterInGameHud(GuiGraphics graphics, DeltaTracker deltaTracker, CallbackInfo ci) {
RespawnBackoffClient.renderPenaltyOverlay(graphics);
}
}

View File

@@ -1,20 +0,0 @@
package net.respawnbackoff.mixin;
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 net.minecraft.client.gui.GuiGraphics;
import net.respawnbackoff.client.RespawnBackoffClient;
/**
* Intermediary name for {@code net.minecraft.client.toast.ToastManager} (Mojang mappings hide this on compile classpath).
*/
@Mixin(targets = "net.minecraft.class_374")
public class ToastManagerMixin {
@Inject(method = "method_1996", at = @At("RETURN"))
private void respawn_backoff$afterToasts(GuiGraphics graphics, CallbackInfo ci) {
RespawnBackoffClient.renderPenaltyOverlay(graphics);
}
}

View File

@@ -6,7 +6,7 @@
"ServerPlayerGameModeMixin" "ServerPlayerGameModeMixin"
], ],
"client": [ "client": [
"ToastManagerMixin" "GuiMixin"
], ],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1