using back .kts gradle as why not

This commit is contained in:
NK 2023-03-06 21:33:16 +00:00
parent 63068bdd53
commit 1d17063838
8 changed files with 212 additions and 142 deletions

View file

@ -1,134 +0,0 @@
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "https://files.minecraftforge.net/maven"
}
maven { url "https://jitpack.io" }
maven { url "https://repo.spongepowered.org/repository/maven-public/" }
}
dependencies {
classpath "com.github.Skytils:ForgeGradle:41dfce0a70"
classpath "com.github.jengelman.gradle.plugins:shadow:6.1.0"
classpath "com.github.debuggingss:MixinGradle:0.6-SNAPSHOT"
}
}
apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "org.spongepowered.mixin"
version = "1.0.25"
group = "me.night0721.lilase"
archivesBaseName = "Lilase"
compileJava.options.encoding = "UTF-8"
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = "1.8"
sourceSets {
main {
output.resourcesDir = java.outputDir
}
}
minecraft {
version = "1.8.9-11.15.1.2318-1.8.9"
runDir = "run"
mappings = "stable_22"
makeObfSourceJar = false
clientRunArgs += "--mixin mixins.lilase.json"
clientRunArgs += "--tweakClass cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker"
}
configurations {
include
implementation.extendsFrom(include)
}
repositories {
maven { url = "https://repo.sk1er.club/repository/maven-public" }
maven { url = "https://jitpack.io/" }
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
maven { url = 'https://repo.polyfrost.cc/releases' }
mavenCentral()
}
dependencies {
implementation('org.spongepowered:mixin:0.7.11-SNAPSHOT')
annotationProcessor('org.spongepowered:mixin:0.7.11-SNAPSHOT')
compileOnly('cc.polyfrost:oneconfig-1.8.9-forge:0.2.0-alpha+')
include('cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta+')
}
mixin {
add sourceSets.main, "mixins.lilase.refmap.json"
defaultObfuscationEnv searge
}
jar {
manifest.attributes(
"FMLCorePluginContainsFMLMod": true,
"FMLCorePlugin": "me.night0721.lilase.mixins.MixinLoader",
"ForceLoadAsMod": true,
"ModSide": "CLIENT",
"TweakClass": "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker",
"TweakOrder": "0",
"MixinConfigs": "mixins.lilase.json",
)
enabled = false
}
sourceJar {
enabled = false
}
shadowJar {
archiveClassifier.set("")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
configurations = [project.configurations.include]
exclude "LICENSE.md"
exclude "pack.mcmeta"
exclude "dummyThing"
exclude "**/module-info.class"
exclude "*.so"
exclude "*.dylib"
exclude "*.dll"
exclude "*.jnilib"
exclude "ibxm/**"
exclude "com/jcraft/**"
exclude "org/lwjgl/**"
exclude "net/java/**"
exclude "META-INF/proguard/**"
exclude "META-INF/maven/**"
exclude "META-INF/versions/**"
exclude "META-INF/com.android.tools/**"
exclude "fabric.mod.json"
archiveFileName = "Lilase.jar"
}
reobfJar.dependsOn tasks.shadowJar
reobf {
shadowJar {
classpath = sourceSets.main.compileClasspath
}
}
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
filesMatching("mcmod.info") {
expand(
"version": project.version,
"mcversion": project.minecraft.version
)
}
}
sourceSets { main { output.resourcesDir = java.classesDirectory } }

149
build.gradle.kts Normal file
View file

