summaryrefslogtreecommitdiff
path: root/archenemyexample
diff options
context:
space:
mode:
Diffstat (limited to 'archenemyexample')
-rw-r--r--archenemyexample/build.gradle.kts133
-rw-r--r--archenemyexample/gradle.properties1
-rw-r--r--archenemyexample/gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--archenemyexample/run/logs/2023-12-20-1.log.gzbin0 -> 536 bytes
-rw-r--r--archenemyexample/run/logs/latest.log24
-rw-r--r--archenemyexample/settings.gradle.kts2
-rw-r--r--archenemyexample/src/allJvm/kotlin/moe/nea/test/TestClass.kt5
-rw-r--r--archenemyexample/src/allJvm/kotlin/test.kt9
-rw-r--r--archenemyexample/src/fabricMain/kotlin/doStuff.kt7
-rw-r--r--archenemyexample/src/fabricMain/kotlin/moe/nea/test/TestClass.fabric.kt9
-rw-r--r--archenemyexample/src/fabricMain/kotlin/test.kt0
-rw-r--r--archenemyexample/src/forgeMain/kotlin/doStuff.kt5
-rw-r--r--archenemyexample/src/forgeMain/kotlin/moe/nea/aee/forge/Main.kt21
-rw-r--r--archenemyexample/src/forgeMain/kotlin/moe/nea/test/TestClass.forge.kt9
14 files changed, 151 insertions, 76 deletions
diff --git a/archenemyexample/build.gradle.kts b/archenemyexample/build.gradle.kts
index 7ae9646..ca4313a 100644
--- a/archenemyexample/build.gradle.kts
+++ b/archenemyexample/build.gradle.kts
@@ -1,75 +1,100 @@
import moe.nea.archenemy.MCSide
plugins {
- kotlin("multiplatform") version "1.9.10"
+ kotlin("multiplatform") version "1.9.22"
id("moe.nea.archenemy.mojang")
}
repositories {
mavenCentral()
maven("https://maven.fabricmc.net")
+ maven("https://repo.nea.moe/releases")
+ mavenLocal()
}
-val minecraftClient = mojang.minecraft("1.20.2", MCSide.CLIENT) as ModuleDependency
-val minecraftServer = mojang.minecraft("1.20.2", MCSide.CLIENT) as ModuleDependency
-val officialMappings = mojang.officialMappings(
- "1.20.2", MCSide.CLIENT
-)
-val yarnMappings = mojang.yarnMappings(dependencies.create("net.fabricmc:yarn:1.20.2+build.4:v2"))
-val intermediaryMappings = mojang.intermediaryMappings("1.20.2")
+kotlin.jvmToolchain(8)
val whateverAttribute = Attribute.of("whatever", String::class.java)
-kotlin {
- val allJvm by sourceSets.creating {
- this.dependencies {
- }
+val allJvm by kotlin.sourceSets.creating {
+ this.dependencies {
}
- jvm("forge") {
- attributes.attribute(whateverAttribute, "forge")
- compilations.named("main").get().run {
- defaultSourceSet.dependsOn(allJvm)
- this.dependencies {
- implementation(
- mojang.mapJar(
- minecraftClient,
- officialMappings,
- "official",
- "named"
- )
- )
- }
+}
+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)
}
}
- jvm("fabric") {
- attributes.attribute(whateverAttribute, "fabric")
- compilations.named("main").get().run {
- defaultSourceSet.dependsOn(allJvm)
- this.dependencies {
- 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 as ModuleDependency,
- yarnMappings,
- "intermediary",
- "named"
- )
+}
+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"
)
- }
+ )
}
}
}
+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"
+ )
+ }
+}
diff --git a/archenemyexample/gradle.properties b/archenemyexample/gradle.properties
new file mode 100644
index 0000000..fd5048b
--- /dev/null
+++ b/archenemyexample/gradle.properties
@@ -0,0 +1 @@
+kotlin.mpp.applyDefaultHierarchyTemplate=false
diff --git a/archenemyexample/gradle/wrapper/gradle-wrapper.properties b/archenemyexample/gradle/wrapper/gradle-wrapper.properties
index a595206..0d18421 100644
--- a/archenemyexample/gradle/wrapper/gradle-wrapper.properties
+++ b/archenemyexample/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/archenemyexample/run/logs/2023-12-20-1.log.gz b/archenemyexample/run/logs/2023-12-20-1.log.gz
new file mode 100644
index 0000000..1794cf3
--- /dev/null
+++ b/archenemyexample/run/logs/2023-12-20-1.log.gz
Binary files differ
diff --git a/archenemyexample/run/logs/latest.log b/archenemyexample/run/logs/latest.log
new file mode 100644
index 0000000..585e475
--- /dev/null
+++ b/archenemyexample/run/logs/latest.log
@@ -0,0 +1,24 @@
+[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
+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 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:?]
+ ... 6 more
diff --git a/archenemyexample/settings.gradle.kts b/archenemyexample/settings.gradle.kts
index b538163..b50251b 100644
--- a/archenemyexample/settings.gradle.kts
+++ b/archenemyexample/settings.gradle.kts
@@ -5,5 +5,7 @@ pluginManagement {
gradlePluginPortal()
maven("https://maven.fabricmc.net")
maven("https://maven.neoforged.net/releases")
+ maven("https://repo.nea.moe/releases")
+ mavenLocal()
}
} \ No newline at end of file
diff --git a/archenemyexample/src/allJvm/kotlin/moe/nea/test/TestClass.kt b/archenemyexample/src/allJvm/kotlin/moe/nea/test/TestClass.kt
new file mode 100644
index 0000000..9d72fcc
--- /dev/null
+++ b/archenemyexample/src/allJvm/kotlin/moe/nea/test/TestClass.kt
@@ -0,0 +1,5 @@
+package moe.nea.test
+
+expect object TestClass {
+ fun printTitle()
+} \ No newline at end of file
diff --git a/archenemyexample/src/allJvm/kotlin/test.kt b/archenemyexample/src/allJvm/kotlin/test.kt
deleted file mode 100644
index 87010a6..0000000
--- a/archenemyexample/src/allJvm/kotlin/test.kt
+++ /dev/null
@@ -1,9 +0,0 @@
-expect fun doStuff(args: Int)
-
-fun callDoStuff() {
- doStuff(1)
-}
-
-
-
-
diff --git a/archenemyexample/src/fabricMain/kotlin/doStuff.kt b/archenemyexample/src/fabricMain/kotlin/doStuff.kt
deleted file mode 100644
index fc163c2..0000000
--- a/archenemyexample/src/fabricMain/kotlin/doStuff.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-import net.minecraft.client.MinecraftClient
-import net.minecraft.server.dedicated.DedicatedServer
-
-actual fun doStuff(args: Int) {
- val client = MinecraftClient.getInstance()
- val dedicated: DedicatedServer = TODO()
-} \ No newline at end of file
diff --git a/archenemyexample/src/fabricMain/kotlin/moe/nea/test/TestClass.fabric.kt b/archenemyexample/src/fabricMain/kotlin/moe/nea/test/TestClass.fabric.kt
new file mode 100644
index 0000000..210bbc7
--- /dev/null
+++ b/archenemyexample/src/fabricMain/kotlin/moe/nea/test/TestClass.fabric.kt
@@ -0,0 +1,9 @@
+package moe.nea.test
+
+import net.minecraft.client.MinecraftClient
+
+actual object TestClass {
+ actual fun printTitle() {
+ println(MinecraftClient.getInstance().currentScreen?.toString() ?: "no screen")
+ }
+} \ No newline at end of file
diff --git a/archenemyexample/src/fabricMain/kotlin/test.kt b/archenemyexample/src/fabricMain/kotlin/test.kt
deleted file mode 100644
index e69de29..0000000
--- a/archenemyexample/src/fabricMain/kotlin/test.kt
+++ /dev/null
diff --git a/archenemyexample/src/forgeMain/kotlin/doStuff.kt b/archenemyexample/src/forgeMain/kotlin/doStuff.kt
deleted file mode 100644
index d370de8..0000000
--- a/archenemyexample/src/forgeMain/kotlin/doStuff.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-import net.minecraft.client.Minecraft
-
-actual fun doStuff(args: Int) {
- val client = Minecraft.getInstance()
-} \ No newline at end of file
diff --git a/archenemyexample/src/forgeMain/kotlin/moe/nea/aee/forge/Main.kt b/archenemyexample/src/forgeMain/kotlin/moe/nea/aee/forge/Main.kt
new file mode 100644
index 0000000..141949e
--- /dev/null
+++ b/archenemyexample/src/forgeMain/kotlin/moe/nea/aee/forge/Main.kt
@@ -0,0 +1,21 @@
+package moe.nea.aee.forge
+
+import net.minecraft.launchwrapper.ITweaker
+import net.minecraft.launchwrapper.LaunchClassLoader
+import java.io.File
+
+class Tweaker : ITweaker {
+ override fun acceptOptions(args: MutableList<String>?, gameDir: File?, assetsDir: File?, profile: String?) {
+ }
+
+ override fun injectIntoClassLoader(classLoader: LaunchClassLoader) {
+ }
+
+ override fun getLaunchTarget(): String {
+ return "net.minecraft.client.main.Main"
+ }
+
+ override fun getLaunchArguments(): Array<String> {
+ return arrayOf()
+ }
+}
diff --git a/archenemyexample/src/forgeMain/kotlin/moe/nea/test/TestClass.forge.kt b/archenemyexample/src/forgeMain/kotlin/moe/nea/test/TestClass.forge.kt
new file mode 100644
index 0000000..74e76b7
--- /dev/null
+++ b/archenemyexample/src/forgeMain/kotlin/moe/nea/test/TestClass.forge.kt
@@ -0,0 +1,9 @@
+package moe.nea.test
+
+import net.minecraft.client.Minecraft
+
+actual object TestClass {
+ actual fun printTitle() {
+ println(Minecraft.getMinecraft().currentScreen?.toString() ?: "no screen")
+ }
+} \ No newline at end of file