Switch to architectury-loom 1.7, fix the port to 1.21

Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404-59 2025-02-02 18:26:19 +01:00
parent 6535278331
commit dc286683a5
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
15 changed files with 34 additions and 17 deletions

View File

@ -17,7 +17,7 @@ plugins {
kotlin("plugin.serialization") version "2.0.0"
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("architectury-plugin") version "[3.4.160, 3.5["
id("dev.architectury.loom") version "1.9-SNAPSHOT" apply false
id("dev.architectury.loom") version "1.7-SNAPSHOT" apply false
id("com.github.ben-manes.versions") version "0.51.0"
id("net.kyori.indra.git") version "3.1.3"
id("org.cqfn.diktat.diktat-gradle-plugin") version "1.2.5"
@ -55,6 +55,10 @@ subprojects {
officialMojangMappings().parchment("org.parchmentmc.data:parchment-1.21:2024.06.23")
}
val refmap = "snowygui-${project.name}-refmap.json"
mixin {
useLegacyMixinAp = true
defaultRefmapName = refmap
}
}
apply(plugin = "com.github.johnrengelman.shadow")
val shadowC by configurations.creating
@ -200,8 +204,9 @@ allprojects {
"-opt-in=kotlin.RequiresOptIn", "-Xextended-compiler-checks", "-Xassertions=jvm", "-progressive"
)
jvmTarget = javaVer
languageVersion = (kotlinSplitVersion[0] + '.' + (kotlinSplitVersion[1].toShort() + 1).toString())
apiVersion = "${kotlinSplitVersion[0]}.${kotlinSplitVersion[1]}"
// Uncomment when updating to architectury-loom 1.9
//languageVersion = (kotlinSplitVersion[0] + '.' + (kotlinSplitVersion[1].toShort() + 1).toString())
//apiVersion = "${kotlinSplitVersion[0]}.${kotlinSplitVersion[1]}"
}
}
withType(JavaCompile::class) {
@ -228,7 +233,7 @@ allprojects {
"kotlinforforge" to rootProject.property("kotlinforforge"),
"clothconfig" to rootProject.property("clothconfig_version"),
"fabric_loader" to rootProject.property("fabric_loader_version"),
"forge_version" to rootProject.property("forge_version").toString().run { substring(0, this.lastIndexOf('.') + 1) }
"forge_version" to rootProject.property("forge_version")
)
inputs.properties(modProperties)
filesNotMatching(listOf("*.png")) {

View File

@ -1,4 +1,4 @@
architectury { common("fabric", "forge"); injectInjectables = false }
architectury { common("fabric", "neoforge"); injectInjectables = false }
dependencies {
modImplementation("net.fabricmc:fabric-loader:${rootProject.property("fabric_loader_version")}")
modImplementation("me.shedaniel.cloth:cloth-config:${rootProject.property("clothconfig_version")}") {

View File

@ -1,5 +1,6 @@
package fr.username404.snowygui.gui.elements
import com.mojang.blaze3d.vertex.BufferUploader
import com.mojang.blaze3d.vertex.DefaultVertexFormat
import com.mojang.blaze3d.vertex.VertexFormat
import fr.username404.snowygui.Snowy.Companion.MissingComponent
@ -92,11 +93,13 @@ class ClickBox(
addVertex(x, currentHeight, 0.0F).colorEnd()
addVertex(x + width + inclination, currentHeight, 0.0F).colorEnd()
addVertex(x + width + inclination, y + height, 0.0F).colorEnd()
BufferUploader.drawWithShader(buildOrThrow())
colorShader()
with(tessellator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR)) {
addVertex(x + inclination, y + height, 0.0F).colorEnd(Colors.WHITE_LINES.hexValue)
addVertex(x + width, y + height, 0.0F).colorEnd(Colors.WHITE_LINES.hexValue)
BufferUploader.drawWithShader(buildOrThrow())
}
}
endDraw()

View File

@ -1,6 +1,7 @@
package fr.username404.snowygui.utils
import com.mojang.blaze3d.systems.RenderSystem
import com.mojang.blaze3d.vertex.BufferUploader
import com.mojang.blaze3d.vertex.DefaultVertexFormat
import com.mojang.blaze3d.vertex.Tesselator
import com.mojang.blaze3d.vertex.VertexConsumer
@ -31,11 +32,12 @@ object RenderingUtil {
x: Double, y: Double, height: Int, width: Int,
color: Int = Colors.TRANSPARENT(), opacity: Float = 1F
): Unit = tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR).run {
fun VertexConsumer.colorEnd() = colorIt(color, opacity)
fun VertexConsumer.colorIt() = colorIt(color, opacity)
val x = x.toFloat() ; val y = y.toFloat()
addVertex(x, y + height, 0.0F).colorEnd()
addVertex(x + width, y + height, 0.0F).colorEnd()
addVertex(x + width, y, 0.0F).colorEnd()
addVertex(x, y, 0.0F).colorEnd()
addVertex(x, y + height, 0.0F).colorIt()
addVertex(x + width, y + height, 0.0F).colorIt()
addVertex(x + width, y, 0.0F).colorIt()
addVertex(x, y, 0.0F).colorIt()
BufferUploader.drawWithShader(buildOrThrow())
}
}

View File

@ -8,7 +8,7 @@ org.gradle.unsafe.configuration-cache=on
org.gradle.vfs.watch=true
minecraft=1.21
forge_version=21.0.0-beta
forge_version=21.0.143
kotlinforforge=5.4.0
kotlinVer=2.0.0
kotlin_coroutines_version=1.7.1

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-milestone-3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -1,4 +1,4 @@
architectury { platformSetupLoomIde(); forge() }
architectury { platformSetupLoomIde(); neoForge() }
repositories {
maven(url = "https://maven.neoforged.net/releases/")
maven(url = "https://thedarkcolour.github.io/KotlinForForge/")
@ -12,8 +12,9 @@ dependencies {
implementation("thedarkcolour:kotlinforforge:${rootProject.property("kotlinforforge")}")
modApi("me.shedaniel.cloth:cloth-config-neoforge:${rootProject.property("clothconfig_version")}")
implementation(project(path = ":common", configuration = "namedElements")) { isTransitive = false }
add("developmentForge", project(path = ":common")) { isTransitive = false }
shadowC(project(path = ":common", configuration = "transformProductionForge")) { isTransitive = false }
add("developmentNeoForge", project(path = ":common")) { isTransitive = false }
shadowC(project(path = ":common", configuration = "transformProductionNeoForge")) { isTransitive = false }
}; loom {
runs {
val args: MutableList<String> = mutableListOf("-Dfml.earlyprogresswindow=false")

View File

@ -33,3 +33,9 @@ mandatory = true
versionRange = "[${minecraft_version},)"
ordering = "NONE"
side = "BOTH"
[[mixins]]
config = "snowygui-common.mixins.json"
[[mixins]]
config = "snowygui-neoforge.mixins.json"

View File

@ -11,7 +11,7 @@ pluginManagement {
include("common")
include("fabric")
include("forge")
include("neoforge")
rootProject.name = "SnowyGUI"