diff --git a/build.gradle.kts b/build.gradle.kts index 7d53604c..5bb3b0b1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("io.github.gaming32.gradle.preprocess-root") version "0.4.4" - id("xyz.wagyourtail.unimined") version "1.2.4" apply false + id("xyz.wagyourtail.unimined") version "1.2.9" apply false } repositories { @@ -8,6 +8,8 @@ repositories { } preprocess { + val fabric12100 = createNode("1.21-fabric", 1_21_00, "yarn") + val neoforge12100 = createNode("1.21-neoforge", 1_21_00, "yarn") val fabric12006 = createNode("1.20.6-fabric", 1_20_06, "yarn") val neoforge12006 = createNode("1.20.6-neoforge", 1_20_06, "yarn") val fabric12004 = createNode("1.20.4-fabric", 1_20_04, "yarn") @@ -21,15 +23,17 @@ preprocess { val fabric11802 = createNode("1.18.2-fabric", 1_18_02, "yarn") val forge11802 = createNode("1.18.2-forge", 1_18_02, "srg") - fabric12006.link(neoforge12006) - neoforge12006.link(neoforge12004) - neoforge12004.link(fabric12004) - fabric12004.link(fabric12001) - fabric12001.link(forge12001) - forge12001.link(forge11904) - forge11904.link(fabric11904) - fabric11904.link(fabric11902) - fabric11902.link(forge11902) - forge11902.link(forge11802) - forge11802.link(fabric11802) + fabric12100.link(neoforge12100) + neoforge12100.link(neoforge12006) + neoforge12006.link(fabric12006) + fabric12006.link(fabric12004) + fabric12004.link(neoforge12004) + neoforge12004.link(forge12001) + forge12001.link(fabric12001) + fabric12001.link(fabric11904) + fabric11904.link(forge11904) + forge11904.link(forge11902) + forge11902.link(fabric11902) + fabric11902.link(fabric11802) + fabric11802.link(forge11802) } diff --git a/settings.gradle.kts b/settings.gradle.kts index 5abe3d44..675da574 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -31,6 +31,8 @@ listOf( "1.20.4-fabric", "1.20.6-neoforge", "1.20.6-fabric", + "1.21-neoforge", + "1.21-fabric", ).forEach { version -> include(":$version") project(":$version").apply { diff --git a/src/main/java/io/github/gaming32/worldhost/ResourceLocations.java b/src/main/java/io/github/gaming32/worldhost/ResourceLocations.java index 79b41a58..a6f384b9 100644 --- a/src/main/java/io/github/gaming32/worldhost/ResourceLocations.java +++ b/src/main/java/io/github/gaming32/worldhost/ResourceLocations.java @@ -3,14 +3,35 @@ import net.minecraft.resources.ResourceLocation; public final class ResourceLocations { + private static final String WORLD_HOST_NAMESPACE = "world-host"; + //#if MC >= 1.19.4 + private static final ResourceLocation WORLD_HOST_TEMPLATE = namespaced(WORLD_HOST_NAMESPACE, ""); + //#endif + private ResourceLocations() { } public static ResourceLocation minecraft(String path) { - return new ResourceLocation(ResourceLocation.DEFAULT_NAMESPACE, path); + //#if MC >= 1.21 + return ResourceLocation.withDefaultNamespace(path); + //#else + //$$ return new ResourceLocation(ResourceLocation.DEFAULT_NAMESPACE, path); + //#endif } public static ResourceLocation worldHost(String path) { - return new ResourceLocation("world-host", path); + //#if MC >= 1.19.4 + return WORLD_HOST_TEMPLATE.withPath(path); + //#else + //$$ return new ResourceLocation(WORLD_HOST_NAMESPACE, path); + //#endif + } + + public static ResourceLocation namespaced(String namespace, String path) { + //#if MC >= 1.21 + return ResourceLocation.fromNamespaceAndPath(namespace, path); + //#else + //$$ return new ResourceLocation(namespace, path); + //#endif } } diff --git a/src/main/java/io/github/gaming32/worldhost/mixin/MixinGameRenderer.java b/src/main/java/io/github/gaming32/worldhost/mixin/MixinGameRenderer.java index 8bd9ceb7..0fe2e5a1 100644 --- a/src/main/java/io/github/gaming32/worldhost/mixin/MixinGameRenderer.java +++ b/src/main/java/io/github/gaming32/worldhost/mixin/MixinGameRenderer.java @@ -53,7 +53,12 @@ private void toastRender(CallbackInfo ci) { //#else new GuiGraphics(minecraft, renderBuffers.bufferSource()), //#endif - mouseX, mouseY, minecraft.getFrameTime() + mouseX, mouseY, + //#if MC >= 1.21 + minecraft.getTimer().getRealtimeDeltaTicks() + //#else + //$$ minecraft.getFrameTime() + //#endif ); } //#endif diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml index 0a3cb7c2..b959c0e5 100644 --- a/src/main/resources/META-INF/neoforge.mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -27,9 +27,9 @@ side = "BOTH" [[dependencies.world_host]] modId = "minecraft" ##if MC == 1.20.6 -versionRange = "[1.20.5,1.20.7)" +#?? versionRange = "[1.20.5,1.20.7)" ##else -#?? versionRange = "[$mc_version]" +versionRange = "[$mc_version]" ##endif type = "required" ordering = "NONE" diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 0ad2861d..333c8b2b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -35,9 +35,9 @@ //#elseif MC == 1.20.4 //?? "minecraft": ">=1.20.3- <1.20.5", //#elseif MC == 1.20.6 - "minecraft": ">=1.20.5- <1.20.7", + //?? "minecraft": ">=1.20.5- <1.20.7", //#else - //?? "minecraft": "$mc_version", + "minecraft": "$mc_version", //#endif "fabric-resource-loader-v0": "*" }, diff --git a/version.gradle.kts b/version.gradle.kts index e75fbaf1..6e3fbb96 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -113,8 +113,9 @@ unimined.minecraft { }) mixinConfig("world-host.mixins.json") } - isNeoForge -> neoForged { + isNeoForge -> neoForge { loader(when (mcVersion) { + 1_21_00 -> "4-beta" 1_20_06 -> "21-beta" 1_20_04 -> "69-beta" else -> throw IllegalStateException("Unknown NeoForge version for $mcVersionString") @@ -259,6 +260,7 @@ dependencies { if (isFabric) { when (mcVersion) { + 1_21_00 -> "11.0.0-beta.1" 1_20_06 -> "10.0.0-beta.1" 1_20_04 -> "9.0.0" 1_20_01 -> "7.2.2" @@ -280,6 +282,7 @@ dependencies { if (isFabric) { when (mcVersion) { + 1_21_00 -> "0.100.1+1.21" 1_20_06 -> "0.100.0+1.20.6" 1_20_04 -> "0.97.1+1.20.4" 1_20_01 -> "0.92.2+1.20.1" @@ -381,6 +384,7 @@ tasks.processResources { // TODO: Remove pack.mcmeta in 1.20.4 filesMatching("pack.mcmeta") { expand("pack_format" to when { + mcVersion >= 1_21_00 -> 34 mcVersion >= 1_20_05 -> 32 mcVersion >= 1_20_03 -> 22 mcVersion >= 1_20_02 -> 18 diff --git a/versions/mainProject b/versions/mainProject index 304eaace..dfdd5113 100644 --- a/versions/mainProject +++ b/versions/mainProject @@ -1 +1 @@ -1.20.6-fabric \ No newline at end of file +1.21-fabric \ No newline at end of file