mirror of
https://github.com/architectury/architectury-api.git
synced 2026-04-02 05:27:42 -05:00
Rewrite the GuiEvent.SET_SCREEN mixin to fix #35
This commit is contained in:
@@ -27,6 +27,7 @@ import me.shedaniel.architectury.platform.Platform;
|
||||
import me.shedaniel.architectury.utils.Env;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.gui.screens.ChatScreen;
|
||||
import net.minecraft.core.Position;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
@@ -211,10 +212,6 @@ public class DebugEvents {
|
||||
ClientPlayerEvent.CLIENT_PLAYER_RESPAWN.register((oldPlayer, newPlayer) -> {
|
||||
SINK.accept(newPlayer.getScoreboardName() + " respawned (client)");
|
||||
});
|
||||
GuiEvent.SET_SCREEN.register((screen -> {
|
||||
SINK.accept("Screen has been changed to " + toSimpleName(screen));
|
||||
return InteractionResultHolder.pass(screen);
|
||||
}));
|
||||
GuiEvent.INIT_PRE.register((screen, widgets, children) -> {
|
||||
SINK.accept(toSimpleName(screen) + " initializes");
|
||||
return InteractionResult.PASS;
|
||||
@@ -271,6 +268,14 @@ public class DebugEvents {
|
||||
SINK.accept("Raw Key pressed: " + InputConstants.getKey(keyCode, scanCode).getDisplayName().getString());
|
||||
return InteractionResult.PASS;
|
||||
});
|
||||
GuiEvent.SET_SCREEN.register(screen -> {
|
||||
if (screen instanceof ChatScreen) {
|
||||
return InteractionResultHolder.fail(screen);
|
||||
}
|
||||
|
||||
SINK.accept("Screen has been changed to " + toSimpleName(screen));
|
||||
return InteractionResultHolder.pass(screen);
|
||||
});
|
||||
}
|
||||
|
||||
private static String toSimpleName(Object o) {
|
||||
|
||||
Reference in New Issue
Block a user