@ -0,0 +1,149 @@
@file:Suppress("UnstableApiUsage")
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import gg.essential.gradle.util.noServerRunConfigs
plugins {
id("gg.essential.multi-version")
id("gg.essential.defaults.repo")
id("gg.essential.defaults.java")
id("gg.essential.defaults.loom")
id("com.github.johnrengelman.shadow")
id("net.kyori.blossom") version "1.3.0"
id("io.github.juuxel.loom-quiltflower-mini")
id("signing")
java
}
val mod_name: String by project
val mod_version: String by project
val mod_id: String by project
preprocess {
vars.put("MODERN", if (project.platform.mcMinor >= 16) 1 else 0)
}
blossom {
replaceToken("@VER@", mod_version)
replaceToken("@NAME@", mod_name)
replaceToken("@ID@", mod_id)
}
version = mod_version
group = "me.night0721"
base {
archivesName.set(mod_name)
}
loom {
noServerRunConfigs()
if (project.platform.isLegacyForge) {
launchConfigs.named("client") {
arg("--tweakClass", "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker")
property("mixin.debug.export", "true")
}
}
if (project.platform.isForge) {
forge {
mixinConfig("mixins.${mod_id}.json")
}
}
mixin.defaultRefmapName.set("mixins.${mod_id}.refmap.json")
}
val shade: Configuration by configurations.creating {
configurations.implementation.get().extendsFrom(this)
}
//sourceSets {
// main {
// output.setResourcesDir(java.outputDir)
// }
//}
repositories {
maven("https://repo.polyfrost.cc/releases")
}
dependencies {
compileOnly("cc.polyfrost:oneconfig-$platform:0.2.0-alpha+")
if (platform.isLegacyForge) {
compileOnly("org.spongepowered:mixin:0.7.11-SNAPSHOT")
shade("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta+")
}
}
tasks.processResources {
inputs.property("id", mod_id)
inputs.property("name", mod_name)
val java = if (project.platform.mcMinor >= 18) {
17
} else {
if (project.platform.mcMinor == 17) 16 else 8
}
val compatLevel = "JAVA_${java}"
inputs.property("java", java)
inputs.property("java_level", compatLevel)
inputs.property("version", mod_version)
inputs.property("mcVersionStr", project.platform.mcVersionStr)
filesMatching(listOf("mcmod.info", "mixins.${mod_id}.json", "mods.toml")) {
expand(
mapOf(
"id" to mod_id,
"name" to mod_name,
"java" to java,
"java_level" to compatLevel,
"version" to mod_version,
"mcVersionStr" to project.platform.mcVersionStr
)
)
}
}
tasks {
withType(Jar::class.java) {
if (project.platform.isFabric) {
exclude("mcmod.info", "mods.toml")
} else {
exclude("fabric.mod.json")
if (project.platform.isLegacyForge) {
exclude("mods.toml")
} else {
exclude("mcmod.info")
}
}
named<ShadowJar>("shadowJar") {
archiveClassifier.set("dev")
configurations = listOf(shade)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveFileName.set("Lilase.jar")
}
remapJar {
input.set(shadowJar.get().archiveFile)
archiveClassifier.set("")
}
jar {
manifest {
attributes(
mapOf(
"FMLCorePluginContainsFMLMod" to true,
"FMLCorePlugin" to "me.night0721.lilase.mixins.MixinLoader",
"ForceLoadAsMod" to true,
"ModSide" to "CLIENT",
"TweakClass" to "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker",
"TweakOrder" to "0",
"MixinConfigs" to "mixins.${mod_id}.json"
)
)
}
dependsOn(shadowJar)
archiveClassifier.set("")
enabled = false
}
}
}
sourceSets {
main {
output.setResourcesDir(java.classesDirectory)
}
}

View file

@ -1 +1,11 @@
mod_name = Lilase
mod_id = lilase
mod_version = 1.0.26
essential.defaults.loom=0
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureoncommand=true
org.gradle.parallel.threads=4
org.gradle.jvmargs=-Xmx8G org.gradle.jvmargs=-Xmx8G

View file

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

10
root.gradle.kts Normal file
View file

@ -0,0 +1,10 @@
plugins {
kotlin("jvm") version "1.6.21" apply false
id("gg.essential.multi-version.root")
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
id("io.github.juuxel.loom-quiltflower-mini") version "171a6e2e49" apply false
}
preprocess {
"1.8.9-forge"(10809, "srg") {}
}

34
settings.gradle.kts Normal file
View file

@ -0,0 +1,34 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven("https://repo.polyfrost.cc/releases")
maven("https://maven.architectury.dev/")
}
plugins {
val egtVersion = "0.1.18"
id("gg.essential.multi-version.root") version egtVersion
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == "io.github.juuxel.loom-quiltflower-mini") {
useModule("com.github.wyvest:loom-quiltflower-mini:${requested.version}")
}
}
}
}
val mod_name: String by settings
rootProject.name = mod_name
rootProject.buildFileName = "root.gradle.kts"
listOf(
"1.8.9-forge"
).forEach { version ->
include(":$version")
project(":$version").apply {
projectDir = file("versions/$version")
buildFileName = "../../build.gradle.kts"
}
}

View file

@ -1,22 +1,22 @@
package me.night0721.lilase.gui; package me.night0721.lilase.gui;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.opengl.GL11;
import static me.night0721.lilase.Lilase.mc; import static me.night0721.lilase.Lilase.mc;
public class ImageRenderer { public class ImageRenderer {
public void draw() { public void draw() {
ScaledResolution scaledResolution = new ScaledResolution(mc);
GlStateManager.pushMatrix();
mc.getTextureManager().bindTexture(new ResourceLocation("lilase:images/crabby.png"));
// GlStateManager.color(CurrentColor.getFloatValue(0, 0), CurrentColor.getFloatValue(0, 1), CurrentColor.getFloatValue(0, 2)); // GlStateManager.color(CurrentColor.getFloatValue(0, 0), CurrentColor.getFloatValue(0, 1), CurrentColor.getFloatValue(0, 2));
Gui.drawModalRectWithCustomSizedTexture(scaledResolution.getScaledWidth() / 2 + 64, scaledResolution.getScaledHeight() / 2 + 64, 0, 0, 128, 32, 128, 32); GL11.glPushMatrix();
GlStateManager.popMatrix(); mc.getTextureManager().bindTexture(new ResourceLocation("lilase:lilase.png"));
// mc.getTextureManager().bindTexture(new ResourceLocation("lilase:textures/images/crabby.png"));
Gui.drawModalRectWithCustomSizedTexture(5, 5, 0, 0, 100, 100, 100, 100);
GL11.glPopMatrix();
} }
@SubscribeEvent @SubscribeEvent

1
versions/mainProject Normal file
View file

@ -0,0 +1 @@
1.8.9-forge