Merge pull request 'Bring in the UI fixes' (#36) from ui-fixes into master

Reviewed-on: #36
This commit was merged in pull request #36.
This commit is contained in:
2026-09-27 17:16:14 +00:00
3 changed files with 38 additions and 3 deletions
+1 -1
Submodule common updated: caf472da96...ef0ead6bf8
@@ -2,11 +2,17 @@ package org.saturnclient.impl.provider;
import java.awt.image.BufferedImage;
import java.util.UUID;
import java.util.function.Supplier;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.toast.SystemToast;
//? if >=1.21.9 {
import net.minecraft.entity.player.SkinTextures;
//?} else
//import net.minecraft.client.util.SkinTextures;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import org.saturnclient.common.provider.SaturnProvider;
import org.saturnclient.common.ref.asset.IdentifierRef;
@@ -16,6 +22,9 @@ import org.saturnclient.impl.cosmetics.utils.IdentifierUtils;
import org.saturnclient.saturnclient.SaturnClient;
public class SaturnProviderImpl implements SaturnProvider {
/** Looks up the signed-in player's skin; made once, since the skin provider caches it */
private Supplier<Identifier> playerSkin;
@Override
public MinecraftClientRef getClient() {
return (MinecraftClientRef) SaturnClient.client;
@@ -50,6 +59,23 @@ public class SaturnProviderImpl implements SaturnProvider {
/** Shown longer than the vanilla default, since these ask the player to act. */
private static final SystemToast.Type WARNING_TOAST = new SystemToast.Type(15_000L);
@Override
public IdentifierRef getPlayerSkin() {
if (playerSkin == null) {
MinecraftClient client = MinecraftClient.getInstance();
// 1.21.9 moved SkinTextures and renamed the skin provider's lookup.
//? if >=1.21.9 {
Supplier<SkinTextures> textures = client.getSkinProvider().supplySkinTextures(client.getGameProfile(), false);
playerSkin = () -> textures.get().body().texturePath();
//?} else {
/*Supplier<SkinTextures> textures = client.getSkinProvider().getSkinTexturesSupplier(client.getGameProfile());
playerSkin = () -> textures.get().texture();
*///?}
}
return (IdentifierRef) (Object) playerSkin.get();
}
@Override
public String getModVersion() {
return FabricLoader.getInstance().getModContainer(SaturnClient.MOD_ID)
@@ -12,6 +12,7 @@ import org.saturnclient.saturnclient.SaturnClient;
import org.saturnclient.common.provider.Providers;
import org.saturnclient.client.ServiceClient;
import org.saturnclient.emotes.fabric.Emotes;
import org.saturnclient.impl.ui.SaturnScreenFabric;
import org.saturnclient.ui.screens.EmoteWheel;
import org.saturnclient.ui.screens.ShiftMenu;
@@ -51,12 +52,20 @@ public class KeyInputHandler {
Providers.saturn.getClient().setScreen(new ShiftMenu());
}
if (Config.openEmoteWheel.wasKeyPressed() && client.currentScreen == null
// The emote wheel key opens the wheel, and closes it again while it's open. Closing it
// from the screen's own key handling would reopen it on the next tick, since the key is
// still down and no screen is open by then.
if (Config.openEmoteWheel.wasKeyPressed()
//? if >=1.21.9 {
&& !InputUtil.isKeyPressed(client.getWindow(), GLFW.GLFW_KEY_F3)) {
//?} else
//&& !InputUtil.isKeyPressed(client.getWindow().getHandle(), GLFW.GLFW_KEY_F3)) {
if (client.currentScreen == null) {
Providers.saturn.getClient().setScreen(new EmoteWheel());
} else if (client.currentScreen instanceof SaturnScreenFabric saturnScreen
&& saturnScreen.screen instanceof EmoteWheel) {
saturnScreen.close();
}
}
// Sneaking cancels your own emote, for everyone.