Compare commits

...
2 Commits
Author SHA1 Message Date
selimaj-dev 15fa973553 Merge pull request 'Load emotes with the Saturn emote library' (#5) from emote-library into master
Reviewed-on: #5
2026-09-26 19:17:20 +00:00
selimaj-devandclaude b2cf0cbc38 Load emotes with the Saturn emote library
- Emotes loads assets/saturnclient/player_animations/*.json with
  emotes-core into Saturn's own EmoteRegistry (not the library's shared
  one, so other mods can't replace them), and lists the ones that loaded
  for the wheel.
- The emote wheel now also sends the emote to the server, so other
  players see it. It only played locally before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-26 21:16:20 +02:00
3 changed files with 36 additions and 6 deletions
+1
View File
@@ -8,4 +8,5 @@ java {
dependencies {
implementation "dev.selimaj:session-java:0.2.0"
implementation "org.saturnclient:emotes-core:${emotes_version}"
}
@@ -1,17 +1,45 @@
package org.saturnclient.cosmetics;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.saturnclient.common.provider.Providers;
import org.saturnclient.emotes.core.Emote;
import org.saturnclient.emotes.core.EmoteRegistry;
/**
* Saturn's emotes, loaded from {@code assets/saturnclient/player_animations/<id>.json} (Emotecraft
* format). They live in Saturn's own registry rather than the emote library's shared one, so another
* mod using the library can't replace them.
*/
public class Emotes {
private static final List<String> IDS = List.of("tpose", "back_flip", "facepalm", "cry", "giga_chad",
"front_flip");
private static final EmoteRegistry REGISTRY = new EmoteRegistry();
/** The emotes that loaded, in wheel order. */
public static List<String> availableEmotes = new ArrayList<>();
public static void initialize() {
availableEmotes.add("tpose");
availableEmotes.add("back_flip");
availableEmotes.add("facepalm");
availableEmotes.add("cry");
availableEmotes.add("giga_chad");
availableEmotes.add("front_flip");
for (String id : IDS) {
String path = "/assets/saturnclient/player_animations/" + id + ".json";
try (InputStream in = Emotes.class.getResourceAsStream(path)) {
if (in == null) {
Providers.saturn.logError("Missing emote " + path);
continue;
}
REGISTRY.loadEmotecraft(id, in);
availableEmotes.add(id);
} catch (Exception e) {
Providers.saturn.logError("Failed to load emote " + id, e);
}
}
}
public static Optional<Emote> get(String id) {
return REGISTRY.get(id);
}
}
@@ -83,6 +83,7 @@ public class EmoteWheel extends SaturnScreen {
emoteStagger.draw(
new TextureButton(Textures.getEmotePreview(emote), () -> {
Providers.saturn.playEmote(ServiceClient.uuid, emote);
ServiceClient.emote(emote);
provider.close();
})
.dimensions(70, 70)