summaryrefslogtreecommitdiff
path: root/archenemyexample
diff options
context:
space:
mode:
Diffstat (limited to 'archenemyexample')
-rw-r--r--archenemyexample/build.gradle.kts164
-rw-r--r--archenemyexample/run/logs/latest.log60
-rw-r--r--archenemyexample/settings.gradle.kts6
-rw-r--r--archenemyexample/src/forgeMain/kotlin/moe/nea/aee/forge/Main.kt22
4 files changed, 151 insertions, 101 deletions
diff --git a/archenemyexample/build.gradle.kts b/archenemyexample/build.gradle.kts
index ca4313a..6f8a22f 100644
--- a/archenemyexample/build.gradle.kts
+++ b/archenemyexample/build.gradle.kts
@@ -1,100 +1,108 @@
import moe.nea.archenemy.MCSide
plugins {
- kotlin("multiplatform") version "1.9.22"
- id("moe.nea.archenemy.mojang")
+ kotlin("multiplatform") version "1.9.22"
+ id("moe.nea.archenemy.mojang")
}
repositories {
- mavenCentral()
- maven("https://maven.fabricmc.net")
- maven("https://repo.nea.moe/releases")
+ mavenCentral()
+ maven("https://maven.fabricmc.net")
+ maven("https://repo.nea.moe/releases")
mavenLocal()
}
kotlin.jvmToolchain(8)
val whateverAttribute = Attribute.of("whatever", String::class.java)
val allJvm by kotlin.sourceSets.creating {
- this.dependencies {
- }
+ this.dependencies {
+ }
}
val forge = kotlin.jvm("forge") {
- attributes.attribute(whateverAttribute, "forge")
- compilations.named("main").get().run {
- defaultSourceSet.dependsOn(allJvm)
- this.dependencies {
- val mcpMappings = mojang.yarnMappings(dependencies.create("moe.nea.mcp:mcp-yarn:1.8.9:v2"))
- val minecraftClient = mojang.minecraft("1.8.9", MCSide.CLIENT)
- val mappedClient = mojang.mapJar(minecraftClient, mcpMappings, "official", "named")
- implementation(mappedClient)
- implementation("net.minecraft:launchwrapper:1.12")
- mojang.libraries("1.8.9").forEach(::implementation)
- }
- }
+ attributes.attribute(whateverAttribute, "forge")
+ compilations.named("main").get().run {
+ defaultSourceSet.dependsOn(allJvm)
+ this.dependencies {
+ val mcpMappings = mojang.yarnMappings(dependencies.create("moe.nea.mcp:mcp-yarn:1.8.9:v2"))
+ val minecraftClient = mojang.minecraft("1.8.9", MCSide.CLIENT)
+ val mappedClient = mojang.mapJar(minecraftClient, mcpMappings, "official", "named")
+ implementation(mappedClient)
+ implementation("net.minecraft:launchwrapper:1.12")
+ mojang.libraries("1.8.9").forEach(::implementation)
+ }
+ }
}
val mainForge = forge.compilations.getByName("main")
val fabric = kotlin.jvm("fabric") {
- attributes.attribute(whateverAttribute, "fabric")
- compilations.named("main").get().run {
- defaultSourceSet.dependsOn(allJvm)
- this.dependencies {
- val minecraftClient = mojang.minecraft("1.20.2", MCSide.CLIENT)
- val minecraftServer = mojang.minecraft("1.20.2", MCSide.SERVER)
- val intermediaryMappings = mojang.intermediaryMappings("1.20.2")
- val yarnMappings = mojang.yarnMappings(dependencies.create("net.fabricmc:yarn:1.20.2+build.4:v2"))
- val intermediaryClient = mojang.mapJar(
- minecraftClient,
- intermediaryMappings,
- "official",
- "intermediary"
- )
- val intermediaryServer = mojang.mapJar(
- minecraftServer,
- intermediaryMappings,
- "official",
- "intermediary"
- )
- val thingy = mojang.mergeJar(
- intermediaryClient, intermediaryServer
- )
- implementation(
- mojang.mapJar(
- thingy,
- yarnMappings,
- "intermediary",
- "named"
- )
- )
- }
- }
+ attributes.attribute(whateverAttribute, "fabric")
+ compilations.named("main").get().run {
+ defaultSourceSet.dependsOn(allJvm)
+ this.dependencies {
+ val minecraftClient = mojang.minecraft("1.20.2", MCSide.CLIENT)
+ val minecraftServer = mojang.minecraft("1.20.2", MCSide.SERVER)
+ val intermediaryMappings = mojang.intermediaryMappings("1.20.2")
+ val yarnMappings = mojang.yarnMappings(dependencies.create("net.fabricmc:yarn:1.20.2+build.4:v2"))
+ val intermediaryClient = mojang.mapJar(
+ minecraftClient,
+ intermediaryMappings,
+ "official",
+ "intermediary"
+ )
+ val intermediaryServer = mojang.mapJar(
+ minecraftServer,
+ intermediaryMappings,
+ "official",
+ "intermediary"
+ )
+ val thingy = mojang.mergeJar(
+ intermediaryClient, intermediaryServer
+ )
+ implementation(
+ mojang.mapJar(
+ thingy,
+ yarnMappings,
+ "intermediary",
+ "named"
+ )
+ )
+ }
+ }
}
+
+
+
tasks.create("runForge189", JavaExec::class) {
- description = "Run Forge 1.8.9"
- group = ApplicationPlugin.APPLICATION_GROUP
- mainClass.set("net.minecraft.launchwrapper.Launch")
- val downloadTask = archenemyShared.getDownloadAssetsTask("1.8.9")
- dependsOn(downloadTask)
- classpath(mainForge.runtimeDependencyFiles, tasks.getByName("forgeJar"))
- javaLauncher.set(javaToolchains.launcherFor {
- this.languageVersion.set(JavaLanguageVersion.of(8))
- })
- val runFolder = project.file("run")
- runFolder.mkdirs()
- workingDir(runFolder)
- doFirst {
- args(
- "--assetDir",
- downloadTask.getAssetDir().absolutePath,
- "--assetIndex",
- downloadTask.getAssetIndex(),
- "--accessToken",
- "undefined",
- "--gameDir",
- runFolder.absolutePath,
- "--tweakClass",
- "moe.nea.aee.forge.Tweaker"
- )
- }
+ val extractNatives = mojang.natives("1.8.9")
+ dependsOn(extractNatives)
+ description = "Run Forge 1.8.9"
+ group = ApplicationPlugin.APPLICATION_GROUP
+ mainClass.set("net.minecraft.launchwrapper.Launch")
+ val downloadTask = archenemyShared.getDownloadAssetsTask("1.8.9")
+ dependsOn(downloadTask)
+ classpath(mainForge.runtimeDependencyFiles, tasks.getByName("forgeJar"))
+ javaLauncher.set(javaToolchains.launcherFor {
+ this.languageVersion.set(JavaLanguageVersion.of(8))
+ })
+ val runFolder = project.file("run")
+ runFolder.mkdirs()
+ workingDir(runFolder)
+ jvmArguments.add("-Djava.library.path=${extractNatives.getNativeDirectoryPath().absolutePath}")
+ doFirst {
+ args(
+ "--assetsDir",
+ downloadTask.getAssetDir().absolutePath,
+ "--assetIndex",
+ downloadTask.getAssetIndex().id,
+ "--accessToken",
+ "undefined",
+ "--gameDir",
+ runFolder.absolutePath,
+ "--tweakClass",
+ "moe.nea.aee.forge.Tweaker",
+ "--version",
+ "1.8.9"
+ )
+ }
}
diff --git a/archenemyexample/run/logs/latest.log b/archenemyexample/run/logs/latest.log
index 585e475..1b089e9 100644
--- a/archenemyexample/run/logs/latest.log
+++ b/archenemyexample/run/logs/latest.log
@@ -1,24 +1,44 @@
-[16:58:57] [main/INFO]: Loading tweak class name moe.nea.aee.forge.Tweaker
-[16:58:57] [main/INFO]: Using primary tweak class name moe.nea.aee.forge.Tweaker
-[16:58:57] [main/INFO]: Calling tweak class moe.nea.aee.forge.Tweaker
-[16:58:57] [main/INFO]: Launching wrapped minecraft {net.minecraft.client.main.Main}
-[16:58:57] [main/ERROR]: Unable to launch
+[03:34:03] [main/INFO]: Loading tweak class name moe.nea.aee.forge.Tweaker
+[03:34:03] [main/INFO]: Using primary tweak class name moe.nea.aee.forge.Tweaker
+[03:34:03] [main/INFO]: Calling tweak class moe.nea.aee.forge.Tweaker
+[03:34:05] [main/INFO]: Launching wrapped minecraft {net.minecraft.client.main.Main}
+[03:34:08] [Client thread/INFO]: Setting user: Player554
+[03:34:08] [Client thread/INFO]: (Session ID is token:undefined:Player554)
+[03:34:09] [Client thread/ERROR]: Unable to launch
java.lang.reflect.InvocationTargetException
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_302]
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_302]
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_302]
- at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_302]
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_152]
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_152]
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
+ at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
-Caused by: java.lang.UnsatisfiedLinkError: no lwjgl64 in java.library.path
- at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860) ~[?:1.8.0_302]
- at java.lang.Runtime.loadLibrary0(Runtime.java:871) ~[?:1.8.0_302]
- at java.lang.System.loadLibrary(System.java:1124) ~[?:1.8.0_302]
- at org.lwjgl.Sys$1.run(Sys.java:72) ~[lwjgl-2.9.4-nightly-20150209.jar:?]
- at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_302]
- at org.lwjgl.Sys.doLoadLibrary(Sys.java:66) ~[lwjgl-2.9.4-nightly-20150209.jar:?]
- at org.lwjgl.Sys.loadLibrary(Sys.java:87) ~[lwjgl-2.9.4-nightly-20150209.jar:?]
- at org.lwjgl.Sys.<clinit>(Sys.java:117) ~[lwjgl-2.9.4-nightly-20150209.jar:?]
- at net.minecraft.client.Minecraft.getSystemTime(SourceFile:2539) ~[Minecraft.class:?]
- at net.minecraft.client.main.Main.main(SourceFile:41) ~[Main.class:?]
+Caused by: java.lang.ExceptionInInitializerError
+ at net.minecraft.util.StatCollector.<clinit>(SourceFile:7) ~[StatCollector.class:?]
+ at net.minecraft.item.Item.getUnlocalizedNameInefficiently(SourceFile:250) ~[Item.class:?]
+ at net.minecraft.item.Item.getItemStackDisplayName(SourceFile:321) ~[Item.class:?]
+ at net.minecraft.item.ItemStack.getDisplayName(SourceFile:459) ~[ItemStack.class:?]
+ at net.minecraft.item.ItemStack.getChatComponent(SourceFile:775) ~[ItemStack.class:?]
+ at net.minecraft.stats.StatList.initMiningStats(SourceFile:137) ~[StatList.class:?]
+ at net.minecraft.stats.StatList.init(SourceFile:90) ~[StatList.class:?]
+ at net.minecraft.init.Bootstrap.register(SourceFile:460) ~[Bootstrap.class:?]
+ at net.minecraft.client.Minecraft.<init>(SourceFile:304) ~[Minecraft.class:?]
+ at net.minecraft.client.main.Main.main(SourceFile:124) ~[Main.class:?]
... 6 more
+Caused by: java.lang.NullPointerException
+ at java.io.Reader.<init>(Reader.java:78) ~[?:1.8.0_152]
+ at java.io.InputStreamReader.<init>(InputStreamReader.java:113) ~[?:1.8.0_152]
+ at org.apache.commons.io.IOUtils.readLines(IOUtils.java:986) ~[IOUtils.class:2.4]
+ at net.minecraft.util.StringTranslate.<init>(SourceFile:27) ~[StringTranslate.class:?]
+ at net.minecraft.util.StringTranslate.<clinit>(SourceFile:19) ~[StringTranslate.class:?]
+ at net.minecraft.util.StatCollector.<clinit>(SourceFile:7) ~[StatCollector.class:?]
+ at net.minecraft.item.Item.getUnlocalizedNameInefficiently(SourceFile:250) ~[Item.class:?]
+ at net.minecraft.item.Item.getItemStackDisplayName(SourceFile:321) ~[Item.class:?]
+ at net.minecraft.item.ItemStack.getDisplayName(SourceFile:459) ~[ItemStack.class:?]
+ at net.minecraft.item.ItemStack.getChatComponent(SourceFile:775) ~[ItemStack.class:?]
+ at net.minecraft.stats.StatList.initMiningStats(SourceFile:137) ~[StatList.class:?]
+ at net.minecraft.stats.StatList.init(SourceFile:90) ~[StatList.class:?]
+ at net.minecraft.init.Bootstrap.register(SourceFile:460) ~[Bootstrap.class:?]
+ at net.minecraft.client.Minecraft.<init>(SourceFile:304) ~[Minecraft.class:?]
+ at net.minecraft.client.main.Main.main(SourceFile:124) ~[Main.class:?]
+ ... 6 more
+[03:34:09] [Client Shutdown Thread/INFO]: Stopping server
diff --git a/archenemyexample/settings.gradle.kts b/archenemyexample/settings.gradle.kts
index b50251b..77c74c3 100644
--- a/archenemyexample/settings.gradle.kts
+++ b/archenemyexample/settings.gradle.kts
@@ -8,4 +8,8 @@ pluginManagement {
maven("https://repo.nea.moe/releases")
mavenLocal()
}
-} \ No newline at end of file
+}
+
+plugins {
+ id("org.gradle.toolchains.foojay-resolver-convention") version("0.6.0")
+}
diff --git a/archenemyexample/src/forgeMain/kotlin/moe/nea/aee/forge/Main.kt b/archenemyexample/src/forgeMain/kotlin/moe/nea/aee/forge/Main.kt
index 141949e..827340d 100644
--- a/archenemyexample/src/forgeMain/kotlin/moe/nea/aee/forge/Main.kt
+++ b/archenemyexample/src/forgeMain/kotlin/moe/nea/aee/forge/Main.kt
@@ -5,7 +5,25 @@ import net.minecraft.launchwrapper.LaunchClassLoader
import java.io.File
class Tweaker : ITweaker {
- override fun acceptOptions(args: MutableList<String>?, gameDir: File?, assetsDir: File?, profile: String?) {
+ val arguments = mutableListOf<String>()
+
+ override fun acceptOptions(
+ args: List<String>, gameDir: File?,
+ assetsDir: File?, profile: String?
+ ) {
+ arguments.addAll(args)
+ if (gameDir != null){
+ arguments.add("--gameDir")
+ arguments.add(gameDir.absolutePath)
+ }
+ if (assetsDir != null){
+ arguments.add("--assetsDir")
+ arguments.add(assetsDir.absolutePath)
+ }
+ if (profile != null){
+ arguments.add("--version")
+ arguments.add(profile)
+ }
}
override fun injectIntoClassLoader(classLoader: LaunchClassLoader) {
@@ -16,6 +34,6 @@ class Tweaker : ITweaker {
}
override fun getLaunchArguments(): Array<String> {
- return arrayOf()
+ return arguments.toTypedArray()
}
}