Rollback overlay chanegs
This commit is contained in:
@@ -5,7 +5,6 @@ import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
|
|||||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.respawnbackoff.CooldownSyncPayload;
|
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.gui.Gui#render} (HUD + chat). Pause UI and toasts draw later. */
|
||||||
* Invoked from a mixin at the end of {@link net.minecraft.client.renderer.GameRenderer#render} so chat,
|
public static void renderPenaltyOverlay(GuiGraphics graphics) {
|
||||||
* 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) {
|
|
||||||
if (!overlayActive) {
|
if (!overlayActive) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
23
src/client/java/net/respawnbackoff/mixin/GuiMixin.java
Normal file
23
src/client/java/net/respawnbackoff/mixin/GuiMixin.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
"ServerPlayerGameModeMixin"
|
"ServerPlayerGameModeMixin"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"GameRendererMixin"
|
"GuiMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|||||||
Reference in New Issue
Block a user