emotes (real)

This commit is contained in:
2025-06-14 06:14:25 +02:00
parent a1c68609d9
commit 76c20d8733
6 changed files with 100 additions and 7 deletions
@@ -0,0 +1,8 @@
package org.saturnclient.saturnclient.cosmetics;
import java.util.ArrayList;
import java.util.List;
public class Emotes {
public static List<String> availableEmotes = new ArrayList<>();
}
@@ -4,14 +4,13 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.util.Identifier;
import org.saturnclient.saturnclient.SaturnClient;
import org.saturnclient.ui2.screens.EmoteWheel;
import org.saturnclient.ui2.screens.ShiftMenu;
import dev.kosmx.playerAnim.api.layered.AnimationStack;
import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess;
import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationRegistry;
import org.lwjgl.glfw.GLFW;
@@ -48,15 +47,14 @@ public class KeyInputHandler {
client.setScreen(new ShiftMenu());
}
if (freelookKeyBinding.wasPressed()) {
client.setScreen(new EmoteWheel());
}
if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking()) {
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player);
animationStack.removeLayer(1000);
}
if (freelookKeyBinding.wasPressed()) {
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player);
animationStack.addAnimLayer(1000, PlayerAnimationRegistry.getAnimation(Identifier.of("saturnclient", "backflip")).playAnimation());
}
});
}
}
@@ -1,5 +1,7 @@
package org.saturnclient.ui2;
import java.util.List;
import org.lwjgl.glfw.GLFW;
public class Utils {
@@ -44,4 +46,8 @@ public class Utils {
default -> '\0';
};
}
public static <T> T getOrNull(List<T> list, int index) {
return (index >= 0 && index < list.size()) ? list.get(index) : null;
}
}
@@ -39,7 +39,12 @@ public class Textures {
return Identifier.of("saturnclient", "textures/gui/hat/" + (hat.isEmpty() ? "none" : hat) + ".png");
}
public static Identifier getEmotePreview(String emote) {
return Identifier.of("saturnclient", "textures/gui/emote/" + (emote == null ? "none" : emote) + ".png");
}
public static Identifier getModIcon(String modId) {
return Identifier.of("saturnclient", "textures/gui/mod/" + modId + ".png");
}
}
@@ -0,0 +1,76 @@
package org.saturnclient.ui2.screens;
import org.saturnclient.saturnclient.SaturnClient;
import org.saturnclient.saturnclient.SaturnClientConfig;
import org.saturnclient.saturnclient.cosmetics.Emotes;
import org.saturnclient.ui2.SaturnScreen;
import org.saturnclient.ui2.Utils;
import org.saturnclient.ui2.anim.Fade;
import org.saturnclient.ui2.anim.SlideY;
import org.saturnclient.ui2.elements.ImageTexture;
import org.saturnclient.ui2.elements.TextureButton;
import org.saturnclient.ui2.resources.Textures;
import dev.kosmx.playerAnim.api.layered.AnimationStack;
import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess;
import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationRegistry;
import net.minecraft.util.Identifier;
public class EmoteWheel extends SaturnScreen {
int page = 1;
public EmoteWheel() {
super("Emote Wheel");
}
@Override
public void ui() {
int row = 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(SaturnClientConfig.getLogo()).dimensions(98, 98).centerOffset(width, height, 0, -194).animation(new SlideY(700, -20)));
draw(new TextureButton(Textures.MODS_TAB, () -> {
if (page > 1) {
page--;
elements.clear();
ui();
}
}).dimensions(30, 30).centerOffset(width, height, -25, 0).animation(new Fade(700)));
draw(new TextureButton(Textures.MODS_TAB, () -> {
if (page > 1) {
page++;
elements.clear();
ui();
}
}).dimensions(30, 30).centerOffset(width, height, 10, 0).animation(new Fade(700)));
while (row < 3) {
int idx = (row * 3 + col) * page;
if (row == 1 && col == 1) {
col++;
}
String emote = Utils.getOrNull(Emotes.availableEmotes, idx);
draw(new TextureButton(Textures.getEmotePreview(emote), () -> {
if (emote == null) {
return;
}
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player);
animationStack.addAnimLayer(1000, PlayerAnimationRegistry.getAnimation(Identifier.of("saturnclient", emote)).playAnimation());
close();
}).dimensions(70, 70).centerOffset(width, height, -90 + (col * 80), -80 + (row * 80)).animation(new Fade(700)));
if (col < 2) {
col++;
} else {
col = 0;
row++;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB