diff --git a/README.md b/README.md index dbfd86e..2c68664 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,10 @@ A player emote library for Saturn Client, with limb bending. - `tools/emotecraft/convert.py`: converts Emotecraft's binary `.emotecraft` files to Emotecraft JSON (standard-library Python). -Supported versions: 1.21.4 to 1.21.11, the same range as Saturn Client. Each version's Fabric API -version is set in `stonecutter.properties.toml`. The code uses Mojang mappings. +Supported versions: 1.21.4 to 1.21.11, 26.1 (and its hotfixes), 26.2 and 26.3. Each version's +Fabric API version is set in `stonecutter.properties.toml`. The code uses Mojang mappings, which +26.1+ ships as its own names, so `loom-back-compat` applies the remapping Loom for 1.21.x and the +plain one for 26.x. 26.x builds need Java 25; Gradle downloads it when it isn't installed. ## Using it @@ -114,8 +116,8 @@ version whose code is uncommented in `src/`. Switch versions with the Stonecutte or the `Set active project to ` Gradle task. Run `Reset active project` before committing, so the tree is committed with `vcsVersion` (1.21.11) active. -Loom 1.18 needs a Java 25 JVM to run Gradle, so the build is pinned to Loom 1.17 until the -toolchain moves. Minecraft 26.x will need that upgrade. +Loom 1.18 needs a Java 25 JVM to run Gradle, so the build is pinned to Loom 1.17, which builds +26.x as well (with a Java 25 toolchain for those versions only). ## Publishing diff --git a/build.gradle.kts b/build.gradle.kts index 61d970f..8f2d253 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,7 +22,8 @@ val testmod: SourceSet = sourceSets.create("testmod") { } loom { - createRemapConfigurations(testmod) + // The testmod's mod* configurations; 26.1+ has nothing to remap, and loomx aliases them there. + if (!loomx.isUnobfuscated) createRemapConfigurations(testmod) mods { register("saturn_emotes") { sourceSet(sourceSets.main.get()) } diff --git a/settings.gradle.kts b/settings.gradle.kts index 97d2509..3b5f514 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -9,6 +9,8 @@ pluginManagement { } plugins { + // Downloads the Java toolchain a version needs (Java 25 for 26.1+) when it isn't installed. + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" id("dev.kikugie.stonecutter") version "0.9.8" // Picks the right Loom variant per Minecraft version (remapping for 1.21.x, plain for 26.1+). id("dev.kikugie.loom-back-compat") version "0.4.2" @@ -17,7 +19,7 @@ plugins { stonecutter { create(rootProject) { // Same range as Saturn Client. Per-version dependencies live in stonecutter.properties.toml. - versions("1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.9", "1.21.10", "1.21.11") + versions("1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.9", "1.21.10", "1.21.11", "26.1", "26.2", "26.3") vcsVersion = "1.21.11" } } diff --git a/src/main/java/org/saturnclient/emotes/fabric/BendTransforms.java b/src/main/java/org/saturnclient/emotes/fabric/BendTransforms.java index 149bbe3..7a5ec3b 100644 --- a/src/main/java/org/saturnclient/emotes/fabric/BendTransforms.java +++ b/src/main/java/org/saturnclient/emotes/fabric/BendTransforms.java @@ -22,7 +22,11 @@ public final class BendTransforms { bend.bendPoint(0, y, 0, center); Vec3 axis = bend.axis(); poseStack.translate(center[0] / 16, center[1] / 16, center[2] / 16); - poseStack.mulPose(new Quaternionf().rotationAxis(bend.angleAt(y), axis.x(), axis.y(), axis.z())); + Quaternionf rotation = new Quaternionf().rotationAxis(bend.angleAt(y), axis.x(), axis.y(), axis.z()); + //? if >=26.3 { + /*poseStack.rotate(rotation); + *///?} else + poseStack.mulPose(rotation); poseStack.translate(0, -y / 16, 0); } } diff --git a/src/main/java/org/saturnclient/emotes/fabric/Emotes.java b/src/main/java/org/saturnclient/emotes/fabric/Emotes.java index e0a9e6a..08512a5 100644 --- a/src/main/java/org/saturnclient/emotes/fabric/Emotes.java +++ b/src/main/java/org/saturnclient/emotes/fabric/Emotes.java @@ -19,7 +19,7 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; /** Client-side entry point: which player is playing which animation. */ public final class Emotes implements ClientModInitializer { public static final String MOD_ID = "saturn_emotes"; - public static final String VERSION = /*$ mod_version*/ "0.1.1"; + public static final String VERSION = /*$ mod_version*/ "0.1.2"; public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); private static final EmoteRegistry REGISTRY = new EmoteRegistry(); diff --git a/src/testmod/java/org/saturnclient/emotes/testmod/EmotesGameTest.java b/src/testmod/java/org/saturnclient/emotes/testmod/EmotesGameTest.java index 816fed7..e8bfb61 100644 --- a/src/testmod/java/org/saturnclient/emotes/testmod/EmotesGameTest.java +++ b/src/testmod/java/org/saturnclient/emotes/testmod/EmotesGameTest.java @@ -7,6 +7,7 @@ import net.fabricmc.fabric.api.client.gametest.v1.FabricClientGameTest; import net.fabricmc.fabric.api.client.gametest.v1.context.ClientGameTestContext; import net.fabricmc.fabric.api.client.gametest.v1.context.TestSingleplayerContext; import net.minecraft.client.CameraType; +import net.minecraft.client.Minecraft; /** * Screenshots each test animation at set points, from the front, the side and behind. @@ -50,9 +51,14 @@ public final class EmotesGameTest implements FabricClientGameTest { @Override public void runTest(ClientGameTestContext context) { try (TestSingleplayerContext singleplayer = context.worldBuilder().create()) { + //? if >=26.2 { + /*singleplayer.getConnection().waitForChunksRender(); + *///?} else if >=26.1 { + /*singleplayer.getClientLevel().waitForChunksRender(); + *///?} else singleplayer.getClientWorld().waitForChunksRender(); context.runOnClient(client -> { - client.options.hideGui = true; + setHudHidden(client, true); client.options.setCameraType(CameraType.THIRD_PERSON_FRONT); }); context.waitTicks(20); @@ -80,7 +86,7 @@ public final class EmotesGameTest implements FabricClientGameTest { singleplayer.getServer().runCommand("clear @a"); context.waitTicks(2); context.runOnClient(client -> { - client.options.hideGui = false; + setHudHidden(client, false); client.options.setCameraType(CameraType.FIRST_PERSON); }); // Give the hand time to come back up after the item change. @@ -88,11 +94,21 @@ public final class EmotesGameTest implements FabricClientGameTest { context.takeScreenshot(MINECRAFT + "-hold-firstperson"); context.runOnClient(client -> { Emotes.stop(client.player.getUUID()); - client.options.hideGui = true; + setHudHidden(client, true); }); } } + private static void setHudHidden(Minecraft client, boolean hidden) { + // From 26.2 the HUD can only be toggled. + //? if >=26.2 { + /*if (client.gui.hud.isHidden() != hidden) { + client.gui.hud.toggle(); + } + *///?} else + client.options.hideGui = hidden; + } + /** Turns the body (not the camera) by {@code turn} degrees, then takes a screenshot. */ private static void screenshot(ClientGameTestContext context, String name, float turn) { context.runOnClient(client -> { diff --git a/src/testmod/java/org/saturnclient/emotes/testmod/EmotesTestmod.java b/src/testmod/java/org/saturnclient/emotes/testmod/EmotesTestmod.java index 92c1103..aa2c075 100644 --- a/src/testmod/java/org/saturnclient/emotes/testmod/EmotesTestmod.java +++ b/src/testmod/java/org/saturnclient/emotes/testmod/EmotesTestmod.java @@ -1,7 +1,12 @@ package org.saturnclient.emotes.testmod; +//? if >=26.1 { +/*import static net.fabricmc.fabric.api.client.command.v2.ClientCommands.argument; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommands.literal; +*///?} else { import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument; import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; +//?} import java.io.IOException; import java.io.InputStream; diff --git a/stonecutter.properties.toml b/stonecutter.properties.toml index baaea76..0c767ee 100644 --- a/stonecutter.properties.toml +++ b/stonecutter.properties.toml @@ -2,7 +2,7 @@ mod.id = "saturn_emotes" mod.name = "Saturn Emotes" mod.group = "org.saturnclient" -mod.version = "0.1.1" +mod.version = "0.1.2" deps.fabric_loader = "0.19.5" loomx.loom_version = "1.17.21" @@ -38,3 +38,16 @@ deps.fabric_api = "0.138.4+1.21.10" ["1.21.11"] mod.mc_compat = "1.21.11" deps.fabric_api = "0.141.6+1.21.11" + +# Built against 26.1 and allowed on its hotfixes (26.1.1, 26.1.2). +["26.1"] +mod.mc_compat = "~26.1" +deps.fabric_api = "0.145.1+26.1" + +["26.2"] +mod.mc_compat = "26.2" +deps.fabric_api = "0.161.0+26.2" + +["26.3"] +mod.mc_compat = "26.3" +deps.fabric_api = "0.161.0+26.3"