Compare commits
2
Commits
5df42e2b7c
...
15fa973553
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15fa973553 | ||
|
|
b2cf0cbc38 |
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user