almost fully working emotes

This commit is contained in:
2025-06-14 13:52:29 -05:00
parent 76c20d8733
commit 7e39532d1d
8 changed files with 23 additions and 9 deletions
@@ -7,6 +7,7 @@ import net.minecraft.client.MinecraftClient;
import org.saturnclient.modules.ModManager; import org.saturnclient.modules.ModManager;
import org.saturnclient.saturnclient.auth.Auth; import org.saturnclient.saturnclient.auth.Auth;
import org.saturnclient.saturnclient.config.ConfigManager; import org.saturnclient.saturnclient.config.ConfigManager;
import org.saturnclient.saturnclient.cosmetics.Emotes;
import org.saturnclient.saturnclient.cosmetics.Hats; import org.saturnclient.saturnclient.cosmetics.Hats;
import org.saturnclient.saturnclient.cosmetics.cloaks.Cloaks; import org.saturnclient.saturnclient.cosmetics.cloaks.Cloaks;
import org.saturnclient.saturnclient.event.KeyInputHandler; import org.saturnclient.saturnclient.event.KeyInputHandler;
@@ -38,6 +39,7 @@ public class SaturnClient implements ModInitializer {
}); });
KeyInputHandler.register(); KeyInputHandler.register();
Emotes.initialize();
if (Auth.authenticate()) { if (Auth.authenticate()) {
Cloaks.initialize(); Cloaks.initialize();
Hats.initialize(); Hats.initialize();
@@ -5,4 +5,8 @@ import java.util.List;
public class Emotes { public class Emotes {
public static List<String> availableEmotes = new ArrayList<>(); public static List<String> availableEmotes = new ArrayList<>();
public static void initialize() {
availableEmotes.add("backflip");
}
} }
@@ -3,6 +3,7 @@ package org.saturnclient.ui2;
import java.util.List; import java.util.List;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import org.saturnclient.saturnclient.SaturnClient;
public class Utils { public class Utils {
public static boolean isHovering(int mouseX, int mouseY, int elementWidth, int elementHeight, float elementScale) { public static boolean isHovering(int mouseX, int mouseY, int elementWidth, int elementHeight, float elementScale) {
@@ -48,6 +49,7 @@ public class Utils {
} }
public static <T> T getOrNull(List<T> list, int index) { public static <T> T getOrNull(List<T> list, int index) {
SaturnClient.LOGGER.info("Accessing index {} in list of size {}", index, list.size());
return (index >= 0 && index < list.size()) ? list.get(index) : null; return (index >= 0 && index < list.size()) ? list.get(index) : null;
} }
} }
@@ -15,7 +15,8 @@ public class Textures {
public static final Identifier RESET = Identifier.of("saturnclient", "textures/gui/components/reset.png"); public static final Identifier RESET = Identifier.of("saturnclient", "textures/gui/components/reset.png");
public static final Identifier TOGGLE_INDICATOR = Identifier.of("saturnclient", public static final Identifier TOGGLE_INDICATOR = Identifier.of("saturnclient",
"textures/gui/components/toggle_indicator.png"); "textures/gui/components/toggle_indicator.png");
public static final Identifier TOGGLE_BG = Identifier.of("saturnclient", "textures/gui/components/toggle_bg.png"); public static final Identifier LEFT = Identifier.of("saturnclient", "textures/gui/components/left.png");
public static final Identifier RIGHT = Identifier.of("saturnclient", "textures/gui/components/right.png");
public static final Identifier LOGO = Identifier.of("saturnclient", "textures/logo/logo.png"); public static final Identifier LOGO = Identifier.of("saturnclient", "textures/logo/logo.png");
public static final Identifier REALISTIC_LOGO = Identifier.of("saturnclient", "textures/logo/realistic.png"); public static final Identifier REALISTIC_LOGO = Identifier.of("saturnclient", "textures/logo/realistic.png");
@@ -28,24 +28,24 @@ public class EmoteWheel extends SaturnScreen {
int row = 0; int row = 0;
int col = 0; int col = 0;
draw(new ImageTexture(Textures.LOGO_TEXT).dimensions(98, 10).centerOffset(width, height, 0, -150).animation(new Fade(700))); draw(new ImageTexture(Textures.LOGO_TEXT).dimensions(98, 10).centerOffset(width, height, 0, -105).animation(new Fade(700)));
draw(new ImageTexture(SaturnClientConfig.getLogo()).dimensions(98, 98).centerOffset(width, height, 0, -194).animation(new SlideY(700, -20))); draw(new ImageTexture(SaturnClientConfig.getLogo()).dimensions(98, 98).centerOffset(width, height, 0, -149).animation(new SlideY(700, -20)));
draw(new TextureButton(Textures.MODS_TAB, () -> { draw(new TextureButton(Textures.LEFT, () -> {
if (page > 1) { if (page > 1) {
page--; page--;
elements.clear(); elements.clear();
ui(); ui();
} }
}).dimensions(30, 30).centerOffset(width, height, -25, 0).animation(new Fade(700))); }).dimensions(30, 30).centerOffset(width, height, -20, 45).animation(new Fade(700)));
draw(new TextureButton(Textures.MODS_TAB, () -> { draw(new TextureButton(Textures.RIGHT, () -> {
if (page > 1) { if ((8 * page) < Emotes.availableEmotes.size()) {
page++; page++;
elements.clear(); elements.clear();
ui(); ui();
} }
}).dimensions(30, 30).centerOffset(width, height, 10, 0).animation(new Fade(700))); }).dimensions(30, 30).centerOffset(width, height, 20, 45).animation(new Fade(700)));
while (row < 3) { while (row < 3) {
int idx = (row * 3 + col) * page; int idx = (row * 3 + col) * page;
@@ -63,7 +63,7 @@ public class EmoteWheel extends SaturnScreen {
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player); AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player);
animationStack.addAnimLayer(1000, PlayerAnimationRegistry.getAnimation(Identifier.of("saturnclient", emote)).playAnimation()); animationStack.addAnimLayer(1000, PlayerAnimationRegistry.getAnimation(Identifier.of("saturnclient", emote)).playAnimation());
close(); close();
}).dimensions(70, 70).centerOffset(width, height, -90 + (col * 80), -80 + (row * 80)).animation(new Fade(700))); }).dimensions(70, 70).centerOffset(width, height, -80 + (col * 80), -35 + (row * 80)).animation(new Fade(700)));
if (col < 2) { if (col < 2) {
col++; col++;
@@ -73,4 +73,9 @@ public class EmoteWheel extends SaturnScreen {
} }
} }
} }
@Override
public boolean shouldPause() {
return false;
}
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B