diff --git a/build.gradle.kts b/build.gradle.kts index 481b4ce..5e7f5f8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -55,9 +55,9 @@ repositories { maven("https://maven.neoforged.net/releases/") } -val yaclVersion = property("vers.deps.yacl").toString() val flk: String = "${libs.versions.fabric.language.kotlin.orNull}${libs.versions.kotlin.orNull}" val fapi: String by lazy { property("vers.deps.fapi").toString() } +val yacl: String by lazy { property("vers.deps.yacl").toString() } val modmenu: String by lazy { property("vers.deps.modMenu").toString() } dependencies { minecraft("com.mojang:minecraft:$mcVersion") @@ -74,6 +74,7 @@ dependencies { modImplementation("net.fabricmc.fabric-api:fabric-api:$fapi") modImplementation("net.fabricmc:fabric-language-kotlin:$flk") modImplementation("com.terraformersmc:modmenu:$modmenu") + modImplementation("dev.isxander:yet-another-config-lib:$yacl") } else { if (loader == ModPlatform.FORGE) { "forge"("net.minecraftforge:forge:$mcVersion-${property("vers.deps.fml")}") @@ -83,16 +84,14 @@ dependencies { implementation(libs.mixinextras.forge) } else "neoForge"("net.neoforged:neoforge:${property("vers.deps.fml")}") - implementation("thedarkcolour:kotlinforforge${if (loader == ModPlatform.NEOFORGE) "-neoforge" else ""}:${property("vers.deps.kff")}") + modImplementation("dev.nyon:KotlinLangForge:1.0.3-k${libs.versions.kotlin.orNull}-$mcVersion+${loader.name.lowercase()}") } - modImplementation("dev.isxander:yet-another-config-lib:$yaclVersion") - modImplementation(libs.konfig) include(libs.konfig) } -val javaVersion = property("vers.javaVer").toString() +val javaVersion = if (stonecutter.eval(mcVersion, ">=1.20.6")) 21 else 17 val modId = property("mod.id").toString() val modName = property("mod.name").toString() val modDescription = property("mod.description").toString() @@ -110,7 +109,7 @@ tasks { "mc" to mcVersionRange, "flk" to if (!isFabric) null else flk, "fapi" to if (!isFabric) null else fapi, - "yacl" to yaclVersion, + "yacl" to if (!isFabric) null else yacl, "modmenu" to if (!isFabric) null else modmenu, "repo" to githubRepo, "icon" to icon, @@ -138,12 +137,12 @@ tasks { } withType { - options.release = javaVersion.toInt() + options.release = javaVersion } withType { compilerOptions { - jvmTarget = JvmTarget.fromTarget(javaVersion) + jvmTarget = JvmTarget.fromTarget(javaVersion.toString()) } } } @@ -178,11 +177,10 @@ publishMods { requires { slug = "fabric-api" } requires { slug = "fabric-language-kotlin" } optional { slug = "modmenu" } + if (stonecutter.compare(mcVersion, "1.20.1") >= 0) requires { slug = "yacl" } } else { - requires { slug = "kotlin-for-forge" } + requires { slug = "kotlin-lang-forge" } } - - if (stonecutter.compare(mcVersion, "1.20.1") >= 0) requires { slug = "yacl" } } github { diff --git a/changelog.md b/changelog.md index 38aeb58..5ac6e2e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,2 +1,3 @@ -- add option to change the detection range of collisions - - automatically set to 0.5 blocks \ No newline at end of file +- migrate to kotlin-lang-forge +- migrate all network namespaces from 'better-boat-movement' to 'bbm' +- remove config from forge environments \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4d4f57c..59b4d7d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,9 +1,9 @@ [versions] -kotlin = "2.0.20" +kotlin = "2.0.21" mod-publish = "0.5.+" architectury-loom = "1.7-SNAPSHOT" -fabric-loader = "0.16.4" -fabric-language-kotlin = "1.12.1+kotlin." +fabric-loader = "0.16.7" +fabric-language-kotlin = "1.12.3+kotlin." vineflower = "1.10.1" konfig = "2.0.2-1.20.4" mixinextras = "0.4.1" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0aaefbc..df97d72 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-8.10.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/kotlin/dev/nyon/bbm/BetterBoatMovementEntrypoint.kt b/src/main/kotlin/dev/nyon/bbm/BetterBoatMovementEntrypoint.kt index ea1371a..da15f95 100644 --- a/src/main/kotlin/dev/nyon/bbm/BetterBoatMovementEntrypoint.kt +++ b/src/main/kotlin/dev/nyon/bbm/BetterBoatMovementEntrypoint.kt @@ -53,17 +53,15 @@ object BetterBoatMovementEntrypoint : ModInitializer { } /*?} else if neoforge {*/ -/*import dev.nyon.bbm.config.generateYaclScreen +/*import dev.nyon.klf.MOD_BUS import net.minecraft.server.level.ServerPlayer import net.neoforged.api.distmarker.Dist -import net.neoforged.fml.ModLoadingContext import net.neoforged.fml.common.Mod import net.neoforged.fml.loading.FMLLoader +import net.neoforged.neoforge.common.NeoForge import net.neoforged.neoforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent import net.neoforged.neoforge.event.entity.player.PlayerEvent.PlayerLoggedOutEvent import net.neoforged.neoforge.network.PacketDistributor -import thedarkcolour.kotlinforforge.neoforge.forge.DIST -import thedarkcolour.kotlinforforge.neoforge.forge.FORGE_BUS /^? if >=1.20.5 {^/ import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent @@ -72,9 +70,6 @@ import net.neoforged.neoforge.network.handling.DirectionalPayloadHandler /^import net.neoforged.neoforge.network.event.RegisterPayloadHandlerEvent import net.minecraft.network.FriendlyByteBuf ^//^?}^/ -import thedarkcolour.kotlinforforge.neoforge.forge.MOD_BUS - -typealias CSF = /^? if <1.20.5 {^/ /^net.neoforged.neoforge.client.ConfigScreenHandler.ConfigScreenFactory ^//^?} else {^/ net.neoforged.neoforge.client.gui.IConfigScreenFactory /^?}^/ @Mod("bbm") object BetterBoatMovementEntrypoint { @@ -83,7 +78,7 @@ object BetterBoatMovementEntrypoint { /^? if >=1.20.5 {^/ MOD_BUS.addListener { event -> - val registrar = event.registrar("4") + val registrar = event.registrar("bbm").versioned("4") registrar.playToClient(Config.packetType, Config.codec, DirectionalPayloadHandler( { config, _ -> serverConfig = config @@ -92,17 +87,17 @@ object BetterBoatMovementEntrypoint { } /^?} else {^/ /^MOD_BUS.addListener { event -> - val registrar = event.registrar("4") + val registrar = event.registrar("bbm").versioned("4") registrar.play(Config.identifier, FriendlyByteBuf.Reader{ buf -> Config(buf) }) { handler -> handler.client { config, _ -> serverConfig = config }.server { _, _ -> } } } ^//^?}^/ - when (DIST) { + when (FMLLoader.getDist()) { Dist.DEDICATED_SERVER -> { serverConfig = config - FORGE_BUS.addListener { event -> + NeoForge.EVENT_BUS.addListener { event -> val player = event.entity if (player !is ServerPlayer) return@addListener /^? if >=1.20.5 {^/ PacketDistributor.sendToPlayer(player, serverConfig!!) @@ -111,33 +106,25 @@ object BetterBoatMovementEntrypoint { } Dist.CLIENT -> { - FORGE_BUS.addListener { + NeoForge.EVENT_BUS.addListener { serverConfig = null } } else -> {} } - - ModLoadingContext.get().registerExtensionPoint(CSF::class.java) { - CSF { _, parent -> generateYaclScreen(parent) } - } } } *//*?} else {*/ -/*import dev.nyon.bbm.config.generateYaclScreen -import dev.nyon.bbm.extensions.resourceLocation +/*import dev.nyon.bbm.extensions.resourceLocation import net.minecraft.server.level.ServerPlayer import net.minecraftforge.api.distmarker.Dist -import net.minecraftforge.client.ConfigScreenHandler.ConfigScreenFactory +import net.minecraftforge.common.MinecraftForge import net.minecraftforge.event.entity.player.PlayerEvent -import net.minecraftforge.fml.ModLoadingContext import net.minecraftforge.fml.common.Mod import net.minecraftforge.fml.loading.FMLLoader import net.minecraftforge.network.NetworkDirection import net.minecraftforge.network.NetworkRegistry import net.minecraftforge.network.PacketDistributor -import thedarkcolour.kotlinforforge.forge.DIST -import thedarkcolour.kotlinforforge.forge.FORGE_BUS import java.util.* @Mod("bbm") @@ -145,7 +132,7 @@ object BetterBoatMovementEntrypoint { init { instantiateConfig(FMLLoader.getGamePath().resolve("config/better-boat-movement.json")) - val channel = NetworkRegistry.newSimpleChannel(resourceLocation("better-boat-movement:channel"), { "4" }, { true }, { true }) + val channel = NetworkRegistry.newSimpleChannel(resourceLocation("bbm:channel"), { "4" }, { true }, { true }) channel.registerMessage( 0, Config::class.java, @@ -158,10 +145,10 @@ object BetterBoatMovementEntrypoint { Optional.of(NetworkDirection.PLAY_TO_CLIENT) ) - when (DIST) { + when (FMLLoader.getDist()) { Dist.DEDICATED_SERVER -> { serverConfig = config - FORGE_BUS.addListener { event -> + MinecraftForge.EVENT_BUS.addListener { event -> val player = event.entity if (player !is ServerPlayer) return@addListener channel.send(PacketDistributor.PLAYER.with { player }, serverConfig) @@ -169,20 +156,13 @@ object BetterBoatMovementEntrypoint { } Dist.CLIENT -> { - FORGE_BUS.addListener { + MinecraftForge.EVENT_BUS.addListener { serverConfig = null } } else -> {} } - - // yacl 1.20.1 forge doesn't contain kotlin dsl - /^? if >1.20.1 {^/ - /^ModLoadingContext.get().registerExtensionPoint(ConfigScreenFactory::class.java) { - ConfigScreenFactory { _, parent -> generateYaclScreen(parent) } - } - ^//^?}^/ } } *//*?}*/ diff --git a/src/main/kotlin/dev/nyon/bbm/config/Config.kt b/src/main/kotlin/dev/nyon/bbm/config/Config.kt index 0ee4046..30af7b2 100644 --- a/src/main/kotlin/dev/nyon/bbm/config/Config.kt +++ b/src/main/kotlin/dev/nyon/bbm/config/Config.kt @@ -24,7 +24,7 @@ data class Config( ) : CustomPacketPayload { companion object { @Transient - val packetType: CustomPacketPayload.Type = CustomPacketPayload.Type(resourceLocation("better-boat-movement:sync")!!) + val packetType: CustomPacketPayload.Type = CustomPacketPayload.Type(resourceLocation("bbm:sync")!!) @Transient @Suppress("unused") @@ -81,7 +81,7 @@ data class Config( companion object { @Transient val packetType: PacketType = PacketType.create( - resourceLocation("better-boat-movement:sync")!! + resourceLocation("bbm:sync")!! ) { buffer -> Config( buffer.readFloat(), @@ -128,7 +128,7 @@ data class Config( ) : CustomPacketPayload { companion object { @Transient - val identifier = resourceLocation("better-boat-movement:sync")!! + val identifier = resourceLocation("bbm:sync")!! } constructor(buf: FriendlyByteBuf) : this( diff --git a/src/main/kotlin/dev/nyon/bbm/config/ConfigScreen.kt b/src/main/kotlin/dev/nyon/bbm/config/ConfigScreen.kt index bc21881..9ded61b 100644 --- a/src/main/kotlin/dev/nyon/bbm/config/ConfigScreen.kt +++ b/src/main/kotlin/dev/nyon/bbm/config/ConfigScreen.kt @@ -1,5 +1,6 @@ package dev.nyon.bbm.config +/*? if fabric && >=1.20.1 {*/ import dev.isxander.yacl3.dsl.* import dev.nyon.konfig.config.saveConfig import net.minecraft.client.gui.screens.Screen @@ -72,4 +73,5 @@ fun generateYaclScreen(parent: Screen?): Screen = YetAnotherConfigLib("bbm") { } save { saveConfig(config) } -}.generateScreen(parent) \ No newline at end of file +}.generateScreen(parent) +/*?}*/ \ No newline at end of file diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 4bf0ca3..23db481 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,6 +1,6 @@ -modLoader = "kotlinforforge" +modLoader = "klf" loaderVersion = "[1,)" -license = "LGPLv3" +license = "GPLv3" issueTrackerURL = "https://github.com/${repo}/issues" diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml index b35c348..fca46f5 100644 --- a/src/main/resources/META-INF/neoforge.mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -1,6 +1,6 @@ -modLoader = "kotlinforforge" +modLoader = "klf" loaderVersion = "[1,)" -license = "GNU General Public License v3.0" +license = "GPLv3" issueTrackerURL = "https://github.com/${repo}/issues" diff --git a/stonecutter.gradle.kts b/stonecutter.gradle.kts index 8900aa9..580d134 100644 --- a/stonecutter.gradle.kts +++ b/stonecutter.gradle.kts @@ -66,7 +66,7 @@ tasks.register("postUpdate") { color = color, fields = listOf( Field( - "Supported versions", stonecutter.versions.map { it.version }.toSet().joinToString(), false + "Supported versions", stonecutter.projects.map { it.property("vers.supportedMcVersions").toString().split(',') }.flatten().toSet().joinToString(), false ), Field( "Supported loaders", supportedLoaders.joinToString(), false diff --git a/versions/1.19.4-fabric/gradle.properties b/versions/1.19.4-fabric/gradle.properties index 8da4fa7..71ac6dd 100644 --- a/versions/1.19.4-fabric/gradle.properties +++ b/versions/1.19.4-fabric/gradle.properties @@ -1,10 +1,10 @@ vers.mcVersion=1.19.4 vers.mcVersionRange=>=1.19.3 vers.supportedMcVersions=1.19.3,1.19.4 + vers.deps.quiltmappings=1.19.4+build.9 vers.deps.fapi=0.87.2+1.19.4 vers.deps.yacl=3.5.0+1.20.1-fabric vers.deps.modMenu=7.2.2 -vers.javaVer=17 loom.platform=fabric \ No newline at end of file diff --git a/versions/1.19.4-forge/gradle.properties b/versions/1.19.4-forge/gradle.properties index 63df250..7f84840 100644 --- a/versions/1.19.4-forge/gradle.properties +++ b/versions/1.19.4-forge/gradle.properties @@ -1,10 +1,8 @@ vers.mcVersion=1.19.4 vers.mcVersionRange=>=1.19.3 vers.supportedMcVersions=1.19.3,1.19.4 + vers.deps.quiltmappings=1.19.4+build.9 vers.deps.fml=45.3.3 -vers.deps.yacl=3.5.0+1.20.1-forge -vers.deps.kff=4.11.0 -vers.javaVer=17 loom.platform=forge \ No newline at end of file diff --git a/versions/1.20.1-fabric/gradle.properties b/versions/1.20.1-fabric/gradle.properties index ca9c598..dfedccc 100644 --- a/versions/1.20.1-fabric/gradle.properties +++ b/versions/1.20.1-fabric/gradle.properties @@ -1,10 +1,10 @@ vers.mcVersion=1.20.1 vers.mcVersionRange=>=1.20 vers.supportedMcVersions=1.20,1.20.1,1.20.2 + vers.deps.quiltmappings=1.20.1+build.9 vers.deps.fapi=0.92.2+1.20.1 vers.deps.yacl=3.5.0+1.20.1-fabric vers.deps.modMenu=7.2.2 -vers.javaVer=17 loom.platform=fabric \ No newline at end of file diff --git a/versions/1.20.1-forge/gradle.properties b/versions/1.20.1-forge/gradle.properties index c065cee..1f055d3 100644 --- a/versions/1.20.1-forge/gradle.properties +++ b/versions/1.20.1-forge/gradle.properties @@ -1,10 +1,8 @@ vers.mcVersion=1.20.1 vers.mcVersionRange=>=1.20 vers.supportedMcVersions=1.20,1.20.1,1.20.2 + vers.deps.quiltmappings=1.20.1+build.9 vers.deps.fml=47.2.16 -vers.deps.yacl=3.5.0+1.20.1-forge -vers.deps.kff=4.11.0 -vers.javaVer=17 loom.platform=forge \ No newline at end of file diff --git a/versions/1.20.4-fabric/gradle.properties b/versions/1.20.4-fabric/gradle.properties index c2aa642..87ca233 100644 --- a/versions/1.20.4-fabric/gradle.properties +++ b/versions/1.20.4-fabric/gradle.properties @@ -1,10 +1,10 @@ vers.mcVersion=1.20.4 vers.mcVersionRange=>=1.20.3 -vers.supportedMcVersions=1.20.4 +vers.supportedMcVersions=1.20.3,1.20.4 + vers.deps.quiltmappings=1.20.4+build.3 vers.deps.fapi=0.97.1+1.20.4 vers.deps.yacl=3.5.0+1.20.4-fabric vers.deps.modMenu=9.2.0-beta.2 -vers.javaVer=17 loom.platform=fabric \ No newline at end of file diff --git a/versions/1.20.4-neoforge/gradle.properties b/versions/1.20.4-neoforge/gradle.properties index 5188b4e..f674dfb 100644 --- a/versions/1.20.4-neoforge/gradle.properties +++ b/versions/1.20.4-neoforge/gradle.properties @@ -1,10 +1,8 @@ vers.mcVersion=1.20.4 vers.mcVersionRange=>=1.20.3 -vers.supportedMcVersions=1.20.4 +vers.supportedMcVersions=1.20.3,1.20.4 + vers.deps.quiltmappings=1.20.4+build.3 vers.deps.fml=20.4.237 -vers.deps.yacl=3.5.0+1.20.4-neoforge -vers.deps.kff=4.11.0 -vers.javaVer=17 loom.platform=neoforge \ No newline at end of file diff --git a/versions/1.20.6-fabric/gradle.properties b/versions/1.20.6-fabric/gradle.properties index 9be8ff5..38647be 100644 --- a/versions/1.20.6-fabric/gradle.properties +++ b/versions/1.20.6-fabric/gradle.properties @@ -6,6 +6,5 @@ vers.deps.quiltmappings=1.20.6+build.6 vers.deps.fapi=0.100.8+1.20.6 vers.deps.yacl=3.5.0+1.20.6-fabric vers.deps.modMenu=10.0.0-beta.1 -vers.javaVer=21 loom.platform=fabric \ No newline at end of file diff --git a/versions/1.20.6-neoforge/gradle.properties b/versions/1.20.6-neoforge/gradle.properties index bbbbbbc..d388c75 100644 --- a/versions/1.20.6-neoforge/gradle.properties +++ b/versions/1.20.6-neoforge/gradle.properties @@ -4,9 +4,5 @@ vers.supportedMcVersions=1.20.5,1.20.6 vers.deps.quiltmappings=1.20.6+build.6 vers.deps.fml=20.6.121 -vers.deps.yacl=3.5.0+1.20.6-neoforge -vers.deps.kff=5.4.0 - -vers.javaVer=21 loom.platform=neoforge \ No newline at end of file diff --git a/versions/1.21-fabric/gradle.properties b/versions/1.21-fabric/gradle.properties index 18b8322..79c2133 100644 --- a/versions/1.21-fabric/gradle.properties +++ b/versions/1.21-fabric/gradle.properties @@ -7,6 +7,4 @@ vers.deps.fapi=0.100.8+1.21 vers.deps.yacl=3.5.0+1.21-fabric vers.deps.modMenu=11.0.0-beta.1 -vers.javaVer=21 - loom.platform=fabric \ No newline at end of file diff --git a/versions/1.21-neoforge/gradle.properties b/versions/1.21-neoforge/gradle.properties index baf8501..448a56f 100644 --- a/versions/1.21-neoforge/gradle.properties +++ b/versions/1.21-neoforge/gradle.properties @@ -4,9 +4,5 @@ vers.supportedMcVersions=1.21,1.21.1 vers.deps.quiltmappings=1.21+build.9 vers.deps.fml=21.0.167 -vers.deps.yacl=3.5.0+1.21-neoforge -vers.deps.kff=5.4.0 - -vers.javaVer=21 loom.platform=neoforge \ No newline at end of file