update plugin, add game remapping

This commit is contained in:
moehreag 2024-05-13 13:21:37 +02:00
parent 1e4b950c30
commit e7974cd487
4 changed files with 14 additions and 7 deletions

View file

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration"> <component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" /> <file type="web" url="file://$PROJECT_DIR$" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="temurin-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

View file

@ -9,12 +9,12 @@ version = "1.0.0"
repositories { repositories {
mavenCentral() mavenCentral()
maven { mavenLocal()
url = uri("https://libraries.minecraft.net/")
}
} }
dependencies { dependencies {
//implementation(files("mojmap-patcher-1.0.0-SNAPSHOT.jar"))
implementation("org.ecorous.esnesnon:mojmap-patcher:1.0.0-SNAPSHOT")
implementation("com.google.code.gson:gson:2.10.1") implementation("com.google.code.gson:gson:2.10.1")
testImplementation(kotlin("test")) testImplementation(kotlin("test"))
} }
@ -32,7 +32,7 @@ tasks.test {
useJUnitPlatform() useJUnitPlatform()
} }
kotlin { kotlin {
jvmToolchain(17) jvmToolchain(21)
} }
publishing { publishing {

View file

@ -1,5 +1,5 @@
plugins { plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
} }
rootProject.name = "nonsense-gradle" rootProject.name = "nonsense-gradle"

View file

@ -1,7 +1,9 @@
package org.ecorous.esnesnon.gradle.ext package org.ecorous.esnesnon.gradle.ext
import org.ecorous.esnesnon.gradle.VersionChecker import org.ecorous.esnesnon.gradle.VersionChecker
import org.ecorous.esnesnon.mojmap_patcher.MojMapPatcher
import org.gradle.api.Project import org.gradle.api.Project
import kotlin.io.path.notExists
fun Project.minecraft(version: String) { fun Project.minecraft(version: String) {
if (VersionChecker.validateVersion(version)) { if (VersionChecker.validateVersion(version)) {
@ -12,11 +14,15 @@ fun Project.minecraft(version: String) {
println("Downloading client...") println("Downloading client...")
val clientJar = VersionChecker.downloadClient(version, gradle.gradleUserHomeDir) val clientJar = VersionChecker.downloadClient(version, gradle.gradleUserHomeDir)
println("Downloaded client!") println("Downloaded client!")
val remappedJar = clientJar.resolveSibling("client-$version-remapped.jar")
println("Time to setup Minecraft!") println("Time to setup Minecraft!")
if (remappedJar.notExists()) {
MojMapPatcher.run(version, clientJar, remappedJar)
}
VersionChecker.getDependencies(version){ VersionChecker.getDependencies(version){
dependencies.add("implementation", it) dependencies.add("implementation", it)
} }
dependencies.add("implementation", files(clientJar)) dependencies.add("implementation", files(remappedJar))
} else { } else {
println("Invalid version! $version") println("Invalid version! $version")
error("Invalid minecraft version provided: $version") error("Invalid minecraft version provided: $version")