Add auto hotswap installer

This commit is contained in:
nea
2023-06-03 14:56:10 +02:00
parent 9477a32ad5
commit b3237fe53d
3 changed files with 48 additions and 24 deletions

View File

@@ -28,23 +28,6 @@ compileTestKotlin.kotlinOptions {
jvmTarget = "17"
}
loom {
clientOnlyMinecraftJar()
accessWidenerPath.set(project.file("src/main/resources/firmament.accesswidener"))
runs {
removeIf { it.name != "client" }
named("client") {
property("devauth.enabled", "true")
property("fabric.log.level", "info")
property("firmament.debug", "true")
/*
vmArg("-XX:+AllowEnhancedClassRedefinition")
vmArg("-XX:HotswapAgent=fatjar")
*/
}
}
}
repositories {
maven("https://maven.terraformersmc.com/releases/")
maven("https://maven.shedaniel.me")
@@ -59,6 +42,17 @@ repositories {
includeGroup("com.unascribed")
}
}
ivy("https://github.com/HotswapProjects/HotswapAgent/releases/download") {
patternLayout {
artifact("[revision]/[artifact]-[revision].[ext]")
}
content {
includeGroup("virtual.github.hotswapagent")
}
metadataSources {
artifact()
}
}
maven("https://server.bbkr.space/artifactory/libs-release")
maven("https://repo.nea.moe/releases")
mavenLocal()
@@ -72,6 +66,10 @@ val transInclude by configurations.creating {
isTransitive = true
}
val hotswap by configurations.creating {
isVisible = false
}
val nonModImplentation by configurations.creating {
extendsFrom(shadowMe)
configurations.implementation.get().extendsFrom(this)
@@ -82,6 +80,9 @@ dependencies {
"minecraft"(libs.minecraft)
"mappings"("net.fabricmc:yarn:${libs.versions.yarn.get()}:v2")
// Hotswap Dependency
hotswap(libs.hotswap)
// Fabric dependencies
modImplementation(libs.fabric.loader)
modImplementation(libs.fabric.kotlin)
@@ -123,22 +124,46 @@ dependencies {
version = rootProject.property("mod_version").toString()
group = rootProject.property("maven_group").toString()
loom {
clientOnlyMinecraftJar()
accessWidenerPath.set(project.file("src/main/resources/firmament.accesswidener"))
runs {
removeIf { it.name != "client" }
named("client") {
property("devauth.enabled", "true")
property("fabric.log.level", "info")
property("firmament.debug", "true")
vmArg("-ea")
vmArg("-XX:+AllowEnhancedClassRedefinition")
vmArg("-XX:HotswapAgent=external")
vmArg("-javaagent:${hotswap.resolve().single().absolutePath}")
}
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(17)
}
tasks.jar {
destinationDirectory.set(layout.buildDirectory.dir("badjars"))
archiveClassifier.set("slim")
}
tasks.shadowJar {
configurations = listOf(shadowMe)
archiveClassifier.set("dev-thicc")
archiveClassifier.set("")
relocate("io.github.moulberry.repo", "moe.nea.firmament.deps.repo")
}
tasks.remapJar {
destinationDirectory.set(layout.buildDirectory.dir("badjars"))
injectAccessWidener.set(true)
inputFile.set(tasks.shadowJar.flatMap { it.archiveFile })
dependsOn(tasks.shadowJar)
archiveClassifier.set("thicc")
archiveClassifier.set("dev")
}
tasks.processResources {
@@ -151,9 +176,6 @@ tasks.processResources {
filesMatching("**/fabric.mod.json") {
expand(*replacements.toTypedArray())
}
filesMatching("**/lang/*.json") {
// flattenJson(this)
}
from(tasks.scanLicenses)
}

View File

@@ -15,6 +15,7 @@ neurepoparser = "1.2.0"
qolify = "1.2.2-1.19.4"
citresewn = "1.1.3+1.19.4"
lib39 = "1.4.2"
hotswap_agent = "1.4.2-SNAPSHOT"
ncr = "Fabric-1.19.4-v2.1.1"
[libraries]
@@ -31,6 +32,7 @@ libgui = { module = "io.github.cottonmc:LibGui", version.ref = "libgui" }
lib39_core = { module = "com.unascribed:lib39-core", version.ref = "lib39" }
# Runtime:
hotswap = { module = "virtual.github.hotswapagent:hotswap-agent", version.ref = "hotswap_agent" }
architectury_fabric = { module = "dev.architectury:architectury-fabric", version.ref = "architectury" }
rei_fabric = { module = "me.shedaniel:RoughlyEnoughItems-fabric", version.ref = "rei" }
devauth = { module = "me.djtheredstoner:DevAuth-fabric", version.ref = "devauth" }

View File

@@ -4,9 +4,9 @@ import io.github.cottonmc.cotton.gui.client.BackgroundPainter
import io.github.cottonmc.cotton.gui.widget.TooltipBuilder
import io.github.cottonmc.cotton.gui.widget.WGridPanel
import io.github.cottonmc.cotton.gui.widget.WItem
import io.github.cottonmc.cotton.gui.widget.WScrollPanel
import io.github.cottonmc.cotton.gui.widget.WText
import io.github.cottonmc.cotton.gui.widget.WWidget
import io.github.cottonmc.cotton.gui.widget.data.InputResult
import io.github.cottonmc.cotton.gui.widget.data.Insets
import io.github.cottonmc.cotton.gui.widget.icon.Icon
import io.github.cottonmc.cotton.gui.widget.icon.ItemIcon
@@ -14,9 +14,9 @@ import net.minecraft.client.item.TooltipContext
import net.minecraft.client.util.math.MatrixStack
import net.minecraft.item.Items
import net.minecraft.text.Text
import moe.nea.firmament.gui.WFixedPanel
import moe.nea.firmament.gui.WTightScrollPanel
import moe.nea.firmament.rei.SBItemStack
import moe.nea.firmament.util.MC
object PetsPage : ProfilePage {
override fun getElements(profileViewer: ProfileViewer): WWidget {