Setup fabric-language-kotlin and kotlinforforge

This commit is contained in:
Username404-59 2021-05-03 10:27:38 +02:00
parent 9da9c46c88
commit 481ebb1b60
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
7 changed files with 23 additions and 17 deletions

View File

@ -77,15 +77,12 @@ subprojects {
refmapName = "snowygui-common-refmap.json"
}
dependencies {
shadowC(kotlin("stdlib-jdk8") as String) {
exclude(module = "kotlin-stdlib-common")
exclude(module = "annotations")
}
implementation("$kotlinX:kotlinx-coroutines-core:1.4.0")
listOf(
"$kotlinX:kotlinx-coroutines-core:1.5.0-RC",
"$kotlinX:kotlinx-datetime:0.2.0",
"com.typesafe:config:1.4.1",
"io.github.config4k:config4k:0.4.2"
).forEach { implementation(it); shadowC(it) }
).forEach { implementation(it); shadowC(it) { isTransitive = false } }
"minecraft"("com.mojang:minecraft:${rootProject.property("minecraft")}")
"mappings"(mappingsDep)
}
@ -96,7 +93,7 @@ allprojects {
apply(plugin = "java")
apply(plugin = "architectury-plugin")
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("stdlib-jdk8", "1.4.30"))
}
java {
targetCompatibility = JavaVersion.VERSION_1_8
@ -104,7 +101,7 @@ allprojects {
}
tasks {
withType(ShadowJar::class) {
relocate("kotlin", "${rootProject.group}.kotlin")
relocate("kotlinx", "${rootProject.group}.kotlinx")
relocate("org.jetbrains", "${rootProject.group}.jetbrainslibs")
relocate("com.typesafe.config", "${rootProject.group}.typesafe.config")
relocate("io.github.config4k", "${rootProject.group}.config4k")
@ -122,7 +119,7 @@ allprojects {
freeCompilerArgs = listOf("-Xjvm-default=all", "-Xlambdas=indy")
jvmTarget = "1.8"
languageVersion = "1.5"
apiVersion = "1.5"
apiVersion = "1.4"
}
}
withType(JavaCompile::class) {

View File

@ -17,6 +17,7 @@ dependencies {
include(modApi("${Groups.FabricApi}:fabric-rendering-v1:${rootProject.property("fabric_rendering_api_version")}")!!)
include(modApi("${Groups.FabricApi}:fabric-api-base:${rootProject.property("fabric_api_base_version")}")!!)
include(modRuntime("${Groups.FabricApi}:fabric-resource-loader-v0:${rootProject.property("fabric_resource_loader_version")}")!!)
modImplementation(group = "net.fabricmc", name = "fabric-language-kotlin", version = "1.5.0+kotlin.1.4.31")
modRuntime(modCompileOnly("com.terraformersmc:modmenu:${rootProject.property("modmenu_version")}") {
exclude(group = Groups.FabricApi, module = "fabric-api-base")
exclude(group = Groups.FabricApi, module = "fabric-resource-loader-v0")

View File

@ -7,7 +7,7 @@ import net.fabricmc.api.ClientModInitializer
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback.EVENT
class FabricInit: Snowy(), ClientModInitializer {
object FabricInit: Snowy(), ClientModInitializer {
override fun onInitializeClient() {
atInit()
EVENT.register(

View File

@ -18,7 +18,10 @@
"environment": "client",
"entrypoints": {
"client": [
"${mod_group}.snowygui.fabric.FabricInit"
{
"adapter": "kotlin",
"value": "${mod_group}.snowygui.fabric.FabricInit"
}
],
"modmenu": [
"${mod_group}.snowygui.fabric.ModMenuConf"
@ -29,6 +32,7 @@
],
"depends": {
"fabricloader": ">=0.9.3",
"fabric-language-kotlin": ">=1.4.0+build.1",
"fabric-resource-loader-v0": "*",
"fabric-rendering-v1": "*",
"minecraft": ">=${minecraft_version}"

View File

@ -1,6 +1,10 @@
architectury { platformSetupLoomIde(); forge() }
repositories {
maven(url = "https://thedarkcolour.github.io/KotlinForForge/")
}
dependencies {
forge("net.minecraftforge:forge:${rootProject.architectury.minecraft}-${rootProject.property("forge_version")}.+")
modImplementation("thedarkcolour:kotlinforforge:1.9.0")
implementation(project(path = ":common")) { isTransitive = false }
add("developmentForge", project(path = ":common")) { isTransitive = false }
shadowC(project(path = ":common", configuration = "transformProductionForge")) { isTransitive = false }

View File

@ -3,10 +3,10 @@ package fr.username404.snowygui.forge
import fr.username404.snowygui.Snowy
import fr.username404.snowygui.config.SnowyConfigScreen
import net.minecraftforge.fml.ExtensionPoint
import net.minecraftforge.fml.ModLoadingContext
import net.minecraftforge.fml.common.Mod
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
import thedarkcolour.kotlinforforge.forge.LOADING_CONTEXT
import thedarkcolour.kotlinforforge.forge.MOD_BUS
import java.util.function.BiFunction
import java.util.function.Supplier
@ -15,7 +15,7 @@ import java.util.function.Supplier
class ForgeInit: Snowy() {
private fun initSetup(event: FMLClientSetupEvent) = atInit()
private fun configSetup(event: FMLClientSetupEvent) {
ModLoadingContext.get().registerExtensionPoint(
LOADING_CONTEXT.registerExtensionPoint(
ExtensionPoint.CONFIGGUIFACTORY,
Supplier {
return@Supplier BiFunction { mc, screen ->
@ -27,7 +27,7 @@ class ForgeInit: Snowy() {
)
}
init {
with(FMLJavaModLoadingContext.get().modEventBus) {
with(MOD_BUS) {
addListener(this@ForgeInit::initSetup)
addListener(this@ForgeInit::configSetup)
}

View File

@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[1.7.0,)"
modLoader = "kotlinforforge"
loaderVersion = "[1.9,)"
issueTrackerURL = "https://gits.username404.fr/Username404-59/SnowyGUI/issues"
license = "MPL-2.0"