Rollback overlay chanegs

This commit is contained in:
2026-04-18 12:41:50 +03:00
parent ee9ef9abd8
commit fd91170970
4 changed files with 26 additions and 46 deletions

View File

@@ -5,7 +5,6 @@ import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.network.chat.Component;
import net.respawnbackoff.CooldownSyncPayload;
@@ -28,28 +27,8 @@ public class RespawnBackoffClient implements ClientModInitializer {
}
/**
* Invoked from a mixin at the end of {@link net.minecraft.client.renderer.GameRenderer#render} so chat,
* Jade, and other late overlays sit underneath the blackout. Skipped while any screen is open.
*/
public static void renderPenaltyOverlayEndOfFrame() {
if (!overlayActive) {
return;
}
Minecraft client = Minecraft.getInstance();
if (client.player == null || client.screen != null) {
return;
}
MultiBufferSource.BufferSource bufferSource = client.renderBuffers().bufferSource();
GuiGraphics graphics = new GuiGraphics(client, bufferSource);
try {
renderPenaltyOverlay(graphics);
} finally {
graphics.flush();
}
}
private static void renderPenaltyOverlay(GuiGraphics graphics) {
/** 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) {
if (!overlayActive) {
return;
}

View File

@@ -1,22 +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.DeltaTracker;
import net.minecraft.client.renderer.GameRenderer;
import net.respawnbackoff.client.RespawnBackoffClient;
/**
* Draw the penalty blackout after the full frame (vanilla HUD, chat, and typical mod overlays like
* Jade). Skip while a {@link net.minecraft.client.gui.screens.Screen} is open so pause menus stay unobstructed.
*/
@Mixin(GameRenderer.class)
public class GameRendererMixin {
@Inject(method = "render", at = @At("RETURN"))
private void respawn_backoff$penaltyOverlayLastInFrame(DeltaTracker deltaTracker, boolean tick, CallbackInfo ci) {
RespawnBackoffClient.renderPenaltyOverlayEndOfFrame();
}
}

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

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