Working emote streaming
This commit is contained in:
+1
-1
@@ -111,7 +111,7 @@ dependencies {
|
|||||||
// ─────────────────────────────────────────────
|
// ─────────────────────────────────────────────
|
||||||
|
|
||||||
// Session Java (auth/session handling)
|
// Session Java (auth/session handling)
|
||||||
implementation "com.github.selimaj-dev:session-java:0.1.5"
|
implementation "com.github.selimaj-dev:session-java:0.1.6"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package org.saturnclient.saturnclient.client;
|
package org.saturnclient.saturnclient.client;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.saturnclient.saturnclient.SaturnClient;
|
import org.saturnclient.saturnclient.SaturnClient;
|
||||||
@@ -13,7 +12,6 @@ import dev.kosmx.playerAnim.api.layered.AnimationStack;
|
|||||||
import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess;
|
import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess;
|
||||||
import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationRegistry;
|
import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationRegistry;
|
||||||
import dev.selimaj.session.Session;
|
import dev.selimaj.session.Session;
|
||||||
import dev.selimaj.session.types.SessionResult;
|
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
||||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
@@ -138,10 +136,8 @@ public class ServiceClient {
|
|||||||
|
|
||||||
public static void emote(String emote) {
|
public static void emote(String emote) {
|
||||||
try {
|
try {
|
||||||
String[] targets = { uuid.toString().replaceAll("-", "") };
|
|
||||||
|
|
||||||
session.request(ServiceMethods.Emote,
|
session.request(ServiceMethods.Emote,
|
||||||
new ServiceMethods.Types.EmoteRequest(emote, targets))
|
new ServiceMethods.Types.EmoteRequest(emote, SaturnPlayer.getExternalUUIDAsString()))
|
||||||
.whenComplete((msg, throwable) -> {
|
.whenComplete((msg, throwable) -> {
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
@@ -153,8 +149,7 @@ public class ServiceClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void eventHandlers() {
|
public static void eventHandlers() {
|
||||||
session.onNotification(ServiceMethods.EmoteEvent, (l, data) -> {
|
session.onNotification(ServiceMethods.EmoteEvent, (data) -> {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
|
||||||
for (AbstractClientPlayerEntity player : SaturnClient.client.world.getPlayers()) {
|
for (AbstractClientPlayerEntity player : SaturnClient.client.world.getPlayers()) {
|
||||||
if (player.getUuidAsString().replace("-", "").equals(data.from())) {
|
if (player.getUuidAsString().replace("-", "").equals(data.from())) {
|
||||||
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(player);
|
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(player);
|
||||||
@@ -171,9 +166,6 @@ public class ServiceClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SessionResult.ok("");
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,4 +55,10 @@ public class SaturnPlayer {
|
|||||||
|
|
||||||
PLAYERS.put(uuid, null);
|
PLAYERS.put(uuid, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String[] getExternalUUIDAsString() {
|
||||||
|
return PLAYERS.keySet().stream().filter(id -> !id.equals(ServiceClient.uuid)).map(UUID::toString)
|
||||||
|
.toArray(String[]::new);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,13 +63,13 @@ public class EmoteWheel extends SaturnScreen {
|
|||||||
if (emote == null) {
|
if (emote == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player);
|
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player);
|
||||||
// if (animationStack.isActive() && animationStack.getPriority() == 1000) {
|
if (animationStack.isActive() && animationStack.getPriority() == 1000) {
|
||||||
// animationStack.removeLayer(1000);
|
animationStack.removeLayer(1000);
|
||||||
// }
|
}
|
||||||
// animationStack.addAnimLayer(1000,
|
animationStack.addAnimLayer(1000,
|
||||||
// PlayerAnimationRegistry.getAnimation(Identifier.of("saturnclient",
|
PlayerAnimationRegistry.getAnimation(Identifier.of("saturnclient",
|
||||||
// emote)).playAnimation());
|
emote)).playAnimation());
|
||||||
ServiceClient.emote(emote);
|
ServiceClient.emote(emote);
|
||||||
close();
|
close();
|
||||||
}).dimensions(70, 70).centerOffset(width, height, -80 + (col * 80), -35 + (row * 80))
|
}).dimensions(70, 70).centerOffset(width, height, -80 + (col * 80), -35 + (row * 80))
|
||||||
|
|||||||
Reference in New Issue
Block a user