diff --git a/build.gradle b/build.gradle index e2dadf4..1589821 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,7 @@ subprojects { repositories { maven { url "https://maven.fabricmc.net/" } maven { url "https://git.selimaj.dev/api/packages/selimaj-dev/maven" } + maven { url "https://git.selimaj.dev/api/packages/saturnclientmc/maven" } mavenCentral() } @@ -19,12 +20,12 @@ subprojects { configure(subprojects.findAll { it.name != "common" }) { dependencies { implementation project(":common") + } - sourceSets { - main { - resources { - srcDir project(":common").file("src/main/resources") - } + sourceSets { + main { + resources { + srcDir project(":common").file("src/main/resources") } } } diff --git a/common b/common index 5df42e2..15fa973 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 5df42e2b7c05d62925bcc88985c6534046649dbf +Subproject commit 15fa973553f0398cb1be0450dd6df709b0e1218c diff --git a/gradle.properties b/gradle.properties index 6a66e33..a898428 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,3 +7,6 @@ org.gradle.caching=true org.gradle.configuration-cache=false mod_version=0.1.1-beta + +# Saturn's emote library (git.selimaj.dev/saturnclientmc/emotes) +emotes_version=0.1.0 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 61285a6..5097068 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 19a6bde..299848b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index adff685..249efbb 100755 --- a/gradlew +++ b/gradlew @@ -20,7 +20,7 @@ ############################################################################## # -# Gradle start up script for POSIX generated by Gradle. +# gradlew start up script for POSIX generated by Gradle. # # Important for running: # @@ -29,7 +29,7 @@ # bash, then to run this script, type that shell name before the whole # command line, like: # -# ksh Gradle +# ksh gradlew # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: @@ -57,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. diff --git a/gradlew.bat b/gradlew.bat index e509b2d..03754c4 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -19,12 +19,39 @@ @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions + +@rem Catch executions from older scripts and ensure they exit cleanly. +@rem This can be removed once we can be reasonably confident that few people +@rem will be migrating directly to this new wrapper. +goto afterSafetyNet +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +goto exitWithErrorLevel +:afterSafetyNet set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -45,13 +72,14 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -59,35 +87,26 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :execute @rem Setup the command line -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem This label must not be changed. We rely on old scripts being able to jump to this point. +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/versions/1.21.10/build.gradle b/versions/1.21.10/build.gradle index 3c1c06f..b40015c 100644 --- a/versions/1.21.10/build.gradle +++ b/versions/1.21.10/build.gradle @@ -11,7 +11,6 @@ base { } repositories { - // maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' } maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' } } @@ -24,10 +23,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" - // Player Animation Library - // include modImplementation( - // "dev.kosmx.player-anim:player-animation-lib-fabric:${project.player_anim}" - // ) + // Saturn's emote library (limb bending, Emotecraft emotes) + include modImplementation("org.saturnclient:emotes-fabric:${project.emotes_version}+${project.minecraft_version}") implementation project(":common") @@ -37,11 +34,6 @@ dependencies { include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-annotations:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-core:2.17.0") - - // Optional: BendyLib - // include modRuntimeOnly( - // "io.github.kosmx.bendy-lib:bendy-lib-fabric:${project.bendylib_version}" - // ) } /* diff --git a/versions/1.21.10/gradle.properties b/versions/1.21.10/gradle.properties index 7a682b1..65a4a08 100644 --- a/versions/1.21.10/gradle.properties +++ b/versions/1.21.10/gradle.properties @@ -10,12 +10,10 @@ org.gradle.configuration-cache=false minecraft_version=1.21.10 yarn_mappings=1.21.10+build.3 loader_version=0.19.0 -loom_version=1.15-SNAPSHOT +loom_version=1.17.21 fabric_api_version=0.138.4+1.21.10 # Mod Properties maven_group=org.saturnclient archives_base_name=saturn-client - -# player_anim = 2.0.2+1.21.5 diff --git a/versions/1.21.10/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java b/versions/1.21.10/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java index 20a50be..87dd445 100644 --- a/versions/1.21.10/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java +++ b/versions/1.21.10/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java @@ -11,6 +11,7 @@ import net.minecraft.text.Text; import org.saturnclient.common.provider.SaturnProvider; import org.saturnclient.common.ref.asset.IdentifierRef; import org.saturnclient.common.ref.game.MinecraftClientRef; +import org.saturnclient.cosmetics.Emotes; import org.saturnclient.impl.cosmetics.utils.IdentifierUtils; import org.saturnclient.saturnclient.SaturnClient; @@ -22,31 +23,13 @@ public class SaturnProviderImpl implements SaturnProvider { @Override public void playEmote(UUID fromPlayerUuid, String emoteIdOrNull) { - // if (SaturnClient.client == null || SaturnClient.client.world == null) { - // return; - // } - - // for (AbstractClientPlayerEntity player : SaturnClient.client.world.getPlayers()) { - // if (!player.getUuid().equals(fromPlayerUuid)) { - // continue; - // } - - // AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(player); - - // if (emoteIdOrNull != null && !emoteIdOrNull.isEmpty()) { - // if (animationStack.isActive() && animationStack.getPriority() == 1000) { - // animationStack.removeLayer(1000); - // } - // animationStack.addAnimLayer(1000, - // PlayerAnimationRegistry - // .getAnimation(Identifier.of("saturnclient", emoteIdOrNull)) - // .playAnimation()); - // } else { - // animationStack.removeLayer(1000); - // } - - // break; - // } + if (fromPlayerUuid == null) { + return; + } + // An empty or unknown ID stops whatever the player is playing. + Emotes.get(emoteIdOrNull == null ? "" : emoteIdOrNull).ifPresentOrElse( + emote -> org.saturnclient.emotes.fabric.Emotes.play(fromPlayerUuid, emote.animation()), + () -> org.saturnclient.emotes.fabric.Emotes.stop(fromPlayerUuid)); } @Override diff --git a/versions/1.21.10/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java b/versions/1.21.10/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java index 2ca0362..f8ba756 100644 --- a/versions/1.21.10/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java +++ b/versions/1.21.10/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java @@ -9,12 +9,11 @@ import net.minecraft.util.Identifier; import org.saturnclient.config.Config; import org.saturnclient.saturnclient.SaturnClient; import org.saturnclient.common.provider.Providers; +import org.saturnclient.client.ServiceClient; +import org.saturnclient.emotes.fabric.Emotes; import org.saturnclient.ui.screens.EmoteWheel; import org.saturnclient.ui.screens.ShiftMenu; -// import dev.kosmx.playerAnim.api.layered.AnimationStack; -// import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess; - import org.lwjgl.glfw.GLFW; /** @@ -45,13 +44,11 @@ public class KeyInputHandler { Providers.saturn.getClient().setScreen(new EmoteWheel()); } - if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking()) { - // AnimationStack animationStack = - // PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player); - // if (animationStack.isActive() && animationStack.getPriority() == 1000) { - // animationStack.removeLayer(1000); - // ServiceClient.emote(""); - // } + // Sneaking cancels your own emote, for everyone. + if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking() + && Emotes.playing(SaturnClient.client.player.getUuid()).isPresent()) { + Emotes.stop(SaturnClient.client.player.getUuid()); + ServiceClient.emote(""); } }); } diff --git a/versions/1.21.11/build.gradle b/versions/1.21.11/build.gradle index 3c1c06f..b40015c 100644 --- a/versions/1.21.11/build.gradle +++ b/versions/1.21.11/build.gradle @@ -11,7 +11,6 @@ base { } repositories { - // maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' } maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' } } @@ -24,10 +23,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" - // Player Animation Library - // include modImplementation( - // "dev.kosmx.player-anim:player-animation-lib-fabric:${project.player_anim}" - // ) + // Saturn's emote library (limb bending, Emotecraft emotes) + include modImplementation("org.saturnclient:emotes-fabric:${project.emotes_version}+${project.minecraft_version}") implementation project(":common") @@ -37,11 +34,6 @@ dependencies { include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-annotations:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-core:2.17.0") - - // Optional: BendyLib - // include modRuntimeOnly( - // "io.github.kosmx.bendy-lib:bendy-lib-fabric:${project.bendylib_version}" - // ) } /* diff --git a/versions/1.21.11/gradle.properties b/versions/1.21.11/gradle.properties index ac1f17c..ef10f0c 100644 --- a/versions/1.21.11/gradle.properties +++ b/versions/1.21.11/gradle.properties @@ -10,12 +10,10 @@ org.gradle.configuration-cache=false minecraft_version=1.21.11 yarn_mappings=1.21.11+build.4 loader_version=0.19.0 -loom_version=1.15-SNAPSHOT +loom_version=1.17.21 fabric_api_version=0.141.3+1.21.11 # Mod Properties maven_group=org.saturnclient archives_base_name=saturn-client - -# player_anim = 2.0.2+1.21.5 diff --git a/versions/1.21.11/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java b/versions/1.21.11/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java index 20a50be..87dd445 100644 --- a/versions/1.21.11/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java +++ b/versions/1.21.11/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java @@ -11,6 +11,7 @@ import net.minecraft.text.Text; import org.saturnclient.common.provider.SaturnProvider; import org.saturnclient.common.ref.asset.IdentifierRef; import org.saturnclient.common.ref.game.MinecraftClientRef; +import org.saturnclient.cosmetics.Emotes; import org.saturnclient.impl.cosmetics.utils.IdentifierUtils; import org.saturnclient.saturnclient.SaturnClient; @@ -22,31 +23,13 @@ public class SaturnProviderImpl implements SaturnProvider { @Override public void playEmote(UUID fromPlayerUuid, String emoteIdOrNull) { - // if (SaturnClient.client == null || SaturnClient.client.world == null) { - // return; - // } - - // for (AbstractClientPlayerEntity player : SaturnClient.client.world.getPlayers()) { - // if (!player.getUuid().equals(fromPlayerUuid)) { - // continue; - // } - - // AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(player); - - // if (emoteIdOrNull != null && !emoteIdOrNull.isEmpty()) { - // if (animationStack.isActive() && animationStack.getPriority() == 1000) { - // animationStack.removeLayer(1000); - // } - // animationStack.addAnimLayer(1000, - // PlayerAnimationRegistry - // .getAnimation(Identifier.of("saturnclient", emoteIdOrNull)) - // .playAnimation()); - // } else { - // animationStack.removeLayer(1000); - // } - - // break; - // } + if (fromPlayerUuid == null) { + return; + } + // An empty or unknown ID stops whatever the player is playing. + Emotes.get(emoteIdOrNull == null ? "" : emoteIdOrNull).ifPresentOrElse( + emote -> org.saturnclient.emotes.fabric.Emotes.play(fromPlayerUuid, emote.animation()), + () -> org.saturnclient.emotes.fabric.Emotes.stop(fromPlayerUuid)); } @Override diff --git a/versions/1.21.11/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java b/versions/1.21.11/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java index 2ca0362..f8ba756 100644 --- a/versions/1.21.11/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java +++ b/versions/1.21.11/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java @@ -9,12 +9,11 @@ import net.minecraft.util.Identifier; import org.saturnclient.config.Config; import org.saturnclient.saturnclient.SaturnClient; import org.saturnclient.common.provider.Providers; +import org.saturnclient.client.ServiceClient; +import org.saturnclient.emotes.fabric.Emotes; import org.saturnclient.ui.screens.EmoteWheel; import org.saturnclient.ui.screens.ShiftMenu; -// import dev.kosmx.playerAnim.api.layered.AnimationStack; -// import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess; - import org.lwjgl.glfw.GLFW; /** @@ -45,13 +44,11 @@ public class KeyInputHandler { Providers.saturn.getClient().setScreen(new EmoteWheel()); } - if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking()) { - // AnimationStack animationStack = - // PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player); - // if (animationStack.isActive() && animationStack.getPriority() == 1000) { - // animationStack.removeLayer(1000); - // ServiceClient.emote(""); - // } + // Sneaking cancels your own emote, for everyone. + if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking() + && Emotes.playing(SaturnClient.client.player.getUuid()).isPresent()) { + Emotes.stop(SaturnClient.client.player.getUuid()); + ServiceClient.emote(""); } }); } diff --git a/versions/1.21.4/build.gradle b/versions/1.21.4/build.gradle index f483e49..b40015c 100644 --- a/versions/1.21.4/build.gradle +++ b/versions/1.21.4/build.gradle @@ -11,7 +11,6 @@ base { } repositories { - maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' } maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' } } @@ -24,10 +23,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" - // Player Animation Library - include modImplementation( - "dev.kosmx.player-anim:player-animation-lib-fabric:${project.player_anim}" - ) + // Saturn's emote library (limb bending, Emotecraft emotes) + include modImplementation("org.saturnclient:emotes-fabric:${project.emotes_version}+${project.minecraft_version}") implementation project(":common") @@ -37,11 +34,6 @@ dependencies { include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-annotations:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-core:2.17.0") - - // Optional: BendyLib - // include modRuntimeOnly( - // "io.github.kosmx.bendy-lib:bendy-lib-fabric:${project.bendylib_version}" - // ) } /* diff --git a/versions/1.21.4/gradle.properties b/versions/1.21.4/gradle.properties index 6b3ba9b..0e59b54 100644 --- a/versions/1.21.4/gradle.properties +++ b/versions/1.21.4/gradle.properties @@ -10,7 +10,7 @@ org.gradle.configuration-cache=false minecraft_version=1.21.4 yarn_mappings=1.21.4+build.8 loader_version=0.18.4 -loom_version=1.15-SNAPSHOT +loom_version=1.17.21 # Mod Properties maven_group=org.saturnclient @@ -18,5 +18,3 @@ archives_base_name=saturn-client # Dependencies fabric_api_version=0.119.4+1.21.4 - -player_anim = 2.0.3+1.21.4 diff --git a/versions/1.21.4/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java b/versions/1.21.4/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java index b39c54c..87dd445 100644 --- a/versions/1.21.4/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java +++ b/versions/1.21.4/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java @@ -11,15 +11,10 @@ import net.minecraft.text.Text; import org.saturnclient.common.provider.SaturnProvider; import org.saturnclient.common.ref.asset.IdentifierRef; import org.saturnclient.common.ref.game.MinecraftClientRef; +import org.saturnclient.cosmetics.Emotes; import org.saturnclient.impl.cosmetics.utils.IdentifierUtils; import org.saturnclient.saturnclient.SaturnClient; -import dev.kosmx.playerAnim.api.layered.AnimationStack; -import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess; -import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationRegistry; -import net.minecraft.client.network.AbstractClientPlayerEntity; -import net.minecraft.util.Identifier; - public class SaturnProviderImpl implements SaturnProvider { @Override public MinecraftClientRef getClient() { @@ -28,31 +23,13 @@ public class SaturnProviderImpl implements SaturnProvider { @Override public void playEmote(UUID fromPlayerUuid, String emoteIdOrNull) { - if (SaturnClient.client == null || SaturnClient.client.world == null) { + if (fromPlayerUuid == null) { return; } - - for (AbstractClientPlayerEntity player : SaturnClient.client.world.getPlayers()) { - if (!player.getUuid().equals(fromPlayerUuid)) { - continue; - } - - AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(player); - - if (emoteIdOrNull != null && !emoteIdOrNull.isEmpty()) { - if (animationStack.isActive() && animationStack.getPriority() == 1000) { - animationStack.removeLayer(1000); - } - animationStack.addAnimLayer(1000, - PlayerAnimationRegistry - .getAnimation(Identifier.of("saturnclient", emoteIdOrNull)) - .playAnimation()); - } else { - animationStack.removeLayer(1000); - } - - break; - } + // An empty or unknown ID stops whatever the player is playing. + Emotes.get(emoteIdOrNull == null ? "" : emoteIdOrNull).ifPresentOrElse( + emote -> org.saturnclient.emotes.fabric.Emotes.play(fromPlayerUuid, emote.animation()), + () -> org.saturnclient.emotes.fabric.Emotes.stop(fromPlayerUuid)); } @Override diff --git a/versions/1.21.4/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java b/versions/1.21.4/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java index d006f22..4e037c7 100644 --- a/versions/1.21.4/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java +++ b/versions/1.21.4/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java @@ -9,12 +9,10 @@ import org.saturnclient.config.Config; import org.saturnclient.saturnclient.SaturnClient; import org.saturnclient.client.ServiceClient; import org.saturnclient.common.provider.Providers; +import org.saturnclient.emotes.fabric.Emotes; import org.saturnclient.ui.screens.EmoteWheel; import org.saturnclient.ui.screens.ShiftMenu; -import dev.kosmx.playerAnim.api.layered.AnimationStack; -import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess; - import org.lwjgl.glfw.GLFW; /** @@ -45,12 +43,11 @@ public class KeyInputHandler { Providers.saturn.getClient().setScreen(new EmoteWheel()); } - if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking()) { - AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player); - if (animationStack.isActive() && animationStack.getPriority() == 1000) { - animationStack.removeLayer(1000); - ServiceClient.emote(""); - } + // Sneaking cancels your own emote, for everyone. + if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking() + && Emotes.playing(SaturnClient.client.player.getUuid()).isPresent()) { + Emotes.stop(SaturnClient.client.player.getUuid()); + ServiceClient.emote(""); } }); } diff --git a/versions/1.21.5/build.gradle b/versions/1.21.5/build.gradle index f483e49..b40015c 100644 --- a/versions/1.21.5/build.gradle +++ b/versions/1.21.5/build.gradle @@ -11,7 +11,6 @@ base { } repositories { - maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' } maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' } } @@ -24,10 +23,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" - // Player Animation Library - include modImplementation( - "dev.kosmx.player-anim:player-animation-lib-fabric:${project.player_anim}" - ) + // Saturn's emote library (limb bending, Emotecraft emotes) + include modImplementation("org.saturnclient:emotes-fabric:${project.emotes_version}+${project.minecraft_version}") implementation project(":common") @@ -37,11 +34,6 @@ dependencies { include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-annotations:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-core:2.17.0") - - // Optional: BendyLib - // include modRuntimeOnly( - // "io.github.kosmx.bendy-lib:bendy-lib-fabric:${project.bendylib_version}" - // ) } /* diff --git a/versions/1.21.5/gradle.properties b/versions/1.21.5/gradle.properties index 89848a5..b71b756 100644 --- a/versions/1.21.5/gradle.properties +++ b/versions/1.21.5/gradle.properties @@ -10,12 +10,10 @@ org.gradle.configuration-cache=false minecraft_version=1.21.5 yarn_mappings=1.21.5+build.1 loader_version=0.18.4 -loom_version=1.15-SNAPSHOT +loom_version=1.17.21 fabric_api_version=0.128.2+1.21.5 # Mod Properties maven_group=org.saturnclient archives_base_name=saturn-client - -player_anim = 2.0.2+1.21.5 diff --git a/versions/1.21.5/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java b/versions/1.21.5/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java index b39c54c..87dd445 100644 --- a/versions/1.21.5/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java +++ b/versions/1.21.5/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java @@ -11,15 +11,10 @@ import net.minecraft.text.Text; import org.saturnclient.common.provider.SaturnProvider; import org.saturnclient.common.ref.asset.IdentifierRef; import org.saturnclient.common.ref.game.MinecraftClientRef; +import org.saturnclient.cosmetics.Emotes; import org.saturnclient.impl.cosmetics.utils.IdentifierUtils; import org.saturnclient.saturnclient.SaturnClient; -import dev.kosmx.playerAnim.api.layered.AnimationStack; -import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess; -import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationRegistry; -import net.minecraft.client.network.AbstractClientPlayerEntity; -import net.minecraft.util.Identifier; - public class SaturnProviderImpl implements SaturnProvider { @Override public MinecraftClientRef getClient() { @@ -28,31 +23,13 @@ public class SaturnProviderImpl implements SaturnProvider { @Override public void playEmote(UUID fromPlayerUuid, String emoteIdOrNull) { - if (SaturnClient.client == null || SaturnClient.client.world == null) { + if (fromPlayerUuid == null) { return; } - - for (AbstractClientPlayerEntity player : SaturnClient.client.world.getPlayers()) { - if (!player.getUuid().equals(fromPlayerUuid)) { - continue; - } - - AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(player); - - if (emoteIdOrNull != null && !emoteIdOrNull.isEmpty()) { - if (animationStack.isActive() && animationStack.getPriority() == 1000) { - animationStack.removeLayer(1000); - } - animationStack.addAnimLayer(1000, - PlayerAnimationRegistry - .getAnimation(Identifier.of("saturnclient", emoteIdOrNull)) - .playAnimation()); - } else { - animationStack.removeLayer(1000); - } - - break; - } + // An empty or unknown ID stops whatever the player is playing. + Emotes.get(emoteIdOrNull == null ? "" : emoteIdOrNull).ifPresentOrElse( + emote -> org.saturnclient.emotes.fabric.Emotes.play(fromPlayerUuid, emote.animation()), + () -> org.saturnclient.emotes.fabric.Emotes.stop(fromPlayerUuid)); } @Override diff --git a/versions/1.21.5/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java b/versions/1.21.5/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java index d006f22..4e037c7 100644 --- a/versions/1.21.5/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java +++ b/versions/1.21.5/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java @@ -9,12 +9,10 @@ import org.saturnclient.config.Config; import org.saturnclient.saturnclient.SaturnClient; import org.saturnclient.client.ServiceClient; import org.saturnclient.common.provider.Providers; +import org.saturnclient.emotes.fabric.Emotes; import org.saturnclient.ui.screens.EmoteWheel; import org.saturnclient.ui.screens.ShiftMenu; -import dev.kosmx.playerAnim.api.layered.AnimationStack; -import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess; - import org.lwjgl.glfw.GLFW; /** @@ -45,12 +43,11 @@ public class KeyInputHandler { Providers.saturn.getClient().setScreen(new EmoteWheel()); } - if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking()) { - AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player); - if (animationStack.isActive() && animationStack.getPriority() == 1000) { - animationStack.removeLayer(1000); - ServiceClient.emote(""); - } + // Sneaking cancels your own emote, for everyone. + if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking() + && Emotes.playing(SaturnClient.client.player.getUuid()).isPresent()) { + Emotes.stop(SaturnClient.client.player.getUuid()); + ServiceClient.emote(""); } }); } diff --git a/versions/1.21.6/build.gradle b/versions/1.21.6/build.gradle index 3c1c06f..b40015c 100644 --- a/versions/1.21.6/build.gradle +++ b/versions/1.21.6/build.gradle @@ -11,7 +11,6 @@ base { } repositories { - // maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' } maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' } } @@ -24,10 +23,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" - // Player Animation Library - // include modImplementation( - // "dev.kosmx.player-anim:player-animation-lib-fabric:${project.player_anim}" - // ) + // Saturn's emote library (limb bending, Emotecraft emotes) + include modImplementation("org.saturnclient:emotes-fabric:${project.emotes_version}+${project.minecraft_version}") implementation project(":common") @@ -37,11 +34,6 @@ dependencies { include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-annotations:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-core:2.17.0") - - // Optional: BendyLib - // include modRuntimeOnly( - // "io.github.kosmx.bendy-lib:bendy-lib-fabric:${project.bendylib_version}" - // ) } /* diff --git a/versions/1.21.6/gradle.properties b/versions/1.21.6/gradle.properties index 6ef15d7..f5e3bf0 100644 --- a/versions/1.21.6/gradle.properties +++ b/versions/1.21.6/gradle.properties @@ -10,12 +10,10 @@ org.gradle.configuration-cache=false minecraft_version=1.21.6 yarn_mappings=1.21.6+build.1 loader_version=0.18.5 -loom_version=1.15-SNAPSHOT +loom_version=1.17.21 fabric_api_version=0.128.2+1.21.6 # Mod Properties maven_group=org.saturnclient archives_base_name=saturn-client - -# player_anim = 2.0.2+1.21.5 diff --git a/versions/1.21.6/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java b/versions/1.21.6/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java index 20a50be..87dd445 100644 --- a/versions/1.21.6/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java +++ b/versions/1.21.6/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java @@ -11,6 +11,7 @@ import net.minecraft.text.Text; import org.saturnclient.common.provider.SaturnProvider; import org.saturnclient.common.ref.asset.IdentifierRef; import org.saturnclient.common.ref.game.MinecraftClientRef; +import org.saturnclient.cosmetics.Emotes; import org.saturnclient.impl.cosmetics.utils.IdentifierUtils; import org.saturnclient.saturnclient.SaturnClient; @@ -22,31 +23,13 @@ public class SaturnProviderImpl implements SaturnProvider { @Override public void playEmote(UUID fromPlayerUuid, String emoteIdOrNull) { - // if (SaturnClient.client == null || SaturnClient.client.world == null) { - // return; - // } - - // for (AbstractClientPlayerEntity player : SaturnClient.client.world.getPlayers()) { - // if (!player.getUuid().equals(fromPlayerUuid)) { - // continue; - // } - - // AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(player); - - // if (emoteIdOrNull != null && !emoteIdOrNull.isEmpty()) { - // if (animationStack.isActive() && animationStack.getPriority() == 1000) { - // animationStack.removeLayer(1000); - // } - // animationStack.addAnimLayer(1000, - // PlayerAnimationRegistry - // .getAnimation(Identifier.of("saturnclient", emoteIdOrNull)) - // .playAnimation()); - // } else { - // animationStack.removeLayer(1000); - // } - - // break; - // } + if (fromPlayerUuid == null) { + return; + } + // An empty or unknown ID stops whatever the player is playing. + Emotes.get(emoteIdOrNull == null ? "" : emoteIdOrNull).ifPresentOrElse( + emote -> org.saturnclient.emotes.fabric.Emotes.play(fromPlayerUuid, emote.animation()), + () -> org.saturnclient.emotes.fabric.Emotes.stop(fromPlayerUuid)); } @Override diff --git a/versions/1.21.6/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java b/versions/1.21.6/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java index b1bae03..7424639 100644 --- a/versions/1.21.6/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java +++ b/versions/1.21.6/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java @@ -8,12 +8,11 @@ import net.minecraft.client.util.InputUtil; import org.saturnclient.config.Config; import org.saturnclient.saturnclient.SaturnClient; import org.saturnclient.common.provider.Providers; +import org.saturnclient.client.ServiceClient; +import org.saturnclient.emotes.fabric.Emotes; import org.saturnclient.ui.screens.EmoteWheel; import org.saturnclient.ui.screens.ShiftMenu; -// import dev.kosmx.playerAnim.api.layered.AnimationStack; -// import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess; - import org.lwjgl.glfw.GLFW; /** @@ -44,12 +43,11 @@ public class KeyInputHandler { Providers.saturn.getClient().setScreen(new EmoteWheel()); } - if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking()) { - // AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player); - // if (animationStack.isActive() && animationStack.getPriority() == 1000) { - // animationStack.removeLayer(1000); - // ServiceClient.emote(""); - // } + // Sneaking cancels your own emote, for everyone. + if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking() + && Emotes.playing(SaturnClient.client.player.getUuid()).isPresent()) { + Emotes.stop(SaturnClient.client.player.getUuid()); + ServiceClient.emote(""); } }); } diff --git a/versions/1.21.7/build.gradle b/versions/1.21.7/build.gradle index 3c1c06f..b40015c 100644 --- a/versions/1.21.7/build.gradle +++ b/versions/1.21.7/build.gradle @@ -11,7 +11,6 @@ base { } repositories { - // maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' } maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' } } @@ -24,10 +23,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" - // Player Animation Library - // include modImplementation( - // "dev.kosmx.player-anim:player-animation-lib-fabric:${project.player_anim}" - // ) + // Saturn's emote library (limb bending, Emotecraft emotes) + include modImplementation("org.saturnclient:emotes-fabric:${project.emotes_version}+${project.minecraft_version}") implementation project(":common") @@ -37,11 +34,6 @@ dependencies { include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-annotations:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-core:2.17.0") - - // Optional: BendyLib - // include modRuntimeOnly( - // "io.github.kosmx.bendy-lib:bendy-lib-fabric:${project.bendylib_version}" - // ) } /* diff --git a/versions/1.21.7/gradle.properties b/versions/1.21.7/gradle.properties index 0daa03a..1932513 100644 --- a/versions/1.21.7/gradle.properties +++ b/versions/1.21.7/gradle.properties @@ -10,12 +10,10 @@ org.gradle.configuration-cache=false minecraft_version=1.21.7 yarn_mappings=1.21.7+build.8 loader_version=0.19.0 -loom_version=1.15-SNAPSHOT +loom_version=1.17.21 fabric_api_version=0.129.0+1.21.7 # Mod Properties maven_group=org.saturnclient archives_base_name=saturn-client - -# player_anim = 2.0.2+1.21.5 diff --git a/versions/1.21.7/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java b/versions/1.21.7/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java index 20a50be..87dd445 100644 --- a/versions/1.21.7/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java +++ b/versions/1.21.7/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java @@ -11,6 +11,7 @@ import net.minecraft.text.Text; import org.saturnclient.common.provider.SaturnProvider; import org.saturnclient.common.ref.asset.IdentifierRef; import org.saturnclient.common.ref.game.MinecraftClientRef; +import org.saturnclient.cosmetics.Emotes; import org.saturnclient.impl.cosmetics.utils.IdentifierUtils; import org.saturnclient.saturnclient.SaturnClient; @@ -22,31 +23,13 @@ public class SaturnProviderImpl implements SaturnProvider { @Override public void playEmote(UUID fromPlayerUuid, String emoteIdOrNull) { - // if (SaturnClient.client == null || SaturnClient.client.world == null) { - // return; - // } - - // for (AbstractClientPlayerEntity player : SaturnClient.client.world.getPlayers()) { - // if (!player.getUuid().equals(fromPlayerUuid)) { - // continue; - // } - - // AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(player); - - // if (emoteIdOrNull != null && !emoteIdOrNull.isEmpty()) { - // if (animationStack.isActive() && animationStack.getPriority() == 1000) { - // animationStack.removeLayer(1000); - // } - // animationStack.addAnimLayer(1000, - // PlayerAnimationRegistry - // .getAnimation(Identifier.of("saturnclient", emoteIdOrNull)) - // .playAnimation()); - // } else { - // animationStack.removeLayer(1000); - // } - - // break; - // } + if (fromPlayerUuid == null) { + return; + } + // An empty or unknown ID stops whatever the player is playing. + Emotes.get(emoteIdOrNull == null ? "" : emoteIdOrNull).ifPresentOrElse( + emote -> org.saturnclient.emotes.fabric.Emotes.play(fromPlayerUuid, emote.animation()), + () -> org.saturnclient.emotes.fabric.Emotes.stop(fromPlayerUuid)); } @Override diff --git a/versions/1.21.7/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java b/versions/1.21.7/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java index b1bae03..7424639 100644 --- a/versions/1.21.7/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java +++ b/versions/1.21.7/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java @@ -8,12 +8,11 @@ import net.minecraft.client.util.InputUtil; import org.saturnclient.config.Config; import org.saturnclient.saturnclient.SaturnClient; import org.saturnclient.common.provider.Providers; +import org.saturnclient.client.ServiceClient; +import org.saturnclient.emotes.fabric.Emotes; import org.saturnclient.ui.screens.EmoteWheel; import org.saturnclient.ui.screens.ShiftMenu; -// import dev.kosmx.playerAnim.api.layered.AnimationStack; -// import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess; - import org.lwjgl.glfw.GLFW; /** @@ -44,12 +43,11 @@ public class KeyInputHandler { Providers.saturn.getClient().setScreen(new EmoteWheel()); } - if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking()) { - // AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player); - // if (animationStack.isActive() && animationStack.getPriority() == 1000) { - // animationStack.removeLayer(1000); - // ServiceClient.emote(""); - // } + // Sneaking cancels your own emote, for everyone. + if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking() + && Emotes.playing(SaturnClient.client.player.getUuid()).isPresent()) { + Emotes.stop(SaturnClient.client.player.getUuid()); + ServiceClient.emote(""); } }); } diff --git a/versions/1.21.8/build.gradle b/versions/1.21.8/build.gradle index 3c1c06f..b40015c 100644 --- a/versions/1.21.8/build.gradle +++ b/versions/1.21.8/build.gradle @@ -11,7 +11,6 @@ base { } repositories { - // maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' } maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' } } @@ -24,10 +23,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" - // Player Animation Library - // include modImplementation( - // "dev.kosmx.player-anim:player-animation-lib-fabric:${project.player_anim}" - // ) + // Saturn's emote library (limb bending, Emotecraft emotes) + include modImplementation("org.saturnclient:emotes-fabric:${project.emotes_version}+${project.minecraft_version}") implementation project(":common") @@ -37,11 +34,6 @@ dependencies { include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-annotations:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-core:2.17.0") - - // Optional: BendyLib - // include modRuntimeOnly( - // "io.github.kosmx.bendy-lib:bendy-lib-fabric:${project.bendylib_version}" - // ) } /* diff --git a/versions/1.21.8/gradle.properties b/versions/1.21.8/gradle.properties index 9286f7e..991192a 100644 --- a/versions/1.21.8/gradle.properties +++ b/versions/1.21.8/gradle.properties @@ -10,12 +10,10 @@ org.gradle.configuration-cache=false minecraft_version=1.21.8 yarn_mappings=1.21.8+build.1 loader_version=0.19.0 -loom_version=1.15-SNAPSHOT +loom_version=1.17.21 fabric_api_version=0.136.1+1.21.8 # Mod Properties maven_group=org.saturnclient archives_base_name=saturn-client - -# player_anim = 2.0.2+1.21.5 diff --git a/versions/1.21.8/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java b/versions/1.21.8/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java index 20a50be..87dd445 100644 --- a/versions/1.21.8/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java +++ b/versions/1.21.8/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java @@ -11,6 +11,7 @@ import net.minecraft.text.Text; import org.saturnclient.common.provider.SaturnProvider; import org.saturnclient.common.ref.asset.IdentifierRef; import org.saturnclient.common.ref.game.MinecraftClientRef; +import org.saturnclient.cosmetics.Emotes; import org.saturnclient.impl.cosmetics.utils.IdentifierUtils; import org.saturnclient.saturnclient.SaturnClient; @@ -22,31 +23,13 @@ public class SaturnProviderImpl implements SaturnProvider { @Override public void playEmote(UUID fromPlayerUuid, String emoteIdOrNull) { - // if (SaturnClient.client == null || SaturnClient.client.world == null) { - // return; - // } - - // for (AbstractClientPlayerEntity player : SaturnClient.client.world.getPlayers()) { - // if (!player.getUuid().equals(fromPlayerUuid)) { - // continue; - // } - - // AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(player); - - // if (emoteIdOrNull != null && !emoteIdOrNull.isEmpty()) { - // if (animationStack.isActive() && animationStack.getPriority() == 1000) { - // animationStack.removeLayer(1000); - // } - // animationStack.addAnimLayer(1000, - // PlayerAnimationRegistry - // .getAnimation(Identifier.of("saturnclient", emoteIdOrNull)) - // .playAnimation()); - // } else { - // animationStack.removeLayer(1000); - // } - - // break; - // } + if (fromPlayerUuid == null) { + return; + } + // An empty or unknown ID stops whatever the player is playing. + Emotes.get(emoteIdOrNull == null ? "" : emoteIdOrNull).ifPresentOrElse( + emote -> org.saturnclient.emotes.fabric.Emotes.play(fromPlayerUuid, emote.animation()), + () -> org.saturnclient.emotes.fabric.Emotes.stop(fromPlayerUuid)); } @Override diff --git a/versions/1.21.8/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java b/versions/1.21.8/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java index b1bae03..7424639 100644 --- a/versions/1.21.8/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java +++ b/versions/1.21.8/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java @@ -8,12 +8,11 @@ import net.minecraft.client.util.InputUtil; import org.saturnclient.config.Config; import org.saturnclient.saturnclient.SaturnClient; import org.saturnclient.common.provider.Providers; +import org.saturnclient.client.ServiceClient; +import org.saturnclient.emotes.fabric.Emotes; import org.saturnclient.ui.screens.EmoteWheel; import org.saturnclient.ui.screens.ShiftMenu; -// import dev.kosmx.playerAnim.api.layered.AnimationStack; -// import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess; - import org.lwjgl.glfw.GLFW; /** @@ -44,12 +43,11 @@ public class KeyInputHandler { Providers.saturn.getClient().setScreen(new EmoteWheel()); } - if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking()) { - // AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player); - // if (animationStack.isActive() && animationStack.getPriority() == 1000) { - // animationStack.removeLayer(1000); - // ServiceClient.emote(""); - // } + // Sneaking cancels your own emote, for everyone. + if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking() + && Emotes.playing(SaturnClient.client.player.getUuid()).isPresent()) { + Emotes.stop(SaturnClient.client.player.getUuid()); + ServiceClient.emote(""); } }); } diff --git a/versions/1.21.9/build.gradle b/versions/1.21.9/build.gradle index 3c1c06f..b40015c 100644 --- a/versions/1.21.9/build.gradle +++ b/versions/1.21.9/build.gradle @@ -11,7 +11,6 @@ base { } repositories { - // maven { name = "KoSmX Maven"; url = 'https://maven.kosmx.dev/' } maven { name = "Selimaj"; url = 'https://git.selimaj.dev/api/packages/selimaj-dev/maven' } } @@ -24,10 +23,8 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" - // Player Animation Library - // include modImplementation( - // "dev.kosmx.player-anim:player-animation-lib-fabric:${project.player_anim}" - // ) + // Saturn's emote library (limb bending, Emotecraft emotes) + include modImplementation("org.saturnclient:emotes-fabric:${project.emotes_version}+${project.minecraft_version}") implementation project(":common") @@ -37,11 +34,6 @@ dependencies { include implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-annotations:2.17.0") include implementation("com.fasterxml.jackson.core:jackson-core:2.17.0") - - // Optional: BendyLib - // include modRuntimeOnly( - // "io.github.kosmx.bendy-lib:bendy-lib-fabric:${project.bendylib_version}" - // ) } /* diff --git a/versions/1.21.9/gradle.properties b/versions/1.21.9/gradle.properties index 16858b3..5335436 100644 --- a/versions/1.21.9/gradle.properties +++ b/versions/1.21.9/gradle.properties @@ -10,12 +10,10 @@ org.gradle.configuration-cache=false minecraft_version=1.21.9 yarn_mappings=1.21.9+build.1 loader_version=0.19.0 -loom_version=1.15-SNAPSHOT +loom_version=1.17.21 fabric_api_version=0.134.1+1.21.9 # Mod Properties maven_group=org.saturnclient archives_base_name=saturn-client - -# player_anim = 2.0.2+1.21.5 diff --git a/versions/1.21.9/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java b/versions/1.21.9/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java index 20a50be..87dd445 100644 --- a/versions/1.21.9/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java +++ b/versions/1.21.9/src/main/java/org/saturnclient/impl/provider/SaturnProviderImpl.java @@ -11,6 +11,7 @@ import net.minecraft.text.Text; import org.saturnclient.common.provider.SaturnProvider; import org.saturnclient.common.ref.asset.IdentifierRef; import org.saturnclient.common.ref.game.MinecraftClientRef; +import org.saturnclient.cosmetics.Emotes; import org.saturnclient.impl.cosmetics.utils.IdentifierUtils; import org.saturnclient.saturnclient.SaturnClient; @@ -22,31 +23,13 @@ public class SaturnProviderImpl implements SaturnProvider { @Override public void playEmote(UUID fromPlayerUuid, String emoteIdOrNull) { - // if (SaturnClient.client == null || SaturnClient.client.world == null) { - // return; - // } - - // for (AbstractClientPlayerEntity player : SaturnClient.client.world.getPlayers()) { - // if (!player.getUuid().equals(fromPlayerUuid)) { - // continue; - // } - - // AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(player); - - // if (emoteIdOrNull != null && !emoteIdOrNull.isEmpty()) { - // if (animationStack.isActive() && animationStack.getPriority() == 1000) { - // animationStack.removeLayer(1000); - // } - // animationStack.addAnimLayer(1000, - // PlayerAnimationRegistry - // .getAnimation(Identifier.of("saturnclient", emoteIdOrNull)) - // .playAnimation()); - // } else { - // animationStack.removeLayer(1000); - // } - - // break; - // } + if (fromPlayerUuid == null) { + return; + } + // An empty or unknown ID stops whatever the player is playing. + Emotes.get(emoteIdOrNull == null ? "" : emoteIdOrNull).ifPresentOrElse( + emote -> org.saturnclient.emotes.fabric.Emotes.play(fromPlayerUuid, emote.animation()), + () -> org.saturnclient.emotes.fabric.Emotes.stop(fromPlayerUuid)); } @Override diff --git a/versions/1.21.9/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java b/versions/1.21.9/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java index 2ca0362..f8ba756 100644 --- a/versions/1.21.9/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java +++ b/versions/1.21.9/src/main/java/org/saturnclient/saturnclient/event/KeyInputHandler.java @@ -9,12 +9,11 @@ import net.minecraft.util.Identifier; import org.saturnclient.config.Config; import org.saturnclient.saturnclient.SaturnClient; import org.saturnclient.common.provider.Providers; +import org.saturnclient.client.ServiceClient; +import org.saturnclient.emotes.fabric.Emotes; import org.saturnclient.ui.screens.EmoteWheel; import org.saturnclient.ui.screens.ShiftMenu; -// import dev.kosmx.playerAnim.api.layered.AnimationStack; -// import dev.kosmx.playerAnim.minecraftApi.PlayerAnimationAccess; - import org.lwjgl.glfw.GLFW; /** @@ -45,13 +44,11 @@ public class KeyInputHandler { Providers.saturn.getClient().setScreen(new EmoteWheel()); } - if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking()) { - // AnimationStack animationStack = - // PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player); - // if (animationStack.isActive() && animationStack.getPriority() == 1000) { - // animationStack.removeLayer(1000); - // ServiceClient.emote(""); - // } + // Sneaking cancels your own emote, for everyone. + if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking() + && Emotes.playing(SaturnClient.client.player.getUuid()).isPresent()) { + Emotes.stop(SaturnClient.client.player.getUuid()); + ServiceClient.emote(""); } }); }