diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5422d38..4f065c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: cache-read-only: false - name: do the build - run: ./gradlew assemble squishJar + run: ./gradlew assemble continue-on-error: true - name: upload artifacts @@ -29,5 +29,4 @@ jobs: with: name: unlimited-artifacts-v${{ github.run_number }} path: | - build/libs/merged/*.jar */build/libs/*.jar \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index dbf05ed..ec62673 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,110 +1,397 @@ -import dev.architectury.plugin.ArchitectPluginExtension +@file:Suppress("UnstableApiUsage") -plugins { - java - id("architectury-plugin") apply(false) - id("dev.architectury.loom") apply(false) - id("com.github.johnrengelman.shadow") apply(false) - - id("io.github.pacifistmc.forgix") +import groovy.json.JsonOutput +import groovy.json.JsonSlurper +import proguard.ConfigurationParser +import proguard.ProGuard +import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask +import xyz.wagyourtail.unimined.expect.task.ExpectPlatformJar +import xyz.wagyourtail.unimined.internal.minecraft.task.RemapJarTaskImpl +import xyz.wagyourtail.unimined.util.OSUtils +import xyz.wagyourtail.unimined.util.sourceSets +import xyz.wagyourtail.gradle.shadow.ShadowJar +import java.util.jar.JarEntry +import java.util.jar.JarInputStream +import java.util.jar.JarOutputStream +import java.util.zip.Deflater - id("properties") apply(false) - id("subprojects") apply(false) - id("platform") apply(false) - id("postprocessor") +plugins { + id("java") + id("idea") + id("xyz.wagyourtail.unimined") + id("xyz.wagyourtail.unimined.expect-platform") } + setup() -setupForgix() allprojects { apply(plugin = "java") + apply(plugin = "idea") + apply(plugin = "xyz.wagyourtail.unimined") + apply(plugin = "xyz.wagyourtail.unimined.expect-platform") base.archivesName.set("archives_base_name"()) version = "modVersion"() group = "maven_group"() java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + toolchain { + languageVersion.set(JavaLanguageVersion.of("java_version"())) + } + + sourceCompatibility = JavaVersion.toVersion("java_version"()) + targetCompatibility = JavaVersion.toVersion("java_version"()) + } + + idea.module.setDownloadSources(true) + + repositories { + mavenCentral { + content { + excludeGroup("ca.weblite") + } + } + unimined.parchmentMaven() + exclusiveContent { + forRepository { maven("https://api.modrinth.com/maven") } + filter { + includeGroup("maven.modrinth") + } + } + exclusiveContent { + forRepository { maven("https://cursemaven.com") } + filter { + includeGroup("curse.maven") + } + } + unimined.wagYourMaven("releases") } tasks.withType { options.encoding = "UTF-8" - options.release = 17 + options.release = "java_version"().toInt() options.compilerArgs.addAll(listOf("-Xplugin:Manifold no-bootstrap", "-implicit:none")) + + javaCompiler = javaToolchains.compilerFor { + languageVersion.set(JavaLanguageVersion.of("java_version"())) + } } tasks.withType { isPreserveFileTimestamps = false isReproducibleFileOrder = true + includeEmptyDirs = false + } + + unimined.minecraft(sourceSet = sourceSets["main"], lateApply = true) { + version = "minecraft_version"() + + mappings { + mojmap() + parchment(version = "parchment_version"()) + + devFallbackNamespace("official") + } + + runs { + config("client") { + jvmArgs("-Xms4G", "-Xmx4G") + expectPlatform.insertAgent(spec = this, platformName = project.name) + } + } + + defaultRemapJar = false + } + + tasks.withType { + mixinRemap { + enableMixinExtra() + disableRefmap() + } + } + + dependencies { + compileOnly("systems.manifold:manifold-props:${"manifold_version"()}") { + annotationProcessor(this) + } + compileOnly("io.github.llamalad7:mixinextras-common:${"mixin_extras_version"()}") + + compileOnly(expectPlatform.annotationsDep) } } -extensions.getByType().apply { - minecraft = "minecraft_version"() +subprojects { + val platform = project.name.lowercase() + + dependencies { + implementation(rootProject.sourceSets["main"].output) + } + + tasks.processResources { + from(rootProject.sourceSets["main"].resources) + + val props = mapOf( + "mod_version" to "modVersion"(), + "minecraft_version" to "minecraft_version"(), + "fabric_version" to "fabric_version"(), + "create_version" to "minimum_create_version"(), + ) + + inputs.properties(props) + + filesMatching(listOf("fabric.mod.json", "META-INF/mods.toml")) { + expand(props) + } + } + + tasks.jar { + archiveClassifier = "$platform-dev-unmapped" + from(rootProject.sourceSets["main"].output) { + include("**/*.class") + } + putInDevlibs() + } + + val expectPlatformJar by tasks.register("platformJar") { + group = "unimined" + platformName = platform + archiveClassifier = "expect-$platform" + putInDevlibs() + inputFiles = files(tasks.jar.get().archiveFile) + } + + val shadowJar by tasks.register("shadowJar") { + dependsOn(expectPlatformJar) + archiveBaseName.set("archives_base_name"()) + archiveVersion.set("modVersion"()) + archiveClassifier.set("$platform-shadowJar") + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + putInDevlibs() + + shadowContents.add(files(expectPlatformJar.archiveFile)) + + relocate("dev.rdh.createunlimited.$platform", "dev.rdh.createunlimited") + } + + val remapPlatformJar = tasks.register("remapPlatformJar", unimined.minecrafts[sourceSets["main"]]) + remapPlatformJar.configure { + dependsOn(shadowJar) + inputFile.set(shadowJar.archiveFile) + archiveClassifier = platform + } + + tasks.register("preShadow") { + from(zipTree(remapPlatformJar.get().archiveFile)) { + rename { + if(it == "createunlimited.mixins.json") "createunlimited-$platform.mixins.json" + //else if(it.endsWith(".jar")) it + "_" + else it + } + includeEmptyDirs = false + } + + archiveClassifier.set("premerge-$platform") + putInDevlibs() + + relocate("dev.rdh.createunlimited", "dev.rdh.createunlimited.${project.name}") + } } -tasks.clean { - delete(".architectury-transformer") +tasks.jar { enabled = false } + +unimined.minecraft { + runs.off = true + + mappings.intermediary() + + mods { + modImplementation { + catchAWNamespaceAssertion() + namespace("intermediary") + } + } } -tasks.jar { - enabled = false +repositories { + maven("https://jitpack.io") + maven("https://maven.tterrag.com") + maven("https://mvn.devos.one/snapshots") + maven("https://maven.theillusivec4.top") + maven("https://maven.cafeteria.dev/releases") + maven("https://maven.jamieswhiteshirt.com/libs-release") + maven("https://repo.spongepowered.org/repository/maven-public/") } -subprojects { - apply(plugin = "subprojects") +dependencies { + "modImplementation"("com.simibubi.create:create-fabric-${"minecraft_version"()}:${"create_fabric_version"()}+mc${"minecraft_version"()}") { + exclude(group = "com.github.llamalad7.mixinextras", module = "mixinextras-fabric") + } + + implementation("org.ow2.asm:asm:${"asm_version"()}") + implementation("org.ow2.asm:asm-tree:${"asm_version"()}") + implementation("org.ow2.asm:asm-commons:${"asm_version"()}") + implementation("org.spongepowered:mixin:${"mixin_version"()}") +} + +val mergeJars by tasks.register("mergeJars") { + group = "build" + description = "Merges the platform shadow jars into a single jar" + archiveBaseName = "archives_base_name"() + archiveVersion = "modVersion"() + archiveClassifier = "almost-done" + putInDevlibs() + + includeEmptyDirs = false + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + + val oldMixinConfig = "createunlimited.mixins.json" + fun newMixinConfig(platform: String) = "createunlimited-$platform.mixins.json" + + val oldMixinPackage = "dev.rdh.createunlimited.asm" + fun newMixinPackage(platform: String) = "dev.rdh.createunlimited.$platform.asm" + + from(zipTree(project(":fabric").tasks.get("preShadow").archiveFile)) { + includeEmptyDirs = false + val newMixinConfig = newMixinConfig("fabric") + val newMixinPackage = newMixinPackage("fabric") + + filesMatching("fabric.mod.json") { + filter { it.replace(oldMixinConfig, newMixinConfig) } + } + filesMatching(newMixinConfig) { + filter { it.replace(oldMixinPackage, newMixinPackage) } + } + } + + from(zipTree(project(":forge").tasks.get("preShadow").archiveFile)) { + includeEmptyDirs = false + filesMatching(newMixinConfig("forge")) { + filter { it.replace(oldMixinPackage, newMixinPackage("forge")) } + } + + //rename { if(it.endsWith(".jar_")) it.substring(0, it.length - 1) else it } + } + + manifest { + attributes["MixinConfigs"] = newMixinConfig("forge") + attributes["Fabric-Loom-Mixin-Remap-Type"] = "static" + } +} + +val compressJar = tasks.register("compressJar") { + input.set(mergeJars.archiveFile) + description = "Compresses the merged jar" + + archiveBaseName = "archives_base_name"() + archiveVersion = "modVersion"() + archiveClassifier = "" + + addFileProcessor(extensions = setOf("json", "mcmeta"), processor = Compressors.json) + addFileProcessor(extensions = setOf("jar"), processor = Compressors.storeJars) + + addDirProcessor { dir -> // proguard + val temp = temporaryDir.resolve("proguard") + temp.mkdirs() + dir.copyRecursively(temp, overwrite = true) + dir.deleteRecursively() + val args = mutableListOf( + "@${file("proguard.pro").absolutePath}", + "-injars", temp.absolutePath, + "-outjars", dir.absolutePath, + ) + + val libraries = mutableSetOf() + libraries.add("${JAVA_HOME}/jmods/java.base.jmod") + + for (minecraftConfig in subprojects.flatMap { it.unimined.minecrafts.values }) { + val prodNamespace = minecraftConfig.mcPatcher.prodNamespace + + libraries.add(minecraftConfig.getMinecraft(prodNamespace, prodNamespace).toFile().absolutePath) + + val minecrafts = listOf( + minecraftConfig.sourceSet.compileClasspath.files, + minecraftConfig.sourceSet.runtimeClasspath.files + ).flatten() + .filter { !minecraftConfig.isMinecraftJar(it.toPath()) } + .toHashSet() + + libraries += minecraftConfig.mods.getClasspathAs(prodNamespace, prodNamespace, minecrafts) + .filter { it.extension == "jar" && !it.name.startsWith("createunlimited") } + .map { it.absolutePath } + } + + args.addAll(listOf("-libraryjars", libraries.joinToString(separator = File.pathSeparator) { "\"$it\"" })) + + try { + ProGuard(proguard.Configuration().also { + ConfigurationParser(args.toTypedArray(), null) + .parse(it) + }).execute() + } catch (ex: Exception) { + throw IllegalStateException("ProGuard failed for $temp", ex) + } finally { + temp.deleteRecursively() + } + } +} + +tasks.assemble { + dependsOn(mergeJars) } fun setup() { - println("Create Unlimited v${"mod_version"()}") - val buildNumber = System.getenv("GITHUB_RUN_NUMBER") + println("${project.name} v${"mod_version"()}") + + val buildNumber: String? = System.getenv("GITHUB_RUN_NUMBER") if(buildNumber != null) { println("Build #$buildNumber") } + + println() + println("Gradle ${gradle.gradleVersion}, on ${System.getProperty("java.vm.name")} v${System.getProperty("java.version")}, by ${System.getProperty("java.vendor")}") + println("OS: \"${OSUtils.oSId}\", arch \"${OSUtils.osArch}\"") println() - ext["modVersion"] = "mod_version"() + (buildNumber?.let { "-build.$it" } ?: "") - apply(plugin = "properties") - - println("\nPlugin versions:") - apply(plugin = "architectury-plugin") - - tasks.register("nukeGradleCaches") { - dependsOn("clean") - group = "build" - description = "Deletes all .gradle directories in the project. WARNING: causes IDEs to freeze for a while." - doLast { - fileTree(rootDir) { - include("**/.gradle") - exclude(".gradle/architectury") - }.forEach { - it.deleteRecursively() + if(git.exists()) { + println("Current branch: ${git.currentBranch()}") + println("Current commit: ${git.hash()}") + if (git.isDirty()) { + var changes = git.getUncommitedChanges().split("\n").toMutableList() + val size = changes.size + val maxChanges = "git_max_changes"().toInt() + if (size > maxChanges) { + changes = changes.subList(0, maxChanges) + changes.add("... and ${size - maxChanges} more") } - } - } -} -fun setupForgix() { - forgix { - group = "maven_group"() - mergedJarName = "createunlimited-${"modVersion"()}.jar" - outputDir = "build/libs/merged" + println("Uncommitted changes:\n${changes.map{ " - $it" }.joinToString("\n")}") + } + } else { + println("No git repository") } + println() - tasks.mergeJars { - dependsOn("assemble") - } + ext["modVersion"] = "mod_version"() + (buildNumber?.let { "-build.$it" } ?: "") tasks.assemble { subprojects.forEach { this.dependsOn(it.tasks.named("assemble")) } - finalizedBy("mergeJars") } - apply(plugin = "postprocessor") + findAndLoadProperties() +} + +tasks.register("nukeGradleCaches") { + dependsOn("clean") + group = "build" + description = "Deletes all .gradle directories in the project. WARNING: causes IDEs to freeze for a while." + outputs.upToDateWhen { false } + doLast { + allprojects.forEach { + it.file(".gradle").deleteRecursively() + } + } } -operator fun String.invoke(): String = rootProject.ext[this] as? String - ?: error("Property $this is not defined") +operator fun String.invoke(): String = rootProject.ext[this] as String \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 0a4f3d8..840509d 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,7 +1,9 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion +import java.util.* plugins { `kotlin-dsl` + idea } repositories { @@ -11,47 +13,39 @@ repositories { maven("https://maven.architectury.dev/") maven("https://maven.neoforged.net/releases") maven("https://maven.firstdarkdev.xyz/releases") + maven("https://maven.wagyourtail.xyz/releases") + maven("https://maven.wagyourtail.xyz/snapshots") gradlePluginPortal() } +idea.module.setDownloadSources(true) + fun DependencyHandler.plugin(id: String, version: String) { this.implementation(group = id, name = "$id.gradle.plugin", version = version) } tasks.compileKotlin { compilerOptions.languageVersion.set(KotlinVersion.KOTLIN_2_0) + kotlinOptions.jvmTarget = "17" } -dependencies { - plugin("architectury-plugin", "3.4.155") - plugin("dev.architectury.loom", "1.5.391") - plugin("com.github.johnrengelman.shadow", "8.1.1") - plugin("io.github.pacifistmc.forgix", "1.2.9") +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} - implementation("org.ow2.asm:asm:9.6") - implementation("org.ow2.asm:asm-analysis:9.6") +val gradleProperties = Properties().apply { + load(rootDir.parentFile.resolve("gradle.properties").inputStream()) } -gradlePlugin { - plugins { - create("properties") { - id = "properties" - implementationClass = "PropertiesPlugin" - } - - create("subprojects") { - id = "subprojects" - implementationClass = "SubprojectsPlugin" - } - - create("platform") { - id = "platform" - implementationClass = "PlatformPlugin" - } - - create("postprocessor") { - id = "postprocessor" - implementationClass = "JarPostprocessorPlugin" - } - } -} \ No newline at end of file +operator fun String.invoke(): String = gradleProperties.getProperty(this) ?: error("Property $this is not defined") + +dependencies { + implementation("org.ow2.asm:asm-tree:${"asm_version"()}") + implementation("org.ow2.asm:asm-commons:${"asm_version"()}") + implementation(group = "org.jetbrains", name = "annotations") + implementation("com.guardsquare:proguard-base:${"proguard_version"()}") + + plugin(id = "xyz.wagyourtail.unimined", version = "unimined_version"()) + plugin(id = "xyz.wagyourtail.unimined.expect-platform", version = "expectplatform_version"()) +} diff --git a/buildSrc/src/main/kotlin/Compressors.kt b/buildSrc/src/main/kotlin/Compressors.kt new file mode 100644 index 0000000..7c18d34 --- /dev/null +++ b/buildSrc/src/main/kotlin/Compressors.kt @@ -0,0 +1,33 @@ +import groovy.json.JsonOutput +import groovy.json.JsonSlurper +import java.io.File +import java.util.jar.JarEntry +import java.util.jar.JarInputStream +import java.util.jar.JarOutputStream +import java.util.zip.Deflater + +object Compressors { + // minify json + val json: FileProcessor = { + it.outputStream().write(JsonOutput.toJson(JsonSlurper().parse(it)).toByteArray()) + } + + // store JIJs instead of deflating them so that the outer jar compresses the entire thing (most of the time better) + val storeJars: FileProcessor = { input -> + val tmp = input.copyTo(File.createTempFile(input.nameWithoutExtension, ".jar"), overwrite = true) + JarInputStream(tmp.inputStream()).use { ins -> + JarOutputStream(input.outputStream()).use { out -> + out.setLevel(Deflater.NO_COMPRESSION) + while (true) { + out.putNextEntry(JarEntry((ins.nextEntry ?: break).name)) + ins.copyTo(out) + out.closeEntry() + ins.closeEntry() + } + + out.finish() + out.flush() + } + } + } +} diff --git a/buildSrc/src/main/kotlin/JarPostprocessorPlugin.kt b/buildSrc/src/main/kotlin/JarPostprocessorPlugin.kt deleted file mode 100644 index 12b8064..0000000 --- a/buildSrc/src/main/kotlin/JarPostprocessorPlugin.kt +++ /dev/null @@ -1,117 +0,0 @@ -import groovy.json.JsonOutput -import groovy.json.JsonSlurper - -import io.github.pacifistmc.forgix.plugin.ForgixMergeExtension -import io.github.pacifistmc.forgix.plugin.MergeJarsTask - -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.ProjectConfigurationException - -import org.objectweb.asm.ClassReader -import org.objectweb.asm.ClassWriter -import org.objectweb.asm.tree.ClassNode - -import java.io.File -import java.util.jar.JarFile - -import org.gradle.kotlin.dsl.* -import java.util.jar.JarEntry -import java.util.jar.JarOutputStream -import java.util.zip.Deflater - -class JarPostprocessorPlugin : Plugin { - - override fun apply(project: Project) { - project.afterEvaluate { - if(rootProject != this) { - throw ProjectConfigurationException("JarPostProcessorPlugin can only be applied to the root project", IllegalStateException()) - } - - val stripLVTs = findProperty("strip_lvts").toString().toBoolean() - val forgix: ForgixMergeExtension = extensions.getByType() - - tasks.register("squishJar") { - val mergeJarsTask = tasks.withType()["mergeJars"] - dependsOn(mergeJarsTask) - mergeJarsTask.finalizedBy(this) - group = "forgix" - val output = File(forgix.outputDir, forgix.mergedJarName) - inputs.files(output) - - doLast { - val entries = readJar(output) - output.delete() - entries.replaceAll { name, data -> - if(name.endsWith(".class") && !name.startsWith("dev/rdh/createunlimited/shadow")) { - val deAnnotationed = removeUnnecessaryAnnotationsFrom(data) - if(stripLVTs) { - stripLVTsFrom(deAnnotationed) - } else { - deAnnotationed - } - } else if(name.endsWith(".json")) { - minifyJson(data) - } else { - data - } - } - - entries.keys.removeIf { it.startsWith("META-INF/services/") } - - JarOutputStream(output.outputStream()).use { - it.setLevel(Deflater.BEST_COMPRESSION) - entries.forEach { (name, data) -> - it.putNextEntry(JarEntry(name)) - it.write(data) - it.closeEntry() - } - } - } - } - } - } - - private fun readJar(file: File): MutableMap { - val entries: MutableMap = LinkedHashMap() - JarFile(file).use { - it.entries().asIterator().forEach { entry -> - if (entry.isDirectory()) return@forEach - val data = it.getInputStream(entry).readAllBytes() - entries[entry.name] = data - } - } - return entries - } - - private fun stripLVTsFrom(classBytes: ByteArray): ByteArray { - val classNode = ClassNode() - ClassReader(classBytes).accept(classNode, 0) - - classNode.methods.forEach { - it.localVariables?.clear() - it.parameters?.clear() - } - - val classWriter = ClassWriter(0) - classNode.accept(classWriter) - return classWriter.toByteArray() - } - - private fun removeUnnecessaryAnnotationsFrom(classBytes: ByteArray): ByteArray { - val classNode = ClassNode() - ClassReader(classBytes).accept(classNode, 0) - - classNode.methods?.forEach { method -> - method.invisibleAnnotations?.clear() - } - - val classWriter = ClassWriter(0) - classNode.accept(classWriter) - return classWriter.toByteArray() - } - - private fun minifyJson(jsonBytes: ByteArray): ByteArray { - return JsonOutput.toJson(JsonSlurper().parse(jsonBytes)).toByteArray() - } -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/PlatformPlugin.kt b/buildSrc/src/main/kotlin/PlatformPlugin.kt deleted file mode 100644 index be0c00c..0000000 --- a/buildSrc/src/main/kotlin/PlatformPlugin.kt +++ /dev/null @@ -1,101 +0,0 @@ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -import dev.architectury.plugin.ArchitectPluginExtension -import net.fabricmc.loom.api.LoomGradleExtensionAPI -import net.fabricmc.loom.task.RemapJarTask -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.artifacts.Configuration -import org.gradle.api.artifacts.ModuleDependency -import org.gradle.api.component.AdhocComponentWithVariants -import org.gradle.configurationcache.extensions.capitalized -import org.gradle.jvm.tasks.Jar -import org.gradle.kotlin.dsl.* - -class PlatformPlugin : Plugin { - override fun apply(project: Project) { - project.run { - extensions.getByType().platformSetupLoomIde() - val loom = extensions.getByType() - - afterEvaluate { - loom.runs { - configureEach { - vmArgs("-XX:+AllowEnhancedClassRedefinition", "-XX:+IgnoreUnrecognizedVMOptions") - } - - named("client") { - client() - name = "Minecraft Client" - isIdeConfigGenerated = true - val baseArgs = - "-XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+AlwaysActAsServerClassMachine -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:+UseNUMA -XX:NmethodSweepActivity=1 -XX:ReservedCodeCacheSize=400M -XX:NonNMethodCodeHeapSize=12M -XX:ProfiledCodeHeapSize=194M -XX:NonProfiledCodeHeapSize=194M -XX:-DontCompileHugeMethods -XX:MaxNodeLimit=240000 -XX:NodeLimitFudgeFactor=8000 -XX:+UseVectorCmov -XX:+PerfDisableSharedMem -XX:+UseFastUnorderedTimeStamps -XX:+UseCriticalJavaThreadPriority -XX:ThreadPriorityPolicy=1 -XX:AllocatePrefetchStyle=3" - val memoryArgs = "-Xmx4G -Xms4G" - val gcArgs = - "-XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGuaranteedGCInterval=1000000 -XX:AllocatePrefetchStyle=1" - vmArgs("$baseArgs $memoryArgs $gcArgs".split(" ")) - if (project.findProperty("mixin.debug")?.toString()?.toBoolean() == true) { - vmArgs("-Dmixin.debug.export=true", "-Dmixin.debug.verbose=true") - } - - - val mixinJar = configurations["compileClasspath"].resolvedConfiguration.resolvedArtifacts - .single { - (it.moduleVersion.id.group == "dev.architectury" && it.moduleVersion.id.name == "mixin-patched") || // forge - (it.moduleVersion.id.group == "net.fabricmc" && it.moduleVersion.id.name == "sponge-mixin") // fabric - }.file - - vmArgs("-javaagent:${mixinJar.absolutePath}") - } - } - } - - val common: Configuration by configurations.creating - val shadowCommon: Configuration by configurations.creating - configurations["compileClasspath"].extendsFrom(common) - configurations["runtimeClasspath"].extendsFrom(common) - - dependencies { - common(project("path" to ":common", "configuration" to "namedElements")).apply { - (this as ModuleDependency).isTransitive = false - } - - shadowCommon(project("path" to ":common", "configuration" to "transformProduction${project.name.capitalized()}")).apply { - (this as ModuleDependency).isTransitive = false - } - } - - val shadowJar = tasks.withType()["shadowJar"] - - shadowJar.apply { - exclude("architectury.common.json") - exclude("**/PlatformMethods.class") - exclude("LICENSE_MixinExtras") - exclude("META-INF/jarjar/**") - exclude("META-INF/jars/**") - configurations = listOf(shadowCommon, project.configurations.getByName("shade")) - archiveClassifier.set("shadow-${project.getName()}") - } - - tasks.withType()["remapJar"].apply { - dependsOn(shadowJar) - inputFile.set(shadowJar.archiveFile) - archiveClassifier = project.name - } - - tasks.withType()["jar"] - .archiveClassifier = "dev-${project.name}" - - tasks.withType()["sourcesJar"].apply { - val commonSources = rootProject.project(":common").tasks.withType()["sourcesJar"] - dependsOn(commonSources) - from(commonSources.archiveFile.map { project.zipTree(it) }) - archiveClassifier = "sources-${project.name}" - } - - components.withType()["java"] - .withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) { - skip() - } - } - } -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/ProcessJar.kt b/buildSrc/src/main/kotlin/ProcessJar.kt new file mode 100644 index 0000000..feffed1 --- /dev/null +++ b/buildSrc/src/main/kotlin/ProcessJar.kt @@ -0,0 +1,91 @@ +import org.gradle.api.file.RegularFileProperty +import org.gradle.api.provider.ListProperty +import org.gradle.api.tasks.InputFile +import org.gradle.jvm.tasks.Jar +import java.io.File +import java.util.jar.JarEntry +import java.util.jar.JarOutputStream +import java.util.zip.Deflater + +typealias FileProcessor = (File) -> Unit + +abstract class ProcessJar : Jar() { + abstract val input: RegularFileProperty + @InputFile get + + abstract val processors: ListProperty + + init { + group = "build" + outputs.upToDateWhen { false } + + addFileProcessor(paths = setOf("META-INF/MANIFEST.MF")) { file -> + manifest.from(file) + file.delete() + file.createNewFile() + manifest.effectiveManifest.writeTo(file) + } + } + + fun addFileProcessor(regex: Regex, processor: FileProcessor) { + processors.add { + it.walkTopDown().forEach { file -> + if (file.path.matches(regex)) + processor(file) + } + } + } + + fun addFileProcessor(extensions: Iterable = emptySet(), + names: Iterable = emptySet(), + paths: Iterable = emptySet(), + processor: FileProcessor) { + processors.add { + it.walkTopDown().forEach { file -> + if (file.extension in extensions || file.name in names || file.path in paths) + processor(file) + } + } + } + + fun addDirProcessor(processor: FileProcessor) { + processors.add(processor) + } + + override fun copy() { + val inputJar = input.get().asFile + + if (!inputJar.exists()) + error("Input jar does not exist: $inputJar") + + val dir = temporaryDir.resolve("unpack") + + if (dir.exists()) + dir.deleteRecursively() + dir.mkdirs() + + // unpack jar to temp dir + project.copy { + from(project.zipTree(inputJar)) + into(dir) + } + + processors.finalizeValue() + processors.get().forEach { it(dir) } + + // repack jar + JarOutputStream(archiveFile.get().asFile.outputStream()).use { jos -> + jos.setLevel(Deflater.BEST_COMPRESSION) + for (file in dir.walkTopDown()) { + if(file.isDirectory) continue + val entry = JarEntry(file.relativeTo(dir).path) + jos.putNextEntry(entry) + file.inputStream().copyTo(jos) + jos.closeEntry() + } + + jos.finish() + jos.flush() + } + } +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/PropertiesPlugin.kt b/buildSrc/src/main/kotlin/PropertiesPlugin.kt deleted file mode 100644 index 27dedfb..0000000 --- a/buildSrc/src/main/kotlin/PropertiesPlugin.kt +++ /dev/null @@ -1,38 +0,0 @@ -import org.gradle.api.Plugin -import org.gradle.api.Project -import java.util.* - -class PropertiesPlugin : Plugin { - override fun apply(project: Project) { - project.run { - var mcVersion = "" - val mcVers = rootProject.fileTree("versionProperties").files.stream() - .map { it.getName().removeSuffix(".properties") } - .sorted() - .toList() - - println("Setting up properties...") - println("Avalible Minecraft Versions: ${mcVers.joinToString(", ")}") - - if(rootProject.hasProperty("mcVer")) { - mcVersion = rootProject.properties["mcVer"] as String - } - - if(!mcVers.contains(mcVersion)) { - println("No mcVer set or the set mcVer is invalid!") - println("Use -PmcVer='mc_version' or edit gradle.properties to set the minecraft version.") - throw InvalidPropertiesFormatException("Invalid minecraft version") - } - - println("Using Minecraft $mcVersion") - - val properties = Properties().apply { - load(rootProject.file("versionProperties/$mcVersion.properties").reader()) - } - - properties.forEach { (key, value) -> - project.extensions.extraProperties[key.toString()] = value - } - } - } -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/SubprojectsPlugin.kt b/buildSrc/src/main/kotlin/SubprojectsPlugin.kt deleted file mode 100644 index ed34bdc..0000000 --- a/buildSrc/src/main/kotlin/SubprojectsPlugin.kt +++ /dev/null @@ -1,125 +0,0 @@ -import net.fabricmc.loom.api.LoomGradleExtensionAPI - -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.artifacts.Configuration -import org.gradle.api.artifacts.dsl.DependencyHandler -import org.gradle.api.artifacts.dsl.RepositoryHandler -import org.gradle.api.plugins.JavaPluginExtension -import org.gradle.api.tasks.AbstractCopyTask -import org.gradle.kotlin.dsl.* - -@Suppress("UnstableApiUsage") -class SubprojectsPlugin : Plugin { - private lateinit var project: Project - - override fun apply(project: Project) { - this.project = project - project.run { - apply(plugin = "dev.architectury.loom") - apply(plugin = "architectury-plugin") - - val loom = extensions.getByType() - - loom.silentMojangMappingsLicense() - extensions.getByType().withSourcesJar() - - val shade: Configuration by configurations.creating - configurations["implementation"].extendsFrom(shade) - - repositories { - mavenCentral() - mavenLocal() - maven("https://maven.parchmentmc.org", exclusive = true) { - listOf("org.parchmentmc.data") - } - maven("https://maven.quiltmc.org/repository/release", exclusive = true) { - listOf("org.quiltmc") - } - maven("https://maven.ithundxr.dev/releases") - maven("https://mvn.devos.one/snapshots") - maven("https://maven.cafeteria.dev/releases") - maven("https://maven.jamieswhiteshirt.com/libs-release") - maven("https://maven.theillusivec4.top") - maven("https://maven.terraformersmc.com/releases") - maven("https://jitpack.io") - maven("https://raw.githubusercontent.com/Fuzss/modresources/main/maven/") - maven("https://maven.tterrag.com") { - listOf("com.simibubi.create", "com.jozufozu.flywheel", "com.tterrag.registrate") - } - maven("https://api.modrinth.com/maven", exclusive = true) { - listOf("maven.modrinth") - } - maven("https://cursemaven.com", exclusive = true) { - listOf("curse.maven") - } - } - - val mcVersion = project.property("minecraft_version") as String - - dependencies { - "minecraft"("com.mojang:minecraft:$mcVersion") - "mappings"(loom.layered { - mappings("org.quiltmc:quilt-mappings:$mcVersion+build.${project.property("quilt")}:intermediary-v2") - officialMojangMappings() - parchment("org.parchmentmc.data:parchment-$mcVersion:${project.property("parchment")}@zip") - }) - - manifold("props") - manifold("ext") - "localRuntime"("systems.manifold:manifold-ext-rt:${project.property("manifold_version")}") - - "io.github.llamalad7:mixinextras-common:${project.property("mixin_extras")}".also { - "annotationProcessor"(it) - "implementation"(it) - } - } - - tasks.named("processResources", AbstractCopyTask::class.java) { - val properties = mapOf( - "version" to project.property("modVersion"), - "minecraft" to mcVersion, - "fabric" to project.property("fabric"), - "create" to project.property("minimum_create_version"), - ) - - inputs.properties(properties) - exclude("**/*.aw") - filesMatching(listOf("fabric.mod.json", "META-INF/mods.toml")) { - expand(properties) - } - } - } - } - - private fun DependencyHandler.manifold(module: String) { - val location = "systems.manifold:manifold-" + module + ":" + project.property("manifold_version") - add("annotationProcessor", location) - add("compileOnly", location) - if (project.getPath() != ":common") { - add("localRuntime", location) - } - if (project.getPath() == ":forge") { - add("forgeRuntimeLibrary", location) - } - } - - private fun RepositoryHandler.maven(url: String, exclusive: Boolean = false, includes: () -> List) { - if(exclusive) { - exclusiveContent { - forRepository { maven(url) } - filter { - includes().forEach { includeGroup(it) } - } - } - } else { - maven(url).apply { - includes().forEach { - content { - includeGroup(it) - } - } - } - } - } -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/git.kt b/buildSrc/src/main/kotlin/git.kt new file mode 100644 index 0000000..56fe6a6 --- /dev/null +++ b/buildSrc/src/main/kotlin/git.kt @@ -0,0 +1,30 @@ +import org.gradle.api.Project +import java.io.File + +val Project.git + get() = Git(rootProject.rootDir) + +class Git(val repository: File) { + fun exists() = repository.resolve(".git").isDirectory() + + // does the current git repository have uncommitted changes? + fun isDirty() = git("status", "--porcelain").isNotBlank() + + // last commit hash + fun hash() = git("rev-parse", "--short", "HEAD").trim() + + // current branch + fun currentBranch() = git("rev-parse", "--abbrev-ref", "HEAD").trim() + + // latest tag + fun tag() = git("describe", "--tags", "--abbrev=0").trim() + + fun getUncommitedChanges() = git("diff", "--name-only").trim() + + private fun git(vararg args: String): String { + val process = ProcessBuilder("git", *args) + .directory(repository) + .start() + return process.inputStream.bufferedReader().readText() + } +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/properties.kt b/buildSrc/src/main/kotlin/properties.kt new file mode 100644 index 0000000..6983dc5 --- /dev/null +++ b/buildSrc/src/main/kotlin/properties.kt @@ -0,0 +1,27 @@ +import org.gradle.api.Project +import java.util.* + +fun Project.findAndLoadProperties() { + val mcVers = rootProject.fileTree("versionProperties").files.stream() + .map { it.getName().removeSuffix(".properties") } + .sorted() + .toList() + + println("Setting up properties...") + println("Avalible Minecraft Versions: ${mcVers.joinToString(", ")}") + + val mcVersion: String = findProperty("mcVer") as? String ?: run { + println("No mcVer set or the set mcVer is invalid!") + println("Use -PmcVer='mc_version' or edit gradle.properties to set the minecraft version.") + error("Invalid Minecraft version") + } + + println("Using Minecraft $mcVersion") + val properties = Properties().apply { + load(rootProject.file("versionProperties/$mcVersion.properties").reader()) + } + + properties.forEach { (key, value) -> + project.extensions.extraProperties[key.toString()] = value + } +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/util.kt b/buildSrc/src/main/kotlin/util.kt new file mode 100644 index 0000000..dda4d9f --- /dev/null +++ b/buildSrc/src/main/kotlin/util.kt @@ -0,0 +1,24 @@ +import org.gradle.api.Task +import org.gradle.api.internal.file.copy.DefaultCopySpec +import org.gradle.api.tasks.* +import org.gradle.api.tasks.bundling.AbstractArchiveTask +import org.gradle.jvm.tasks.Jar + +val JAVA_HOME = System.getProperty("java.home") ?: error("JAVA_HOME not set") + +fun Jar.clearSourcePaths() { + AbstractCopyTask::class.java.getDeclaredField("mainSpec").let { + it.isAccessible = true + val thing = it.get(this) as DefaultCopySpec + thing.sourcePaths.clear() + it.isAccessible = false + } +} + +fun AbstractArchiveTask.putInDevlibs() { + destinationDirectory.set(project.layout.buildDirectory.dir("devlibs")) +} + +inline fun TaskContainer.get(name: String): T { + return this.withType(T::class.java).getByName(name) +} diff --git a/buildSrc/src/main/kotlin/xyz/wagyourtail/gradle/shadow/PackageRelocateReader.kt b/buildSrc/src/main/kotlin/xyz/wagyourtail/gradle/shadow/PackageRelocateReader.kt new file mode 100644 index 0000000..f23eb1d --- /dev/null +++ b/buildSrc/src/main/kotlin/xyz/wagyourtail/gradle/shadow/PackageRelocateReader.kt @@ -0,0 +1,67 @@ +package xyz.wagyourtail.gradle.shadow + +import org.objectweb.asm.ClassReader +import org.objectweb.asm.ClassWriter +import org.objectweb.asm.commons.ClassRemapper +import xyz.wagyourtail.unimined.util.MustSet +import java.io.ByteArrayInputStream +import java.io.ByteArrayOutputStream +import java.io.FilterReader +import java.io.Reader +import java.nio.charset.StandardCharsets + +/** + * @author Wagyourtail + */ +class PackageRelocateReader(input: Reader) : FilterReader(input) { + + var remapper: PackageRelocator by MustSet() + + val contents = ByteArrayOutputStream().use { out -> + out.writer(StandardCharsets.ISO_8859_1).use { writer -> + input.copyTo(writer) + } + input.close() + out.toByteArray() + } + + val changedContents: Reader by lazy { + val reader = ClassReader(contents) + val writer = ClassWriter(0) + reader.accept(ClassRemapper(writer, remapper), 0) + ByteArrayInputStream(writer.toByteArray()).bufferedReader(StandardCharsets.ISO_8859_1) + } + + override fun read(): Int { + return changedContents.read() + } + + override fun read(cbuf: CharArray, off: Int, len: Int): Int { + return changedContents.read(cbuf, off, len) + } + + override fun skip(n: Long): Long { + return changedContents.skip(n) + } + + override fun ready(): Boolean { + return changedContents.ready() + } + + override fun markSupported(): Boolean { + return changedContents.markSupported() + } + + override fun mark(readAheadLimit: Int) { + changedContents.mark(readAheadLimit) + } + + override fun reset() { + changedContents.reset() + } + + override fun close() { + changedContents.close() + } + +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/xyz/wagyourtail/gradle/shadow/PackageRelocator.kt b/buildSrc/src/main/kotlin/xyz/wagyourtail/gradle/shadow/PackageRelocator.kt new file mode 100644 index 0000000..cf5d247 --- /dev/null +++ b/buildSrc/src/main/kotlin/xyz/wagyourtail/gradle/shadow/PackageRelocator.kt @@ -0,0 +1,19 @@ +package xyz.wagyourtail.gradle.shadow + +import org.objectweb.asm.commons.Remapper + +/** + * @author Wagyourtail + */ +class PackageRelocator(private val map: Map) : Remapper() { + + override fun map(internalName: String): String { + for ((from, to) in map) { + if (internalName.startsWith(from)) { + return to + internalName.substring(from.length) + } + } + return internalName + } + +} diff --git a/buildSrc/src/main/kotlin/xyz/wagyourtail/gradle/shadow/ShadowJar.kt b/buildSrc/src/main/kotlin/xyz/wagyourtail/gradle/shadow/ShadowJar.kt new file mode 100644 index 0000000..7b8621a --- /dev/null +++ b/buildSrc/src/main/kotlin/xyz/wagyourtail/gradle/shadow/ShadowJar.kt @@ -0,0 +1,74 @@ +package xyz.wagyourtail.gradle.shadow + +import org.gradle.api.file.FileCollection +import org.gradle.api.provider.ListProperty +import org.gradle.api.provider.MapProperty +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.Internal +import org.gradle.api.tasks.Optional +import org.gradle.api.tasks.TaskAction +import org.gradle.jvm.tasks.Jar +import java.nio.charset.StandardCharsets + +/** + * @author Wagyourtail + */ +abstract class ShadowJar : Jar() { + + @get:Internal + abstract val shadowContents: ListProperty + + @get:Input + @get:Optional + abstract val relocatePackages: MapProperty + + init { + group = "Shadow" + description = "Shadow the jar with the specified configurations" + + shadowContents.convention(mutableListOf()).finalizeValueOnRead() + relocatePackages.convention(mutableMapOf()).finalizeValueOnRead() + archiveClassifier.convention("all") + } + + fun relocate(from: String, to: String) { + relocatePackages.put(from, to) + } + + @TaskAction + fun runTask() { + for (fileCollection in shadowContents.get()) { + for (file in fileCollection) { + if (!file.exists()) continue + if (file.isDirectory) { + // copy directory + from(file) + } else { + // copy file + from(project.zipTree(file)) + } + } + } + + filteringCharset = StandardCharsets.ISO_8859_1.name() + includeEmptyDirs = false + + if (relocatePackages.getOrElse(emptyMap()).isNotEmpty()) { + val map = relocatePackages.get() + .mapKeys { it.key.replace('.', '/') } + .mapKeys { if (!it.key.endsWith("/")) it.key + "/" else it.key } + .mapValues { it.value.replace('.', '/') } + .mapValues { if (!it.value.endsWith("/")) it.value + "/" else it.value } + val rel = PackageRelocator(map) + eachFile { + if (!path.endsWith(".class")) return@eachFile + path = rel.map(path) + filter(mapOf("remapper" to rel), PackageRelocateReader::class.java) + } + } + + // call super + copy() + } + +} \ No newline at end of file diff --git a/common/build.gradle.kts b/common/build.gradle.kts deleted file mode 100644 index 1af239e..0000000 --- a/common/build.gradle.kts +++ /dev/null @@ -1,25 +0,0 @@ -architectury { - common { - for(p in rootProject.subprojects.filter { it != project }) { - add(p.name) - } - } -} - -dependencies { - modCompileOnly("net.fabricmc:fabric-loader:${"fabric"()}") - - modCompileOnly("com.simibubi.create:create-fabric-${"minecraft_version"()}:${"create_fabric"()}+mc${"minecraft_version"()}") { - exclude(group = "com.github.llamalad7.mixinextras", module = "mixinextras-fabric") - exclude(group = "net.fabricmc.fabric-api") // fabric access wideners are not safe to use - } -} - -tasks.processResources { - from(rootProject.file("LICENSE")) { - rename { "${it}_${"archives_base_name"()}" } - } -} - -operator fun String.invoke(): String = rootProject.ext[this] as? String - ?: error("Property $this is not defined") diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index ecc1c6b..cad7cbc 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -1,40 +1,53 @@ -plugins { - id("com.github.johnrengelman.shadow") - id("platform") +import xyz.wagyourtail.unimined.api.unimined + +val modLocalRuntime: Configuration by configurations.creating { + configurations.runtimeClasspath.get().extendsFrom(this) + isCanBeConsumed = false + isCanBeResolved = true } -architectury.fabric() +unimined.minecraft { + fabric { + loader("fabric_version"()) + } + + mods { + remap(modLocalRuntime) -configurations { - "developmentFabric" { - extendsFrom(getByName("common")) + modImplementation { + catchAWNamespaceAssertion() + } } } -dependencies { - modImplementation("net.fabricmc:fabric-loader:${"fabric"()}") - modImplementation("net.fabricmc.fabric-api:fabric-api:${"fabric_api"()}+${"minecraft_version"()}") +repositories { + maven("https://maven.tterrag.com") + maven("https://mvn.devos.one/snapshots") + maven("https://maven.cafeteria.dev/releases") + maven("https://maven.jamieswhiteshirt.com/libs-release") + maven("https://maven.theillusivec4.top") + maven("https://jitpack.io") + maven("https://maven.terraformersmc.com") +} - modImplementation("com.terraformersmc:modmenu:${"modmenu"()}") +dependencies { + modImplementation("net.fabricmc.fabric-api:fabric-api:${"fabric_api_version"()}+${"minecraft_version"()}") - modImplementation("com.simibubi.create:create-fabric-${"minecraft_version"()}:${"create_fabric"()}+mc${"minecraft_version"()}") { + modImplementation("com.simibubi.create:create-fabric-${"minecraft_version"()}:${"create_fabric_version"()}+mc${"minecraft_version"()}") { exclude(group = "com.github.llamalad7.mixinextras", module = "mixinextras-fabric") } + modImplementation("com.terraformersmc:modmenu:${"modmenu_version"()}") + // have deprecated modules present at runtime only if("minecraft_version"() != "1.18.2") { - modLocalRuntime("net.fabricmc.fabric-api:fabric-api-deprecated:${"fabric_api"()}+${"minecraft_version"()}") + modLocalRuntime("net.fabricmc.fabric-api:fabric-api-deprecated:${"fabric_api_version"()}+${"minecraft_version"()}") } // Dev Env Optimizations - if (rootProject.hasProperty("lazydfu")) { - modRuntimeOnly("maven.modrinth:lazydfu:${"lazydfu"()}") + if (rootProject.hasProperty("lazydfu_version")) { + modLocalRuntime("maven.modrinth:lazydfu:${"lazydfu_version"()}") } } -tasks.remapJar { - injectAccessWidener.set(true) -} - -operator fun String.invoke(): String = rootProject.ext[this] as? String - ?: error("Property $this is not defined") +operator fun String.invoke(): String = rootProject.ext[this] as? String ?: error("Property $this is not defined") \ No newline at end of file diff --git a/fabric/gradle.properties b/fabric/gradle.properties deleted file mode 100644 index 8d52355..0000000 --- a/fabric/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -fabric.loom.disableProjectDependentMods = true \ No newline at end of file diff --git a/fabric/run/config/fabric_loader_dependencies.json b/fabric/run/client/config/fabric_loader_dependencies.json similarity index 100% rename from fabric/run/config/fabric_loader_dependencies.json rename to fabric/run/client/config/fabric_loader_dependencies.json diff --git a/fabric/run/server/config/fabric_loader_dependencies.json b/fabric/run/server/config/fabric_loader_dependencies.json new file mode 100644 index 0000000..cd0884b --- /dev/null +++ b/fabric/run/server/config/fabric_loader_dependencies.json @@ -0,0 +1,11 @@ +{ + "version": 1, + "overrides": { + "forgeconfigapiport": { + "-depends": { + "com_electronwill_night-config_core": "", + "com_electronwill_night-config_toml": "" + } + } + } +} \ No newline at end of file diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index ee1ade9..dd70e9b 100755 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "createunlimited", - "version": "${version}", + "version": "${mod_version}", "name": "Create Unlimited", "description": "Remove all the limits!", "authors": [ "rdh" ], @@ -22,9 +22,9 @@ ], "depends": { "minecraft": ["1.19.2", "1.20.1"], - "fabricloader": ">=${fabric}", + "fabricloader": ">=${fabric_version}", "fabric-api": "*", - "create": ">=${create}-a" + "create": ">=${create_version}-a" }, "custom": { "modmenu": { diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index 94f128a..d435832 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -1,45 +1,50 @@ -plugins { - id("com.github.johnrengelman.shadow") - id("platform") -} - -architectury.forge() +import xyz.wagyourtail.unimined.api.unimined +import xyz.wagyourtail.unimined.internal.minecraft.patch.forge.ForgeLikeMinecraftTransformer +import xyz.wagyourtail.unimined.util.OSUtils + +unimined.minecraft { + minecraftForge { + loader("forge_version"()) + mixinConfig("createunlimited.mixins.json") + } -configurations { - "developmentForge" { - extendsFrom(getByName("common")) + mappings { + stub.withMappings("searge", "mojmap") { + c(when (minecraft.version) { + "1.19.2" -> "exm" + "1.20.1" -> "fho" + else -> error("no ParticleEngine mapping for ${minecraft.version}") + }, listOf("net/minecraft/client/particle/ParticleEngine")) { + f("[nothing]", "Ljava/util/Map;", "f_107293_", "providers") + } + } } -} -dependencies { - forge("net.minecraftforge:forge:${"minecraft_version"()}-${"forge"()}") - modImplementation("com.simibubi.create:create-${"minecraft_version"()}:${"create_forge"()}:slim") { isTransitive = false } - modImplementation("com.tterrag.registrate:Registrate:${"registrate"()}") - modImplementation("com.jozufozu.flywheel:flywheel-forge-${"flywheel_mc"()}:${"flywheel"()}") - forgeRuntimeLibrary("io.github.llamalad7:mixinextras-common:${"mixin_extras"()}") - include("io.github.llamalad7:mixinextras-forge:${"mixin_extras"()}") + runs.config("client") { + jvmArgs( + "-Dmixin.env.remapRefMap=true", + "-Dmixin.env.refMapRemappingFile=${(mcPatcher as ForgeLikeMinecraftTransformer).srgToMCPAsSRG}" + ) - // Dev Env Optimizations - if(rootProject.hasProperty("bmb")) { - modRuntimeOnly("curse.maven:better-mods-button-541584:${"bmb"()}") - } - if(rootProject.hasProperty("catalogue")) { - modRuntimeOnly("curse.maven:catalogue-459701:${"catalogue"()}") + if(OSUtils.oSId == OSUtils.OSX) { + // for some reason this doesn't get inserted automatically on forge? + jvmArgs("-XstartOnFirstThread") + } } } -loom { - forge { - mixinConfig( - "createunlimited.mixins.json", - ) - } +repositories { + maven("https://maven.tterrag.com") } -tasks.shadowJar { - exclude("fabric.mod.json") +dependencies { + modImplementation("com.simibubi.create:create-${"minecraft_version"()}:${"create_forge_version"()}:slim") { isTransitive = false } + modImplementation("com.tterrag.registrate:Registrate:${"registrate_version"()}") + modImplementation("com.jozufozu.flywheel:flywheel-forge-${"flywheel_mc_version"()}:${"flywheel_version"()}") + implementation("io.github.llamalad7:mixinextras-forge:${"mixin_extras_version"()}") { + "include"(this) + } } -operator fun String.invoke(): String = rootProject.ext[this] as? String - ?: error("Property $this is not defined") +operator fun String.invoke(): String = rootProject.ext[this] as? String ?: error("Property $this is not defined") \ No newline at end of file diff --git a/forge/gradle.properties b/forge/gradle.properties deleted file mode 100755 index 32f842a..0000000 --- a/forge/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -loom.platform=forge \ No newline at end of file diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index d255073..9fdeb8d 100755 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -5,7 +5,7 @@ license = "GPL-3.0-or-later" [[mods]] modId = "createunlimited" -version = "${version}" +version = "${mod_version}" displayName = "Create Unlimited" authors = "rdh" description = ''' @@ -23,13 +23,13 @@ side = "BOTH" [[dependencies.createunlimited]] modId = "minecraft" mandatory = true -versionRange = "${minecraft}" +versionRange = "${minecraft_version}" ordering = "AFTER" side = "BOTH" [[dependencies.createunlimited]] modId="create" mandatory=true -versionRange="[${create},)" +versionRange="[${create_version},)" ordering="AFTER" side="BOTH" diff --git a/gradle.properties b/gradle.properties index 255cc1c..7406e90 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.daemon = false org.gradle.parallel = true org.gradle.caching = true -# loom go brrrrr -fabric.loom.disableProjectDependentMods = true -fabric.loom.multiProjectOptimisation = false +# configuration +strip_lvts = true +mixin.debug = true +git_max_changes = 10 # gradle plugin versions -arch_plugin_version = 3.4.155 -loom_version = 1.4.380 -forgix_version = 1.2.9 -shadow_version = 8.1.1 +unimined_version = 1.3.3 +expectplatform_version = 1.0.5 +proguard_version = 7.5.0 # the mc version to compile against (see their respective property files for version-specific stuff) mcVer = 1.19.2 @@ -23,13 +23,10 @@ mod_version = 0.6.3 maven_group = dev.rdh archives_base_name = createunlimited -fabric = 0.15.11 - -# compiler go brrrrr -manifold_version = 2024.1.15 -strip_lvts = true -mixin.debug = true - -# mixin -mixin_extras = 0.3.5 -mixin_squared = 0.0.2 \ No newline at end of file +# common dependencies +java_version = 17 +fabric_version = 0.15.11 +manifold_version = 2024.1.20 +mixin_version = 0.8.5 +mixin_extras_version = 0.4.0 +asm_version = 9.7 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23..09523c0 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..25da30d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/proguard.pro b/proguard.pro new file mode 100644 index 0000000..9a67fc8 --- /dev/null +++ b/proguard.pro @@ -0,0 +1,24 @@ +-ignorewarnings +-dontnote +-dontobfuscate +-optimizationpasses 10 +-optimizations !class/merging/*,!method/marking/private,!method/marking/static,!*/specialization/*,!method/removal/parameter +-allowaccessmodification +#noinspection ShrinkerInvalidFlags +-optimizeaggressively +-keepattributes Runtime*Annotations,AnnotationDefault # keep annotations + +-keep,allowoptimization @org.spongepowered.asm.mixin.Mixin class * { + @org.spongepowered.asm.mixin.Overwrite *; + @org.spongepowered.asm.mixin.Shadow *; +} + +-keep,allowoptimization @*.*.fml.common.Mod class * { + public (...); +} + +-keep,allowoptimization class * implements net.fabricmc.api.ModInitializer + +-keep,allowoptimization class * implements com.terraformersmc.modmenu.api.ModMenuApi + +-keep,allowoptimization class * implements org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 472b0a3..a92b5a6 100755 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,4 +1,3 @@ -include("common") include("fabric") include("forge") diff --git a/common/src/main/java/dev/rdh/createunlimited/CreateUnlimited.java b/src/main/java/dev/rdh/createunlimited/CreateUnlimited.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/CreateUnlimited.java rename to src/main/java/dev/rdh/createunlimited/CreateUnlimited.java diff --git a/common/src/main/java/dev/rdh/createunlimited/Util.java b/src/main/java/dev/rdh/createunlimited/Util.java similarity index 93% rename from common/src/main/java/dev/rdh/createunlimited/Util.java rename to src/main/java/dev/rdh/createunlimited/Util.java index 500ccc3..00de09c 100644 --- a/common/src/main/java/dev/rdh/createunlimited/Util.java +++ b/src/main/java/dev/rdh/createunlimited/Util.java @@ -2,8 +2,6 @@ import com.mojang.brigadier.arguments.ArgumentType; -import dev.architectury.injectables.annotations.ExpectPlatform; - import com.simibubi.create.foundation.config.ConfigBase.CValue; import com.simibubi.create.foundation.config.ConfigBase.ConfigBool; @@ -16,6 +14,8 @@ import net.minecraftforge.fml.config.IConfigSpec; import net.minecraftforge.fml.config.ModConfig; +import xyz.wagyourtail.unimined.expect.annotation.ExpectPlatform; + public abstract class Util { @ExpectPlatform @@ -53,7 +53,7 @@ public static > V orElse(CValue value, V orEls try { return value.get(); } catch (IllegalStateException e) { - if(e.message.contains("config")) { + if(e.getMessage().contains("config")) { return orElse; } throw e; diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/Asm.java b/src/main/java/dev/rdh/createunlimited/asm/Asm.java similarity index 73% rename from common/src/main/java/dev/rdh/createunlimited/asm/Asm.java rename to src/main/java/dev/rdh/createunlimited/asm/Asm.java index bd8b5b1..c9328ab 100644 --- a/common/src/main/java/dev/rdh/createunlimited/asm/Asm.java +++ b/src/main/java/dev/rdh/createunlimited/asm/Asm.java @@ -48,29 +48,33 @@ public static void instrumentTrackPlacement(ClassNode targetClass) { ISTORE [lvtIndex] */ - InsnList toInject = new InsnList(); - // get CUConfigs.server.placementChecks - toInject.add(new FieldInsnNode(GETSTATIC, Type.getInternalName(CUConfigs.class), "server", Type.getDescriptor(CUServer.class))); - toInject.add(new FieldInsnNode(GETFIELD, Type.getInternalName(CUServer.class), "placementChecks", Type.getDescriptor(ConfigEnum.class))); + AbstractInsnNode[] toInject = new AbstractInsnNode[] { + // get CUConfigs.server.placementChecks + new FieldInsnNode(GETSTATIC, Type.getInternalName(CUConfigs.class), "server", Type.getDescriptor(CUServer.class)), + new FieldInsnNode(GETFIELD, Type.getInternalName(CUServer.class), "placementChecks", Type.getDescriptor(ConfigEnum.class)), - // get PlacementCheck.ON - toInject.add(new FieldInsnNode(GETSTATIC, Type.getInternalName(PlacementCheck.class), "ON", Type.getDescriptor(PlacementCheck.class))); + // get PlacementCheck.ON + new FieldInsnNode(GETSTATIC, Type.getInternalName(PlacementCheck.class), "ON", Type.getDescriptor(PlacementCheck.class)), - // call Util.orElse(CUConfigs.server.placementChecks, PlacementCheck.ON) - toInject.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(Util.class), "orElse", Type.getMethodDescriptor(Type.getType(Object.class), Type.getType(CValue.class), Type.getType(Object.class)))); + // call Util.orElse(CUConfigs.server.placementChecks, PlacementCheck.ON) + new MethodInsnNode(INVOKESTATIC, Type.getInternalName(Util.class), "orElse", Type.getMethodDescriptor(Type.getType(Object.class), Type.getType(CValue.class), Type.getType(Object.class))), - // cast result of orElse to PlacementCheck - toInject.add(new TypeInsnNode(CHECKCAST, Type.getInternalName(PlacementCheck.class))); + // cast result of orElse to PlacementCheck + new TypeInsnNode(CHECKCAST, Type.getInternalName(PlacementCheck.class)), - // load player (second argument of tryConnect) - toInject.add(new VarInsnNode(ALOAD, 1)); + // load player (second argument of tryConnect) + new VarInsnNode(ALOAD, 1), - // call isEnabledFor(player) on the PlacementCheck from above - toInject.add(new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(PlacementCheck.class), "isEnabledFor", Type.getMethodDescriptor(Type.BOOLEAN_TYPE, Type.getType(Player.class)))); + // call isEnabledFor(player) on the PlacementCheck from above + new MethodInsnNode(INVOKEVIRTUAL, Type.getInternalName(PlacementCheck.class), "isEnabledFor", Type.getMethodDescriptor(Type.BOOLEAN_TYPE, Type.getType(Player.class))), - // store result of isEnabledFor in local variable - toInject.add(new VarInsnNode(ISTORE, lvtIndex)); - tryConnect.instructions.insert(toInject); + // store result of isEnabledFor in local variable + new VarInsnNode(ISTORE, lvtIndex), + }; + + for(int i = toInject.length - 1; i >= 0; i--) { + tryConnect.instructions.insert(toInject[i]); + } } Set targetMessages = Set.of( diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/CUMixinConfig.java b/src/main/java/dev/rdh/createunlimited/asm/CUMixinConfig.java similarity index 92% rename from common/src/main/java/dev/rdh/createunlimited/asm/CUMixinConfig.java rename to src/main/java/dev/rdh/createunlimited/asm/CUMixinConfig.java index d08325c..f34d5bb 100644 --- a/common/src/main/java/dev/rdh/createunlimited/asm/CUMixinConfig.java +++ b/src/main/java/dev/rdh/createunlimited/asm/CUMixinConfig.java @@ -1,7 +1,5 @@ package dev.rdh.createunlimited.asm; -import com.llamalad7.mixinextras.MixinExtrasBootstrap; - import org.objectweb.asm.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; import org.spongepowered.asm.mixin.extensibility.IMixinInfo; @@ -12,7 +10,6 @@ public final class CUMixinConfig implements IMixinConfigPlugin { @Override public void onLoad(String mixinPackage) { - MixinExtrasBootstrap.init(); } @Override diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/CopycatBlockMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/CopycatBlockMixin.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/asm/mixin/CopycatBlockMixin.java rename to src/main/java/dev/rdh/createunlimited/asm/mixin/CopycatBlockMixin.java diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/ExtendoGripItemMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/ExtendoGripItemMixin.java similarity index 87% rename from common/src/main/java/dev/rdh/createunlimited/asm/mixin/ExtendoGripItemMixin.java rename to src/main/java/dev/rdh/createunlimited/asm/mixin/ExtendoGripItemMixin.java index 6d058a9..67a6b4d 100644 --- a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/ExtendoGripItemMixin.java +++ b/src/main/java/dev/rdh/createunlimited/asm/mixin/ExtendoGripItemMixin.java @@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; -import dev.architectury.injectables.annotations.PlatformOnly; +import xyz.wagyourtail.unimined.expect.annotation.PlatformOnly; import dev.rdh.createunlimited.Util; import dev.rdh.createunlimited.config.CUConfigs; @@ -24,51 +24,45 @@ import java.util.UUID; import java.util.function.Supplier; -@Mixin(value = ExtendoGripItem.class, remap = false) +@Mixin(value = ExtendoGripItem.class) public abstract class ExtendoGripItemMixin { - // the annotation processor is a little broken so we have to specify `remap = false` and use the obfuscated names - @Dynamic + @PlatformOnly(PlatformOnly.FABRIC) @ModifyExpressionValue(method = { "holdingExtendoGripIncreasesRange(Lnet/minecraft/world/entity/LivingEntity;)V", - "holdingExtendoGripIncreasesRange(Lnet/minecraft/class_1309;)V", "addReachToJoiningPlayersHoldingExtendo(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/nbt/CompoundTag;)V", - "addReachToJoiningPlayersHoldingExtendo(Lnet/minecraft/class_1297;Lnet/minecraft/class_2487;)V", }, at = @At(value = "FIELD", target = "Lcom/simibubi/create/content/equipment/extendoGrip/ExtendoGripItem;rangeModifier:Ljava/util/function/Supplier;")) - @PlatformOnly(PlatformOnly.FABRIC) private static Supplier> modifySingleFabric(Supplier original) { return cu$singleRange(); } @Dynamic + @PlatformOnly(PlatformOnly.FORGE) @ModifyExpressionValue(method = { "holdingExtendoGripIncreasesRange(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V", "addReachToJoiningPlayersHoldingExtendo(Lnet/minecraftforge/event/entity/player/PlayerEvent$PlayerLoggedInEvent;)V" }, at = @At(value = "FIELD", target = "Lcom/simibubi/create/content/equipment/extendoGrip/ExtendoGripItem;rangeModifier:Ljava/util/function/Supplier;")) - @PlatformOnly(PlatformOnly.FORGE) private static Supplier> modifySingleForge(Supplier original) { return cu$singleRange(); } @Dynamic + @PlatformOnly(PlatformOnly.FABRIC) @ModifyExpressionValue(method = { "holdingExtendoGripIncreasesRange(Lnet/minecraft/world/entity/LivingEntity;)V", - "holdingExtendoGripIncreasesRange(Lnet/minecraft/class_1309;)V", "addReachToJoiningPlayersHoldingExtendo(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/nbt/CompoundTag;)V", - "addReachToJoiningPlayersHoldingExtendo(Lnet/minecraft/class_1297;Lnet/minecraft/class_2487;)V", }, at = @At(value = "FIELD", target = "Lcom/simibubi/create/content/equipment/extendoGrip/ExtendoGripItem;doubleRangeModifier:Ljava/util/function/Supplier;")) - @PlatformOnly(PlatformOnly.FABRIC) private static Supplier> modifyDoubleFabric(Supplier original) { return cu$doubleRange(); } @Dynamic + @PlatformOnly(PlatformOnly.FORGE) @ModifyExpressionValue(method = { "holdingExtendoGripIncreasesRange(Lnet/minecraftforge/event/entity/living/LivingEvent$LivingTickEvent;)V", "addReachToJoiningPlayersHoldingExtendo(Lnet/minecraftforge/event/entity/player/PlayerEvent$PlayerLoggedInEvent;)V" }, at = @At(value = "FIELD", target = "Lcom/simibubi/create/content/equipment/extendoGrip/ExtendoGripItem;doubleRangeModifier:Ljava/util/function/Supplier;")) - @PlatformOnly(PlatformOnly.FORGE) private static Supplier> modifyDoubleForge(Supplier original) { return cu$doubleRange(); } diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/accessor/CValueAccessor.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/accessor/CValueAccessor.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/asm/mixin/accessor/CValueAccessor.java rename to src/main/java/dev/rdh/createunlimited/asm/mixin/accessor/CValueAccessor.java diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/glue/SuperGlueSectionHandlerMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/glue/SuperGlueSectionHandlerMixin.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/asm/mixin/glue/SuperGlueSectionHandlerMixin.java rename to src/main/java/dev/rdh/createunlimited/asm/mixin/glue/SuperGlueSectionHandlerMixin.java diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/glue/SuperGlueSelectionPacketMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/glue/SuperGlueSelectionPacketMixin.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/asm/mixin/glue/SuperGlueSelectionPacketMixin.java rename to src/main/java/dev/rdh/createunlimited/asm/mixin/glue/SuperGlueSelectionPacketMixin.java diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/CTrainsMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/train/CTrainsMixin.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/CTrainsMixin.java rename to src/main/java/dev/rdh/createunlimited/asm/mixin/train/CTrainsMixin.java diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/CarriageContraptionMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/train/CarriageContraptionMixin.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/CarriageContraptionMixin.java rename to src/main/java/dev/rdh/createunlimited/asm/mixin/train/CarriageContraptionMixin.java diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/StationBlockEntityMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/train/StationBlockEntityMixin.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/StationBlockEntityMixin.java rename to src/main/java/dev/rdh/createunlimited/asm/mixin/train/StationBlockEntityMixin.java diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackEdgeMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackEdgeMixin.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackEdgeMixin.java rename to src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackEdgeMixin.java diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackPlacementMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackPlacementMixin.java similarity index 93% rename from common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackPlacementMixin.java rename to src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackPlacementMixin.java index 9be28fe..9715a07 100755 --- a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackPlacementMixin.java +++ b/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackPlacementMixin.java @@ -29,7 +29,6 @@ private static double[] modifyIntersect3(Vec3 p1, Vec3 p2, Vec3 r, Vec3 s, Axis } @Unique - @SuppressWarnings("SuspiciousNameCombination") // javac doesn't like when we pass a value called "y" to a method that expects a value called "x" private static double[] cu$intersect(Vec3 p1, Vec3 p2, Vec3 r, Vec3 s, Axis plane) { if (plane == Axis.X) { p1 = new Vec3(p1.y, 0, p1.z); diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackTargetingBlockItemMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackTargetingBlockItemMixin.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackTargetingBlockItemMixin.java rename to src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrackTargetingBlockItemMixin.java diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrainMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrainMixin.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrainMixin.java rename to src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrainMixin.java diff --git a/common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrainRelocatorMixin.java b/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrainRelocatorMixin.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrainRelocatorMixin.java rename to src/main/java/dev/rdh/createunlimited/asm/mixin/train/TrainRelocatorMixin.java diff --git a/common/src/main/java/dev/rdh/createunlimited/command/CUCommands.java b/src/main/java/dev/rdh/createunlimited/command/CUCommands.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/command/CUCommands.java rename to src/main/java/dev/rdh/createunlimited/command/CUCommands.java diff --git a/common/src/main/java/dev/rdh/createunlimited/command/CUConfigCommand.java b/src/main/java/dev/rdh/createunlimited/command/CUConfigCommand.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/command/CUConfigCommand.java rename to src/main/java/dev/rdh/createunlimited/command/CUConfigCommand.java diff --git a/common/src/main/java/dev/rdh/createunlimited/command/EnumArgument.java b/src/main/java/dev/rdh/createunlimited/command/EnumArgument.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/command/EnumArgument.java rename to src/main/java/dev/rdh/createunlimited/command/EnumArgument.java diff --git a/common/src/main/java/dev/rdh/createunlimited/config/CUConfigs.java b/src/main/java/dev/rdh/createunlimited/config/CUConfigs.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/config/CUConfigs.java rename to src/main/java/dev/rdh/createunlimited/config/CUConfigs.java diff --git a/common/src/main/java/dev/rdh/createunlimited/config/CUServer.java b/src/main/java/dev/rdh/createunlimited/config/CUServer.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/config/CUServer.java rename to src/main/java/dev/rdh/createunlimited/config/CUServer.java diff --git a/common/src/main/java/dev/rdh/createunlimited/multiversion/SupportedMinecraftVersion.java b/src/main/java/dev/rdh/createunlimited/multiversion/SupportedMinecraftVersion.java similarity index 100% rename from common/src/main/java/dev/rdh/createunlimited/multiversion/SupportedMinecraftVersion.java rename to src/main/java/dev/rdh/createunlimited/multiversion/SupportedMinecraftVersion.java diff --git a/common/src/main/resources/createunlimited.mixins.json b/src/main/resources/createunlimited.mixins.json similarity index 100% rename from common/src/main/resources/createunlimited.mixins.json rename to src/main/resources/createunlimited.mixins.json diff --git a/common/src/main/resources/icon.png b/src/main/resources/icon.png similarity index 100% rename from common/src/main/resources/icon.png rename to src/main/resources/icon.png diff --git a/versionProperties/1.19.2.properties b/versionProperties/1.19.2.properties index b68e7a5..85ef224 100755 --- a/versionProperties/1.19.2.properties +++ b/versionProperties/1.19.2.properties @@ -1,35 +1,36 @@ # suppress inspection "UnusedProperty" for whole file + minecraft_version = 1.19.2 ## Mappings # https://lambdaurora.dev/tools/import_quilt.html -quilt = 22 +quilt_mappings_version = 22 # https://parchmentmc.org/docs/getting-started -parchment = 2022.11.27 +parchment_version = 2022.11.27 # Fabric - https://fabricmc.net/develop/ -fabric_api = 0.76.0 +fabric_api_version = 0.76.0 # Forge - https://files.minecraftforge.net/net/minecraftforge/forge/index_1.19.html -forge = 43.2.4 +forge_version = 43.2.4 ## Create # https://mvn.devos.one/#/snapshots/com/simibubi/create/create-fabric-1.19.2 -create_fabric = 0.5.1-f-build.1221 +create_fabric_version = 0.5.1-f-build.1221 # https://github.com/Creators-of-Create/Create/wiki/Depending-on-Create -create_forge = 0.5.1.f-46 -registrate = MC1.19-1.1.5 -flywheel_mc = 1.19.2 -flywheel = 0.6.10-20 +create_forge_version = 0.5.1.f-46 +registrate_version = MC1.19-1.1.5 +flywheel_mc_version = 1.19.2 +flywheel_version = 0.6.10-20 ## Fabric Mods # https://modrinth.com/mod/lazydfu/versions -lazydfu = 0.1.3 +lazydfu_version = 0.1.3 # https://modrinth.com/mod/modmenu/versions?g=1.19.2 -modmenu = 4.2.0-beta.2 +modmenu_version = 4.2.0-beta.2 ## Forge Mods # Better Mods Button - https://www.curseforge.com/minecraft/mc-mods/better-mods-button/files?version=1.19.2 -bmb = 4665753 +bmb_version = 4665753 # Catalogue - https://www.curseforge.com/minecraft/mc-mods/catalogue/files?version=1.19.2 -catalogue = 4171024 \ No newline at end of file +catalogue_version = 4171024 \ No newline at end of file diff --git a/versionProperties/1.20.1.properties b/versionProperties/1.20.1.properties index 17208dd..62d7eea 100755 --- a/versionProperties/1.20.1.properties +++ b/versionProperties/1.20.1.properties @@ -1,35 +1,36 @@ # suppress inspection "UnusedProperty" for whole file + minecraft_version = 1.20.1 ## Mappings # https://lambdaurora.dev/tools/import_quilt.html -quilt = 20 +quilt_mappings_version = 20 # https://parchmentmc.org/docs/getting-started -parchment = 2023.09.03 +parchment_version = 2023.09.03 # Fabric - https://fabricmc.net/develop/ -fabric_api = 0.86.0 +fabric_api_version = 0.86.0 # Forge - https://files.minecraftforge.net/net/minecraftforge/forge/index_1.19.html -forge = 47.1.43 +forge_version = 47.1.43 ## Create # https://mvn.devos.one/#/snapshots/com/simibubi/create/create-fabric-1.20.1 -create_fabric = 0.5.1-f-build.1232 +create_fabric_version = 0.5.1-f-build.1232 # https://github.com/Creators-of-Create/Create/wiki/Depending-on-Create -create_forge = 0.5.1.f-26 -registrate = MC1.20-1.3.3 -flywheel_mc = 1.20.1 -flywheel = 0.6.10-7 +create_forge_version = 0.5.1.f-26 +registrate_version = MC1.20-1.3.3 +flywheel_mc_version = 1.20.1 +flywheel_version = 0.6.10-7 ## Fabric Mods # https://modrinth.com/mod/lazydfu/versions -lazydfu = 0.1.3 +lazydfu_version = 0.1.3 # https://modrinth.com/mod/modmenu/versions?g=1.20.1 -modmenu = 7.2.2 +modmenu_version = 7.2.2 ## Forge Mods # Better Mods Button - https://www.curseforge.com/minecraft/mc-mods/better-mods-button/files -bmb = 4613425 +bmb_version = 4613425 # Catalogue - https://www.curseforge.com/minecraft/mc-mods/catalogue/files -catalogue = 4590890 \ No newline at end of file +catalogue_version = 4590890 \ No newline at end of file