forked from mirrors/cobblemon
Compare commits
7
Commits
1.7.0
...
moddevgradle
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
263bccca4b | ||
|
|
1d94adface | ||
|
|
c741ddbc2e | ||
|
|
8cad44ffb1 | ||
|
|
dec0376d11 | ||
|
|
007b2a49f4 | ||
|
|
082683723d |
@@ -0,0 +1,27 @@
|
||||
plugins {
|
||||
id("java-gradle-plugin")
|
||||
kotlin("jvm") version "2.1.0"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.architectury.dev/")
|
||||
maven("https://maven.fabricmc.net/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("net.neoforged:moddev-gradle:2.0.75")
|
||||
implementation("dev.architectury:at:1.0.1")
|
||||
implementation("net.fabricmc:access-widener:2.1.0")
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
create("cobblemongradle") {
|
||||
id = "com.cobblemon.gradle"
|
||||
implementationClass = "com.cobblemon.gradle.CobblemonGradle"
|
||||
version = "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
dependencyResolutionManagement {
|
||||
versionCatalogs {
|
||||
create("libs") {
|
||||
from(files("../gradle/libs.versions.toml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.cobblemon.gradle
|
||||
|
||||
import com.cobblemon.gradle.extension.CobblemonGradleExtension
|
||||
import com.cobblemon.gradle.extension.tasks.ConvertAccessWidenersTask
|
||||
import com.cobblemon.gradle.extension.tasks.UnzipAccessWidenersTask
|
||||
import net.neoforged.nfrtgradle.CreateMinecraftArtifacts
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.attributes.LibraryElements
|
||||
import org.gradle.language.jvm.tasks.ProcessResources
|
||||
|
||||
class CobblemonGradle : Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
val cobblemonExtension = project.extensions.create(
|
||||
CobblemonGradleExtension.EXTENSION_NAME,
|
||||
CobblemonGradleExtension::class.java
|
||||
)
|
||||
|
||||
//This exists because all of
|
||||
// - com.cobblemon:mod
|
||||
// - com.cobblemon:mod-resources
|
||||
// - com.cobblemon:accesswidener
|
||||
//technically point to the same dependency (the :common project). To pick the proper artifact from that project
|
||||
//we set attributes in that project and check for them here.
|
||||
val accessWideners = project.configurations.register("accessWidener") { configuration ->
|
||||
configuration.isCanBeConsumed = false
|
||||
configuration.isCanBeResolved = true
|
||||
configuration.isCanBeDeclared = true
|
||||
configuration.attributes {
|
||||
it.attribute(
|
||||
LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
|
||||
project.objects.named(LibraryElements::class.java, LibraryElements.OBJECTS)
|
||||
)
|
||||
}
|
||||
}
|
||||
val includeRootResources = project.configurations.register("includeRootResources") { configuration ->
|
||||
configuration.isCanBeConsumed = false
|
||||
configuration.isCanBeResolved = true
|
||||
configuration.isCanBeDeclared = true
|
||||
configuration.attributes {
|
||||
it.attribute(
|
||||
LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
|
||||
project.objects.named(LibraryElements::class.java, LibraryElements.RESOURCES)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val unzipAwTask = project.tasks.register("unzipAccessWideners", UnzipAccessWidenersTask::class.java) {
|
||||
it.accessWidenerZips = accessWideners.get()
|
||||
}
|
||||
|
||||
|
||||
val convertAwTask = project.tasks.register(ConvertAccessWidenersTask.NAME, ConvertAccessWidenersTask::class.java) {
|
||||
it.enabled = cobblemonExtension.convertAccessWideners
|
||||
it.dependsOn(unzipAwTask)
|
||||
it.accessWideners = project.files(unzipAwTask).plus(project.files(cobblemonExtension.additionalAccessWideners))
|
||||
}
|
||||
|
||||
//Add root resources and access wideners to output jar
|
||||
project.tasks.named("processResources", ProcessResources::class.java) { task ->
|
||||
task.dependsOn(includeRootResources)
|
||||
if (cobblemonExtension.convertAccessWideners) {
|
||||
task.dependsOn(convertAwTask)
|
||||
task.from(convertAwTask)
|
||||
}
|
||||
else {
|
||||
task.dependsOn(unzipAwTask)
|
||||
task.from(unzipAwTask)
|
||||
}
|
||||
task.doLast {
|
||||
project.copy {
|
||||
it.from(project.provider {
|
||||
includeRootResources.get().resolve().map { project.zipTree(it) }
|
||||
})
|
||||
it.into(task.destinationDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project.tasks.withType(CreateMinecraftArtifacts::class.java) {
|
||||
it.dependsOn(convertAwTask)
|
||||
it.accessTransformers.from(convertAwTask)
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.cobblemon.gradle.extension
|
||||
|
||||
import org.gradle.api.file.FileCollection
|
||||
|
||||
abstract class CobblemonGradleExtension {
|
||||
var additionalAccessWideners: FileCollection? = null
|
||||
var convertAccessWideners = true
|
||||
|
||||
companion object {
|
||||
const val EXTENSION_NAME = "cobblemon"
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.cobblemon.gradle.extension.tasks
|
||||
|
||||
import dev.architectury.at.AccessChange
|
||||
import dev.architectury.at.AccessTransform
|
||||
import dev.architectury.at.AccessTransformSet
|
||||
import dev.architectury.at.ModifierChange
|
||||
import dev.architectury.at.io.AccessTransformFormats
|
||||
import net.fabricmc.accesswidener.AccessWidenerReader
|
||||
import net.fabricmc.accesswidener.AccessWidenerVisitor
|
||||
import org.cadixdev.bombe.type.signature.MethodSignature
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.OutputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import java.io.Writer
|
||||
import java.nio.file.Files
|
||||
|
||||
abstract class ConvertAccessWidenersTask : DefaultTask() {
|
||||
abstract var accessWideners: FileCollection
|
||||
@InputFiles get
|
||||
|
||||
@Internal
|
||||
val accessTransformerDir = project.layout.buildDirectory.dir("access-transformers")
|
||||
|
||||
@OutputFiles
|
||||
val accessTransformers = project.files ({
|
||||
accessWideners.files.map {
|
||||
accessTransformerDir.get().file(it.name.replace("accesswidener", "accesstransformer.cfg"))
|
||||
}
|
||||
})
|
||||
|
||||
@TaskAction
|
||||
fun convertAccessWideners() {
|
||||
accessWideners.files.forEach { file ->
|
||||
val awFile = Files.newBufferedReader(file.toPath())
|
||||
val result = AccessTransformSet.create();
|
||||
|
||||
AccessWidenerReader(object : AccessWidenerVisitor {
|
||||
override fun visitClass(name: String, access: AccessWidenerReader.AccessType, transitive: Boolean) {
|
||||
result.getOrCreateClass(name).merge(toAt(access));
|
||||
}
|
||||
|
||||
override fun visitMethod(owner: String, name: String, descriptor: String, access: AccessWidenerReader.AccessType, transitive: Boolean) {
|
||||
result.getOrCreateClass(owner).mergeMethod(MethodSignature.of(name, descriptor), toAt(access));
|
||||
}
|
||||
|
||||
override fun visitField(owner: String, name: String, descriptor: String, access: AccessWidenerReader.AccessType, transitive: Boolean) {
|
||||
result.getOrCreateClass(owner).mergeField(name, toAt(access));
|
||||
}
|
||||
}).read(awFile)
|
||||
|
||||
val outputFile = accessTransformerDir.get().file(
|
||||
file.name.replace("accesswidener", "accesstransformer.cfg")
|
||||
)
|
||||
var outputWriter: Writer? = null
|
||||
try {
|
||||
outputWriter = outputFile.asFile.writer()
|
||||
AccessTransformFormats.FML.write(outputWriter, result)
|
||||
}
|
||||
finally {
|
||||
outputWriter?.flush()
|
||||
outputWriter?.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun toAt(access: AccessWidenerReader.AccessType): AccessTransform {
|
||||
return when (access) {
|
||||
AccessWidenerReader.AccessType.ACCESSIBLE -> AccessTransform.of(AccessChange.PUBLIC)
|
||||
AccessWidenerReader.AccessType.EXTENDABLE, AccessWidenerReader.AccessType.MUTABLE -> AccessTransform.of(
|
||||
AccessChange.PUBLIC,
|
||||
ModifierChange.REMOVE
|
||||
)
|
||||
}
|
||||
}
|
||||
companion object {
|
||||
const val NAME = "convertAccessWideners"
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.cobblemon.gradle.extension.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.OutputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
abstract class UnzipAccessWidenersTask : DefaultTask() {
|
||||
abstract var accessWidenerZips: FileCollection
|
||||
@InputFiles get
|
||||
|
||||
@OutputFiles
|
||||
val outputFiles = project.provider {
|
||||
project.files(accessWidenerZips.flatMap { zip ->
|
||||
project.zipTree(zip).files.map { OUTPUT_DIR.get().file(it.name) }
|
||||
})
|
||||
}
|
||||
|
||||
@Internal
|
||||
val OUTPUT_DIR = project.layout.buildDirectory.dir("cobblemon-working/access-wideners")
|
||||
|
||||
@TaskAction
|
||||
fun run() {
|
||||
project.copy {
|
||||
it.from(accessWidenerZips.map(project::zipTree))
|
||||
it.into(OUTPUT_DIR)
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -1,12 +1,14 @@
|
||||
plugins {
|
||||
id("cobblemon.root-conventions")
|
||||
//id("cobblemon.root-conventions")
|
||||
id ("net.nemerosa.versioning") version "3.1.0"
|
||||
}
|
||||
|
||||
version = "${project.property("mod_version")}+${project.property("mc_version")}"
|
||||
|
||||
val isSnapshot = project.property("snapshot")?.equals("true") ?: false
|
||||
/*
|
||||
if (isSnapshot) {
|
||||
val fixedBranchName = versioning.info.branch.substringAfter("/")
|
||||
version = "$version-${fixedBranchName}-${versioning.info.build}"
|
||||
}
|
||||
*/
|
||||
+90
-54
@@ -1,68 +1,102 @@
|
||||
import java.time.OffsetDateTime
|
||||
import java.time.ZoneOffset
|
||||
import java.time.format.DateTimeFormatter
|
||||
import utilities.isSnapshot
|
||||
import utilities.version
|
||||
|
||||
/*
|
||||
*
|
||||
* * Copyright (C) 2023 Cobblemon Contributors
|
||||
* *
|
||||
* * This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* * License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* * file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id("cobblemon.base-conventions")
|
||||
id("cobblemon.publish-conventions")
|
||||
|
||||
id("net.kyori.blossom")
|
||||
id("org.jetbrains.gradle.plugin.idea-ext")
|
||||
id("net.nemerosa.versioning") version "3.1.0"
|
||||
kotlin("jvm") version "2.1.0"
|
||||
id ("net.neoforged.moddev") version "2.0.75"
|
||||
id("net.kyori.blossom") version "2.1.0"
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
||||
id("com.cobblemon.gradle")
|
||||
}
|
||||
|
||||
architectury {
|
||||
common("neoforge", "fabric")
|
||||
cobblemon {
|
||||
additionalAccessWideners = files(sourceSets.main.get().resources).filter { it.extension == "accesswidener" }
|
||||
}
|
||||
|
||||
val rootResources = configurations.create("rootResources") {
|
||||
isCanBeConsumed = true
|
||||
isCanBeResolved = false
|
||||
attributes {
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.RESOURCES))
|
||||
}
|
||||
}
|
||||
|
||||
val accessWidenerExport = configurations.create("accessWidenerExport") {
|
||||
isCanBeConsumed = true
|
||||
isCanBeResolved = false
|
||||
attributes {
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.OBJECTS))
|
||||
}
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
exclude("*.accesswidener")
|
||||
}
|
||||
|
||||
tasks.create<Zip>("zipResources") {
|
||||
dependsOn("processResources")
|
||||
from(tasks.processResources.get().destinationDir)
|
||||
this.archiveBaseName = "mod-resources"
|
||||
}
|
||||
|
||||
tasks.create<Zip>("zipAccessWideners") {
|
||||
from(sourceSets.main.get().resources)
|
||||
include("*.accesswidener")
|
||||
this.archiveBaseName = "mod-accesswideners"
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
archiveBaseName = "mod"
|
||||
manifest {
|
||||
attributes(mapOf("FMLModType" to "GAMELIBRARY"))
|
||||
}
|
||||
exclude {
|
||||
it.file in tasks.processResources.get().outputs.files
|
||||
}
|
||||
}
|
||||
|
||||
tasks.assemble {
|
||||
dependsOn(tasks.named("zipResources"))
|
||||
dependsOn(tasks.named("zipAccessWideners"))
|
||||
}
|
||||
|
||||
artifacts {
|
||||
add("rootResources", tasks.getByName<Zip>("zipResources"))
|
||||
add("accessWidenerExport", tasks.getByName("zipAccessWideners"))
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.architectury.dev/")
|
||||
maven("https://maven.fabricmc.net/")
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven(url = "${rootProject.projectDir}/deps")
|
||||
maven(url = "https://api.modrinth.com/maven")
|
||||
maven(url = "https://maven.neoforged.net/releases")
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
maven("https://maven.fabricmc.net/")
|
||||
maven("https://maven.blamejared.com/")
|
||||
maven("https://api.modrinth.com/maven")
|
||||
maven(url = "../deps")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.bundles.kotlin)
|
||||
modImplementation(libs.fabric.loader)
|
||||
modApi(libs.molang)
|
||||
|
||||
// Integrations
|
||||
compileOnlyApi(libs.jei.api)
|
||||
modCompileOnly(libs.bundles.fabric.integrations.compileOnly) {
|
||||
compileOnly(libs.bundles.mongo)
|
||||
compileOnly(libs.bundles.kotlin)
|
||||
compileOnly(libs.molang)
|
||||
compileOnly(libs.graal)
|
||||
compileOnly(libs.jei.api)
|
||||
compileOnly(libs.bundles.fabric.integrations.compileOnly) {
|
||||
isTransitive = false
|
||||
}
|
||||
// Flywheel has no common dep so just pick one and don't use any platform specific code in common
|
||||
// modCompileOnly(libs.flywheelFabric)
|
||||
|
||||
// Showdown
|
||||
modCompileOnly(libs.graal)
|
||||
|
||||
// Data Storage
|
||||
modCompileOnly(libs.bundles.mongo)
|
||||
|
||||
// Unit Testing
|
||||
compileOnly("net.fabricmc:sponge-mixin:0.15.5+mixin.0.8.7")
|
||||
compileOnly("io.github.llamalad7:mixinextras-fabric:0.4.1")
|
||||
testImplementation(libs.bundles.unitTesting)
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
setEvents(listOf("failed"))
|
||||
setExceptionFormat("full")
|
||||
}
|
||||
neoForge {
|
||||
neoFormVersion = "1.21.1-20240808.144430"
|
||||
interfaceInjectionData.from("src/main/resources/interfaces.json")
|
||||
validateAccessTransformers = true
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -72,7 +106,7 @@ sourceSets {
|
||||
fun generateLicenseHeader() : String {
|
||||
val builder = StringBuilder()
|
||||
builder.append("/*\n")
|
||||
rootProject.file("HEADER").forEachLine {
|
||||
project.projectDir.parentFile.resolve("HEADER").forEachLine {
|
||||
if(it.isEmpty()) {
|
||||
builder.append(" *").append("\n")
|
||||
} else {
|
||||
@@ -85,12 +119,14 @@ sourceSets {
|
||||
|
||||
property("license", generateLicenseHeader())
|
||||
property("modid", "cobblemon")
|
||||
property("version", project.version())
|
||||
property("isSnapshot", if(rootProject.isSnapshot()) "true" else "false")
|
||||
property("version", project.version as String)
|
||||
property("isSnapshot", "true")
|
||||
/*
|
||||
property("gitCommit", versioning.info.commit)
|
||||
property("branch", versioning.info.branch)
|
||||
System.getProperty("buildNumber")?.let { property("buildNumber", it) }
|
||||
property("timestamp", OffsetDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("MM/dd/yyyy hh:mm:ss")) + " UTC")
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
import java.time.OffsetDateTime
|
||||
import java.time.ZoneOffset
|
||||
import java.time.format.DateTimeFormatter
|
||||
import utilities.isSnapshot
|
||||
import utilities.version
|
||||
|
||||
/*
|
||||
*
|
||||
* * Copyright (C) 2023 Cobblemon Contributors
|
||||
* *
|
||||
* * This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* * License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* * file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id("cobblemon.base-conventions")
|
||||
id("cobblemon.publish-conventions")
|
||||
|
||||
id("net.kyori.blossom")
|
||||
id("org.jetbrains.gradle.plugin.idea-ext")
|
||||
id("net.nemerosa.versioning") version "3.1.0"
|
||||
}
|
||||
|
||||
architectury {
|
||||
common("neoforge", "fabric")
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven(url = "${rootProject.projectDir}/deps")
|
||||
maven(url = "https://api.modrinth.com/maven")
|
||||
maven(url = "https://maven.neoforged.net/releases")
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.bundles.kotlin)
|
||||
modImplementation(libs.fabric.loader)
|
||||
modApi(libs.molang)
|
||||
|
||||
// Integrations
|
||||
compileOnlyApi(libs.jei.api)
|
||||
modCompileOnly(libs.bundles.fabric.integrations.compileOnly) {
|
||||
isTransitive = false
|
||||
}
|
||||
// Flywheel has no common dep so just pick one and don't use any platform specific code in common
|
||||
// modCompileOnly(libs.flywheelFabric)
|
||||
|
||||
// Showdown
|
||||
modCompileOnly(libs.graal)
|
||||
|
||||
// Data Storage
|
||||
modCompileOnly(libs.bundles.mongo)
|
||||
|
||||
// Unit Testing
|
||||
testImplementation(libs.bundles.unitTesting)
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
setEvents(listOf("failed"))
|
||||
setExceptionFormat("full")
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
blossom {
|
||||
kotlinSources {
|
||||
fun generateLicenseHeader() : String {
|
||||
val builder = StringBuilder()
|
||||
builder.append("/*\n")
|
||||
rootProject.file("HEADER").forEachLine {
|
||||
if(it.isEmpty()) {
|
||||
builder.append(" *").append("\n")
|
||||
} else {
|
||||
builder.append(" * ").append(it).append("\n")
|
||||
}
|
||||
}
|
||||
|
||||
return builder.append(" */").append("\n").toString()
|
||||
}
|
||||
|
||||
property("license", generateLicenseHeader())
|
||||
property("modid", "cobblemon")
|
||||
property("version", project.version())
|
||||
property("isSnapshot", if(rootProject.isSnapshot()) "true" else "false")
|
||||
property("gitCommit", versioning.info.commit)
|
||||
property("branch", versioning.info.branch)
|
||||
System.getProperty("buildNumber")?.let { property("buildNumber", it) }
|
||||
property("timestamp", OffsetDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("MM/dd/yyyy hh:mm:ss")) + " UTC")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
[versions]
|
||||
# Kotlin
|
||||
kotlin = "2.0.0"
|
||||
|
||||
# Plugins
|
||||
licenser = "0.6.1"
|
||||
shadow = "8.1.1"
|
||||
blossom = "2.1.0"
|
||||
idea-ext = "1.1.7"
|
||||
|
||||
# Loom
|
||||
loom = "1.7-SNAPSHOT"
|
||||
architectury-plugin = "3.4-SNAPSHOT"
|
||||
|
||||
# Common
|
||||
molang = "1.1.18"
|
||||
graal = "22.3.0"
|
||||
icu4j = "71.1"
|
||||
jei-api = "19.8.2.99"
|
||||
|
||||
# Fabric
|
||||
fabric-loader = "0.16.5"
|
||||
fabric-api = "0.104.0+1.21.1"
|
||||
fabric-kotlin = "1.11.0+kotlin.2.0.0"
|
||||
fabric-permissions-api = "0.2-SNAPSHOT"
|
||||
lambDynamicLights = "3.0.1+1.21.1"
|
||||
debugutils-fabric = "1.21-1.0.6-fabric"
|
||||
|
||||
# NeoForge
|
||||
neoforge = "21.1.66"
|
||||
neo-kotlin-for-forge = "5.5.0"
|
||||
debugutils-forge = "1.21-1.0.6-neoforge"
|
||||
|
||||
# Data Storage
|
||||
mongo = "4.10.2"
|
||||
|
||||
# Testing
|
||||
junit = "5.9.0"
|
||||
mockito = "5.2.0"
|
||||
mockk = "1.12.1"
|
||||
classgraph = "4.8.153"
|
||||
|
||||
[libraries]
|
||||
# General Buildscript Plugins
|
||||
kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
loom = { group = "dev.architectury", name = "architectury-loom", version.ref = "loom" }
|
||||
architectury = { group = "architectury-plugin", name = "architectury-plugin.gradle.plugin", version.ref = "architectury-plugin" }
|
||||
shadow = { group = "com.github.johnrengelman", name = "shadow", version.ref = "shadow" }
|
||||
blossom = { group = "net.kyori", name = "blossom", version.ref = "blossom" }
|
||||
ideaExt = { group = "org.jetbrains.gradle.plugin.idea-ext", name = "org.jetbrains.gradle.plugin.idea-ext.gradle.plugin", version.ref = "idea-ext"}
|
||||
licenser = { group = "gradle.plugin.org.cadixdev.gradle", name = "licenser", version.ref = "licenser" }
|
||||
|
||||
# Kotlin
|
||||
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version.ref = "kotlin" }
|
||||
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", version.ref = "kotlin" }
|
||||
|
||||
# Common
|
||||
jei-api = { group = "mezz.jei", name = "jei-1.21-common-api", version.ref = "jei-api"}
|
||||
molang = { group = "local.com.bedrockk", name = "molang", version.ref = "molang" }
|
||||
graal = { group = "org.graalvm.js", name = "js", version.ref = "graal" }
|
||||
icu4j = { group = "com.ibm.icu", name = "icu4j", version.ref = "icu4j" }
|
||||
|
||||
# Fabric
|
||||
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabric-loader" }
|
||||
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" }
|
||||
fabric-kotlin = { group = "net.fabricmc", name = "fabric-language-kotlin", version.ref = "fabric-kotlin" }
|
||||
fabric-permissions = { group = "me.lucko", name = "fabric-permissions-api", version.ref = "fabric-permissions-api" }
|
||||
adorn-fabric = { group = "maven.modrinth", name = "adorn", version = "6.0.0-neoforge"}
|
||||
lambDynamicLights = { group = "maven.modrinth", name = "lambdynamiclights", version.ref = "lambDynamicLights"}
|
||||
jei-api-fabric = { group = "mezz.jei", name = "jei-1.21-fabric-api", version.ref = "jei-api" }
|
||||
jei-fabric = { group = "mezz.jei", name = "jei-1.21-fabric", version.ref = "jei-api"}
|
||||
fabric-debugutils = { group = "maven.modrinth", name = "debugutils", version.ref = "debugutils-fabric"}
|
||||
|
||||
# NeoForge
|
||||
neoforge = { group = "net.neoforged", name = "neoforge", version.ref = "neoforge" }
|
||||
neo-kotlin-forge = { group = "thedarkcolour", name = "kotlinforforge-neoforge", version.ref = "neo-kotlin-for-forge" }
|
||||
neoforge-debugutils = { group = "maven.modrinth", name = "debugutils", version.ref = "debugutils-forge"}
|
||||
|
||||
# Data Storage
|
||||
mongo-driver-core = { group = "org.mongodb", name = "mongodb-driver-core", version.ref = "mongo" }
|
||||
mongo-driver-sync = { group = "org.mongodb", name = "mongodb-driver-sync", version.ref = "mongo" }
|
||||
|
||||
# Testing
|
||||
junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
|
||||
mockito-core = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
|
||||
mock-kotlin = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
|
||||
classgraph = { group = "io.github.classgraph", name = "classgraph", version.ref = "classgraph" }
|
||||
|
||||
[bundles]
|
||||
kotlin = [ "kotlin-stdlib", "kotlin-reflect" ]
|
||||
fabric = [ "fabric-kotlin", "fabric-permissions" ]
|
||||
fabric-integrations-compileOnly = [ "adorn-fabric", "lambDynamicLights", "jei-api-fabric" ]
|
||||
fabric-integrations-runtimeOnly = [ "jei-fabric" ]
|
||||
mongo = [ "mongo-driver-core", "mongo-driver-sync" ]
|
||||
unitTesting = [ "junit", "mockito-core", "mock-kotlin", "classgraph" ]
|
||||
+2
-2
@@ -53,7 +53,7 @@ class BestSpawnerConfig {
|
||||
.create()
|
||||
|
||||
const val CONFIG_NAME = "best-spawner-config"
|
||||
const val INTERNAL_PATH = "/data/${Cobblemon.MODID}/spawning/$CONFIG_NAME.json"
|
||||
const val INTERNAL_PATH = "data/${Cobblemon.MODID}/spawning/$CONFIG_NAME.json"
|
||||
const val EXTERNAL_PATH = "config/${Cobblemon.MODID}/spawning/$CONFIG_NAME.json"
|
||||
|
||||
fun load(): BestSpawnerConfig {
|
||||
@@ -77,7 +77,7 @@ class BestSpawnerConfig {
|
||||
}
|
||||
|
||||
private fun loadInternal(): BestSpawnerConfig {
|
||||
val reader = InputStreamReader(Cobblemon::class.java.getResourceAsStream(INTERNAL_PATH)!!)
|
||||
val reader = InputStreamReader(Cobblemon.javaClass.classLoader.getResourceAsStream(INTERNAL_PATH)!!)
|
||||
val config = GSON.fromJson(reader, BestSpawnerConfig::class.java)
|
||||
reader.close()
|
||||
return config
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
package com.cobblemon.mod.common.battles.dispatch
|
||||
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import org.objectweb.asm.tree.analysis.Interpreter
|
||||
|
||||
class InstructionSet {
|
||||
val instructions: MutableList<InterpreterInstruction> = mutableListOf()
|
||||
|
||||
+3
-3
@@ -65,8 +65,8 @@ class GraalShowdownUnbundler {
|
||||
}
|
||||
|
||||
if (extract) {
|
||||
FileUtils.copyInternalToExternal("/data/${Cobblemon.MODID}/showdown.zip", showdownZip.toPath())
|
||||
FileUtils.copyInternalToExternal("/data/${Cobblemon.MODID}/showdown.json", showdownMetadataFile.toPath())
|
||||
FileUtils.copyInternalToExternal("data/${Cobblemon.MODID}/showdown.zip", showdownZip.toPath())
|
||||
FileUtils.copyInternalToExternal("data/${Cobblemon.MODID}/showdown.json", showdownMetadataFile.toPath())
|
||||
FileUtils.unzipFile(showdownZip.toPath(), showdownDir.toPath())
|
||||
showdownZip.delete()
|
||||
}
|
||||
@@ -75,7 +75,7 @@ class GraalShowdownUnbundler {
|
||||
|
||||
private fun loadShowdownMetadata() : ShowdownMetadata? {
|
||||
try {
|
||||
val inputStream = javaClass.getResourceAsStream("/data/${Cobblemon.MODID}/showdown.json")!!
|
||||
val inputStream = javaClass.classLoader.getResourceAsStream("data/${Cobblemon.MODID}/showdown.json")!!
|
||||
return gson.fromJson<ShowdownMetadata>(InputStreamReader(inputStream))
|
||||
} catch (exception: Exception) {
|
||||
exception.printStackTrace()
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
package com.cobblemon.mod.common.client.gui.toast
|
||||
|
||||
import com.cobblemon.mod.common.net.messages.client.toast.ToastPacket
|
||||
import net.fabricmc.api.EnvType
|
||||
import net.fabricmc.api.Environment
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.components.toasts.Toast
|
||||
import net.minecraft.client.gui.components.toasts.ToastComponent
|
||||
@@ -21,7 +19,6 @@ import net.minecraft.util.Mth
|
||||
import java.util.*
|
||||
import kotlin.math.min
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
class CobblemonToast(
|
||||
val id: UUID,
|
||||
var icon: ItemStack,
|
||||
|
||||
@@ -10,7 +10,6 @@ package com.cobblemon.mod.common.client.render
|
||||
|
||||
import com.cobblemon.mod.common.util.math.geometry.getOrigin
|
||||
import com.cobblemon.mod.common.util.math.geometry.transformPosition
|
||||
import net.fabricmc.loader.impl.lib.sat4j.core.Vec
|
||||
import org.joml.Matrix4f
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
|
||||
-3
@@ -14,8 +14,6 @@ import com.cobblemon.mod.common.entity.fishing.PokeRodFishingBobberEntity
|
||||
import com.cobblemon.mod.common.item.interactive.PokerodItem
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import java.awt.Color
|
||||
import net.fabricmc.api.EnvType
|
||||
import net.fabricmc.api.Environment
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||
import net.minecraft.client.renderer.RenderType
|
||||
@@ -33,7 +31,6 @@ import net.minecraft.world.entity.HumanoidArm
|
||||
import net.minecraft.world.item.ItemDisplayContext
|
||||
import org.joml.Quaternionf
|
||||
|
||||
@Environment(value = EnvType.CLIENT)
|
||||
class PokeBobberEntityRenderer(context: EntityRendererProvider.Context?) : EntityRenderer<PokeRodFishingBobberEntity>(context) {
|
||||
|
||||
override fun render(fishingBobberEntity: PokeRodFishingBobberEntity, elapsedPartialTicks: Float, tickDelta: Float, matrixStack: PoseStack, vertexConsumerProvider: MultiBufferSource, light: Int) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.zip.ZipInputStream
|
||||
object FileUtils {
|
||||
|
||||
private fun getResourceStream(internal: String): InputStream {
|
||||
return Cobblemon::class.java.getResourceAsStream(internal)
|
||||
return Cobblemon.javaClass.classLoader.getResourceAsStream(internal)
|
||||
?: throw Exception("Could not read $internal")
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"accessWidener": "cobblemon-common.accesswidener",
|
||||
"injected_interfaces": {
|
||||
"net/minecraft/class_630": ["com/cobblemon/mod/common/client/render/models/blockbench/pose/Bone"]
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ transitive-accessible field net/minecraft/client/model/geom/builders/CubeDeforma
|
||||
transitive-accessible field net/minecraft/client/model/geom/builders/CubeDeformation growZ F
|
||||
transitive-extendable method net/minecraft/world/entity/LivingEntity canBreatheUnderwater ()Z
|
||||
transitive-extendable class net/minecraft/world/level/block/grower/TreeGrower
|
||||
accessible method net/minecraft/world/level/block/state/BlockBehaviour codec ()Lcom/mojang/serialization/MapCodec;
|
||||
#accessible method net/minecraft/world/level/block/state/BlockBehaviour codec ()Lcom/mojang/serialization/MapCodec;
|
||||
accessible method net/minecraft/network/protocol/game/ClientboundAddEntityPacket <init> (Lnet/minecraft/network/RegistryFriendlyByteBuf;)V
|
||||
|
||||
transitive-accessible field net/minecraft/world/entity/player/Inventory compartments Ljava/util/List;
|
||||
@@ -68,6 +68,7 @@ transitive-accessible field net/minecraft/client/renderer/RenderStateShard NO_CU
|
||||
#transitive-accessible field net/minecraft/recipe/BrewingRecipeRegistry ITEM_RECIPES Ljava/util/List;
|
||||
#transitive-accessible field net/minecraft/recipe/BrewingRecipeRegistry POTION_RECIPES Ljava/util/List;
|
||||
#transitive-accessible field net/minecraft/recipe/BrewingRecipeRegistry POTION_TYPES Ljava/util/List;
|
||||
transitive-accessible method net/minecraft/world/item/alchemy/PotionBrewing$Mix <init> (Lnet/minecraft/core/Holder;Lnet/minecraft/world/item/crafting/Ingredient;Lnet/minecraft/core/Holder;)V
|
||||
transitive-accessible class net/minecraft/world/item/alchemy/PotionBrewing$Mix
|
||||
|
||||
transitive-accessible class net/minecraft/util/datafix/fixes/ItemStackComponentizationFix$ItemStackData
|
||||
@@ -76,6 +77,7 @@ accessible field net/minecraft/server/network/ServerCommonPacketListenerImpl con
|
||||
transitive-accessible method net/minecraft/world/level/block/state/properties/WoodType register (Lnet/minecraft/world/level/block/state/properties/WoodType;)Lnet/minecraft/world/level/block/state/properties/WoodType;
|
||||
transitive-accessible field com/mojang/blaze3d/systems/RenderSystem shaderLightDirections [Lorg/joml/Vector3f;
|
||||
transitive-accessible class net/minecraft/world/inventory/BrewingStandMenu$PotionSlot
|
||||
transitive-accessible method net/minecraft/world/level/biome/Biome$ClimateSettings <init> (ZFLnet/minecraft/world/level/biome/Biome$TemperatureModifier;F)V
|
||||
transitive-accessible class net/minecraft/world/level/biome/Biome$ClimateSettings
|
||||
accessible field net/minecraft/client/gui/components/toasts/AdvancementToast BACKGROUND_SPRITE Lnet/minecraft/resources/ResourceLocation;
|
||||
#accessible method net/minecraft/text/Text$Serialization fromJson (Lcom/google/gson/JsonElement;)Lnet/minecraft/text/MutableComponent;
|
||||
@@ -90,7 +92,7 @@ transitive-accessible field net/minecraft/world/entity/ai/goal/FollowOwnerGoal s
|
||||
transitive-accessible field net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement template Lcom/mojang/datafixers/util/Either;
|
||||
transitive-accessible class net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement$Placer
|
||||
transitive-accessible class net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement$PieceState
|
||||
transitive-accessible field net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement$PieceState piece Lnet/minecraft/world/level/levelgen/structure/PoolElementStructurePiece;
|
||||
transitive-accessible method net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement$PieceState <init> (Lnet/minecraft/world/level/levelgen/structure/PoolElementStructurePiece;Lorg/apache/commons/lang3/mutable/MutableObject;I)V
|
||||
transitive-accessible method net/minecraft/client/resources/TextureAtlasHolder getSprite (Lnet/minecraft/resources/ResourceLocation;)Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;
|
||||
transitive-accessible field net/minecraft/client/resources/TextureAtlasHolder textureAtlas Lnet/minecraft/client/renderer/texture/TextureAtlas;
|
||||
transitive-accessible field net/minecraft/client/renderer/texture/TextureAtlas width I
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"net/minecraft/client/model/geom/ModelPart": [
|
||||
"com/cobblemon/mod/common/client/render/models/blockbench/pose/Bone"
|
||||
]
|
||||
}
|
||||
@@ -12,5 +12,5 @@ import org.junit.jupiter.api.extension.ExtendWith
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@ExtendWith(BootstrapMinecraftExtension::class)
|
||||
//@ExtendWith(BootstrapMinecraftExtension::class)
|
||||
annotation class BootstrapMinecraft
|
||||
+4
-1
@@ -8,6 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common.junit
|
||||
|
||||
/*
|
||||
import net.minecraft.SharedConstants
|
||||
import net.minecraft.server.Bootstrap
|
||||
import org.junit.jupiter.api.extension.BeforeAllCallback
|
||||
@@ -19,4 +20,6 @@ class BootstrapMinecraftExtension : Extension, BeforeAllCallback {
|
||||
SharedConstants.tryDetectVersion()
|
||||
Bootstrap.bootStrap()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common.spawning
|
||||
|
||||
/*
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.GsonBuilder
|
||||
import com.google.gson.JsonObject
|
||||
@@ -75,4 +76,5 @@ internal class SpawnValidator {
|
||||
return javaClass.classLoader.getResource(adjustedPath)?.toURI()
|
||||
?: throw FileNotFoundException(adjustedPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
+4
-2
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.util.math
|
||||
|
||||
/*
|
||||
import kotlin.math.round
|
||||
import net.minecraft.world.phys.Vec3
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
@@ -26,4 +26,6 @@ class SimpleMathExtensionsKtTest {
|
||||
assertEquals(2.0, round(result.y))
|
||||
assertEquals(0.0, result.z)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
+67
-89
@@ -1,106 +1,84 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright (C) 2023 Cobblemon Contributors
|
||||
* *
|
||||
* * This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* * License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* * file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
*/
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force(libs.fabric.loader)
|
||||
}
|
||||
}
|
||||
import com.cobblemon.gradle.extension.tasks.UnzipAccessWidenersTask
|
||||
import net.fabricmc.loom.configuration.accesswidener.AccessWidenerJarProcessor
|
||||
import net.fabricmc.loom.extension.LoomGradleExtensionImpl
|
||||
|
||||
plugins {
|
||||
id("cobblemon.platform-conventions")
|
||||
id("cobblemon.publish-conventions")
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
fabric()
|
||||
}
|
||||
|
||||
val generatedResources = file("src/generated/resources")
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
resources {
|
||||
srcDir(generatedResources)
|
||||
}
|
||||
}
|
||||
kotlin("jvm") version "2.1.0"
|
||||
id("fabric-loom") version "1.9-SNAPSHOT"
|
||||
id("com.cobblemon.gradle")
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven(url = "${rootProject.projectDir}/deps")
|
||||
mavenLocal()
|
||||
maven("https://oss.sonatype.org/content/repositories/snapshots")
|
||||
maven(url = "https://api.modrinth.com/maven")
|
||||
mavenCentral()
|
||||
maven("https://maven.fabricmc.net/")
|
||||
maven("https://maven.blamejared.com/")
|
||||
maven("https://api.modrinth.com/maven")
|
||||
maven(url = "https://thedarkcolour.github.io/KotlinForForge/")
|
||||
maven(url = "../deps")
|
||||
}
|
||||
|
||||
loom {
|
||||
mods {
|
||||
create("cobblemon") {
|
||||
sourceSet(sourceSets.main.get())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cobblemon {
|
||||
convertAccessWideners = false
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":common", configuration = "namedElements")) {
|
||||
isTransitive = false
|
||||
}
|
||||
"developmentFabric"(project(":common", configuration = "namedElements")) {
|
||||
isTransitive = false
|
||||
}
|
||||
bundle(project(path = ":common", configuration = "transformProductionFabric")) {
|
||||
isTransitive = false
|
||||
}
|
||||
modLocalRuntime(libs.fabric.debugutils)
|
||||
minecraft("com.mojang:minecraft:1.21.1")
|
||||
mappings(loom.officialMojangMappings())
|
||||
//Originally I had this jar-in-jared, but the way that NF does class loading for JiJed dependencies
|
||||
//Makes it so that they can't access minecraft classes. So instead we do an implementation dependency
|
||||
//and make sure that the FMLModType variable is set in this jar's manifest
|
||||
implementation("com.cobblemon:mod:1.6.0-SNAPSHOT")
|
||||
includeRootResources("com.cobblemon:mod-resources:1.6.0-SNAPSHOT")
|
||||
accessWidener("com.cobblemon:mod-accesswideners:1.6.0-SNAPSHOT")
|
||||
|
||||
//additionalRuntimeClasspathLibraries are libraries that need to be added to the task runtime classpath
|
||||
api(libs.molang)
|
||||
//"additionalRuntimeClasspath"(libs.molang)
|
||||
|
||||
//implementation("thedarkcolour:kotlinforforge-neoforge:5.7.0:slim")
|
||||
//"additionalRuntimeClasspath"("org.jetbrains.kotlin:kotlin-stdlib:2.1.0")
|
||||
//"additionalRuntimeClasspath"("org.jetbrains.kotlin:kotlin-reflect:2.1.0")
|
||||
//"additionalRuntimeClasspath"("org.jetbrains.kotlinx:kotlinx-coroutines-core")
|
||||
//"additionalRuntimeClasspath"("org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3")
|
||||
//"additionalRuntimeClasspath"("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
|
||||
|
||||
modImplementation(libs.fabric.loader)
|
||||
modApi(libs.fabric.api)
|
||||
modImplementation(libs.fabric.api)
|
||||
modApi(libs.bundles.fabric)
|
||||
|
||||
modCompileOnly(libs.bundles.fabric.integrations.compileOnly) {
|
||||
isTransitive = false
|
||||
}
|
||||
modRuntimeOnly(libs.bundles.fabric.integrations.runtimeOnly)
|
||||
// modImplementation(libs.flywheelFabric)
|
||||
// include(libs.flywheelFabric)
|
||||
compileOnly(libs.bundles.mongo)
|
||||
|
||||
include(libs.fabric.kotlin)
|
||||
compileOnly(libs.graal)
|
||||
//"additionalRuntimeClasspath"(libs.graal)
|
||||
|
||||
listOf(
|
||||
libs.graal,
|
||||
libs.molang
|
||||
).forEach {
|
||||
bundle(it)
|
||||
runtimeOnly(it)
|
||||
}
|
||||
|
||||
minecraftServerLibraries(libs.icu4j)
|
||||
//compileOnly("net.fabricmc:sponge-mixin:0.15.5+mixin.0.8.7")
|
||||
//compileOnly("io.github.llamalad7:mixinextras-fabric:0.4.1")
|
||||
//api(libs.jei.api)
|
||||
//compileOnly(libs.bundles.fabric.integrations.compileOnly) {
|
||||
// isTransitive = false
|
||||
//}
|
||||
|
||||
testImplementation(libs.bundles.unitTesting)
|
||||
}
|
||||
|
||||
tasks {
|
||||
// The AW file is needed in :fabric project resources when the game is run.
|
||||
val copyAccessWidener by registering(Copy::class) {
|
||||
from(loom.accessWidenerPath)
|
||||
into(generatedResources)
|
||||
dependsOn(checkLicenseMain)
|
||||
tasks.named("prepareKotlinBuildScriptModel") {
|
||||
dependsOn(tasks.named("unzipAccessWideners"))
|
||||
doFirst {
|
||||
val file = tasks.named<UnzipAccessWidenersTask>("unzipAccessWideners").get().outputFiles.get().first()
|
||||
println(file.name)
|
||||
val minecraftJarProcessors = loom.minecraftJarProcessors
|
||||
val processorList = minecraftJarProcessors.get()
|
||||
processorList.removeIf { it is AccessWidenerJarProcessor }
|
||||
val newProp = project.objects.fileProperty()
|
||||
newProp.set(file)
|
||||
processorList.add(AccessWidenerJarProcessor("AccessWidener", true, newProp))
|
||||
}
|
||||
|
||||
processResources {
|
||||
dependsOn(copyAccessWidener)
|
||||
inputs.property("version", rootProject.version)
|
||||
inputs.property("fabric_loader_version", libs.fabric.loader.get().version)
|
||||
inputs.property("minecraft_version", rootProject.property("mc_version").toString())
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand(
|
||||
"version" to rootProject.version,
|
||||
"fabric_loader_version" to libs.fabric.loader.get().version,
|
||||
"minecraft_version" to rootProject.property("mc_version").toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
sourcesJar {
|
||||
dependsOn(copyAccessWidener)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright (C) 2023 Cobblemon Contributors
|
||||
* *
|
||||
* * This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* * License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* * file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
*/
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force(libs.fabric.loader)
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("cobblemon.platform-conventions")
|
||||
id("cobblemon.publish-conventions")
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
fabric()
|
||||
}
|
||||
|
||||
val generatedResources = file("src/generated/resources")
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
resources {
|
||||
srcDir(generatedResources)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven(url = "${rootProject.projectDir}/deps")
|
||||
mavenLocal()
|
||||
maven("https://oss.sonatype.org/content/repositories/snapshots")
|
||||
maven(url = "https://api.modrinth.com/maven")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":common", configuration = "namedElements")) {
|
||||
isTransitive = false
|
||||
}
|
||||
"developmentFabric"(project(":common", configuration = "namedElements")) {
|
||||
isTransitive = false
|
||||
}
|
||||
bundle(project(path = ":common", configuration = "transformProductionFabric")) {
|
||||
isTransitive = false
|
||||
}
|
||||
modLocalRuntime(libs.fabric.debugutils)
|
||||
modImplementation(libs.fabric.loader)
|
||||
modApi(libs.fabric.api)
|
||||
modApi(libs.bundles.fabric)
|
||||
|
||||
modCompileOnly(libs.bundles.fabric.integrations.compileOnly) {
|
||||
isTransitive = false
|
||||
}
|
||||
modRuntimeOnly(libs.bundles.fabric.integrations.runtimeOnly)
|
||||
// modImplementation(libs.flywheelFabric)
|
||||
// include(libs.flywheelFabric)
|
||||
|
||||
include(libs.fabric.kotlin)
|
||||
|
||||
listOf(
|
||||
libs.graal,
|
||||
libs.molang
|
||||
).forEach {
|
||||
bundle(it)
|
||||
runtimeOnly(it)
|
||||
}
|
||||
|
||||
minecraftServerLibraries(libs.icu4j)
|
||||
|
||||
}
|
||||
|
||||
tasks {
|
||||
// The AW file is needed in :fabric project resources when the game is run.
|
||||
val copyAccessWidener by registering(Copy::class) {
|
||||
from(loom.accessWidenerPath)
|
||||
into(generatedResources)
|
||||
dependsOn(checkLicenseMain)
|
||||
}
|
||||
|
||||
processResources {
|
||||
dependsOn(copyAccessWidener)
|
||||
inputs.property("version", rootProject.version)
|
||||
inputs.property("fabric_loader_version", libs.fabric.loader.get().version)
|
||||
inputs.property("minecraft_version", rootProject.property("mc_version").toString())
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand(
|
||||
"version" to rootProject.version,
|
||||
"fabric_loader_version" to libs.fabric.loader.get().version,
|
||||
"minecraft_version" to rootProject.property("mc_version").toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
sourcesJar {
|
||||
dependsOn(copyAccessWidener)
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,16 @@
|
||||
rootProject.name = "build-logic"
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.architectury.dev/")
|
||||
maven("https://maven.fabricmc.net/")
|
||||
maven("https://maven.minecraftforge.net/")
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
versionCatalogs {
|
||||
create("libs") {
|
||||
from(files("../libs.versions.toml"))
|
||||
from(files("../gradle/libs.versions.toml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -5,7 +5,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
/*
|
||||
package com.cobblemon.mod.fabric.compat.lambdynamiclights;
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon;
|
||||
@@ -22,3 +22,5 @@ public class LambDynamicLightsCompatEntrypoint implements DynamicLightsInitializ
|
||||
Cobblemon.LOGGER.info("Lamb Dynamic Lights compatibility enabled");
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(BrewingStandMenu.PotionSlot.class)
|
||||
@Mixin(BrewingStandMenu.PotionSlot.class)
|
||||
public class PotionSlotMixin {
|
||||
|
||||
@Inject(method = "mayPlaceItem", at = @At("RETURN"), cancellable = true)
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
],
|
||||
"jei_mod_plugin": [
|
||||
"com.cobblemon.mod.common.integration.jei.CobblemonJeiPlugin"
|
||||
],
|
||||
"dynamiclights": [
|
||||
"com.cobblemon.mod.fabric.compat.lambdynamiclights.LambDynamicLightsCompatEntrypoint"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
@@ -35,9 +32,9 @@
|
||||
],
|
||||
"accessWidener": "cobblemon-common.accesswidener",
|
||||
"depends": {
|
||||
"fabricloader": ">=${fabric_loader_version}",
|
||||
"fabricloader": ">=0.16.5",
|
||||
"fabric-api": "*",
|
||||
"minecraft": ">=${minecraft_version}",
|
||||
"minecraft": ">=1.21.1",
|
||||
"java": ">=17"
|
||||
},
|
||||
"custom": {
|
||||
|
||||
+1
-5
@@ -1,8 +1,6 @@
|
||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx8G
|
||||
org.gradle.daemon=false
|
||||
org.gradle.parallel=true
|
||||
|
||||
group=com.cobblemon.mod
|
||||
|
||||
@@ -12,6 +10,4 @@ parchment_version = 2024.07.28@zip
|
||||
|
||||
mod_id=cobblemon
|
||||
mod_version=1.6.1
|
||||
snapshot=true
|
||||
|
||||
fabric.loom.multiProjectOptimisation=false
|
||||
snapshot=true
|
||||
@@ -1,9 +0,0 @@
|
||||
plugins {
|
||||
base
|
||||
}
|
||||
|
||||
tasks {
|
||||
withType<Test> {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
}
|
||||
@@ -22,13 +22,13 @@ jei-api = "19.8.2.99"
|
||||
fabric-loader = "0.16.5"
|
||||
fabric-api = "0.104.0+1.21.1"
|
||||
fabric-kotlin = "1.11.0+kotlin.2.0.0"
|
||||
fabric-permissions-api = "0.2-SNAPSHOT"
|
||||
fabric-permissions-api = "0.3.1"
|
||||
lambDynamicLights = "3.0.1+1.21.1"
|
||||
debugutils-fabric = "1.21-1.0.6-fabric"
|
||||
|
||||
# NeoForge
|
||||
neoforge = "21.1.66"
|
||||
neo-kotlin-for-forge = "5.5.0"
|
||||
neo-kotlin-for-forge = "5.7.0"
|
||||
debugutils-forge = "1.21-1.0.6-neoforge"
|
||||
|
||||
# Data Storage
|
||||
@@ -81,8 +81,7 @@ mongo-driver-core = { group = "org.mongodb", name = "mongodb-driver-core", versi
|
||||
mongo-driver-sync = { group = "org.mongodb", name = "mongodb-driver-sync", version.ref = "mongo" }
|
||||
|
||||
# Testing
|
||||
junit-fabric = { group = "net.fabricmc", name = "fabric-loader-junit", version.ref = "fabric-loader" }
|
||||
junit-params = { group = "org.junit.jupiter", name = "junit-jupiter-params", version.ref = "junit" }
|
||||
junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
|
||||
mockito-core = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
|
||||
mock-kotlin = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
|
||||
classgraph = { group = "io.github.classgraph", name = "classgraph", version.ref = "classgraph" }
|
||||
@@ -93,4 +92,4 @@ fabric = [ "fabric-kotlin", "fabric-permissions" ]
|
||||
fabric-integrations-compileOnly = [ "adorn-fabric", "lambDynamicLights", "jei-api-fabric" ]
|
||||
fabric-integrations-runtimeOnly = [ "jei-fabric" ]
|
||||
mongo = [ "mongo-driver-core", "mongo-driver-sync" ]
|
||||
unitTesting = [ "junit-fabric", "junit-params", "mockito-core", "mock-kotlin", "classgraph" ]
|
||||
unitTesting = [ "junit", "mockito-core", "mock-kotlin", "classgraph" ]
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
+80
-111
@@ -1,129 +1,98 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright (C) 2023 Cobblemon Contributors
|
||||
* *
|
||||
* * This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* * License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* * file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
*/
|
||||
import org.gradle.internal.impldep.bsh.commands.dir
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.StandardOpenOption
|
||||
import kotlin.io.path.name
|
||||
|
||||
plugins {
|
||||
id("cobblemon.platform-conventions")
|
||||
id("cobblemon.publish-conventions")
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
neoForge()
|
||||
}
|
||||
|
||||
loom {
|
||||
neoForge {
|
||||
|
||||
}
|
||||
kotlin("jvm") version "2.1.0"
|
||||
id ("net.neoforged.moddev") version "2.0.75"
|
||||
id("com.cobblemon.gradle")
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven(url = "${rootProject.projectDir}/deps")
|
||||
mavenCentral()
|
||||
maven("https://maven.fabricmc.net/")
|
||||
maven("https://maven.blamejared.com/")
|
||||
maven("https://api.modrinth.com/maven")
|
||||
maven(url = "https://thedarkcolour.github.io/KotlinForForge/")
|
||||
maven(url = "https://api.modrinth.com/maven")
|
||||
maven(url = "https://maven.neoforged.net/releases")
|
||||
mavenLocal()
|
||||
maven(url = "../deps")
|
||||
}
|
||||
|
||||
neoForge {
|
||||
version = "21.1.95"
|
||||
runs {
|
||||
create("client") {
|
||||
client()
|
||||
}
|
||||
create("server") {
|
||||
server()
|
||||
}
|
||||
}
|
||||
mods {
|
||||
create("cobblemon") {
|
||||
sourceSet(sourceSets.main.get())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
neoForge(libs.neoforge)
|
||||
//Because of the JEI mapping issues if we want
|
||||
//a forge launch we gotta do some wacky stuff
|
||||
//modImplementation(libs.jeiForge)
|
||||
//shadowCommon group: 'commons-io', name: 'commons-io', version: '2.6'
|
||||
//modImplementation(libs.flywheelForge)
|
||||
//include(libs.flywheelForge)
|
||||
modLocalRuntime(libs.neoforge.debugutils)
|
||||
implementation(project(":common", configuration = "namedElements")) {
|
||||
isTransitive = false
|
||||
}
|
||||
implementation(libs.neo.kotlin.forge) {
|
||||
exclude(group = "net.neoforged.fancymodloader", module = "loader")
|
||||
}
|
||||
"developmentNeoForge"(project(":common", configuration = "namedElements")) {
|
||||
isTransitive = false
|
||||
}
|
||||
bundle(project(path = ":common", configuration = "transformProductionNeoForge")) {
|
||||
isTransitive = false
|
||||
}
|
||||
testImplementation(project(":common", configuration = "namedElements"))
|
||||
//Originally I had this jar-in-jared, but the way that NF does class loading for JiJed dependencies
|
||||
//Makes it so that they can't access minecraft classes. So instead we do an implementation dependency
|
||||
//and make sure that the FMLModType variable is set in this jar's manifest
|
||||
implementation("com.cobblemon:mod:1.6.0-SNAPSHOT")
|
||||
includeRootResources("com.cobblemon:mod-resources:1.6.0-SNAPSHOT")
|
||||
"accessWidener"("com.cobblemon:mod-accesswideners:1.6.0-SNAPSHOT")
|
||||
|
||||
listOf(
|
||||
libs.graal,
|
||||
libs.molang
|
||||
).forEach {
|
||||
forgeRuntimeLibrary(it)
|
||||
bundle(it)
|
||||
}
|
||||
//additionalRuntimeClasspathLibraries are libraries that need to be added to the task runtime classpath
|
||||
api(libs.molang)
|
||||
"additionalRuntimeClasspath"(libs.molang)
|
||||
|
||||
implementation("thedarkcolour:kotlinforforge-neoforge:5.7.0:slim")
|
||||
"additionalRuntimeClasspath"("org.jetbrains.kotlin:kotlin-stdlib:2.1.0")
|
||||
"additionalRuntimeClasspath"("org.jetbrains.kotlin:kotlin-reflect:2.1.0")
|
||||
"additionalRuntimeClasspath"("org.jetbrains.kotlinx:kotlinx-coroutines-core")
|
||||
"additionalRuntimeClasspath"("org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3")
|
||||
"additionalRuntimeClasspath"("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
|
||||
|
||||
compileOnly(libs.bundles.mongo)
|
||||
|
||||
compileOnly(libs.graal)
|
||||
"additionalRuntimeClasspath"(libs.graal)
|
||||
|
||||
compileOnly("net.fabricmc:sponge-mixin:0.15.5+mixin.0.8.7")
|
||||
compileOnly("io.github.llamalad7:mixinextras-fabric:0.4.1")
|
||||
//api(libs.jei.api)
|
||||
//compileOnly(libs.bundles.fabric.integrations.compileOnly) {
|
||||
// isTransitive = false
|
||||
//}
|
||||
|
||||
testImplementation(libs.bundles.unitTesting)
|
||||
}
|
||||
|
||||
tasks {
|
||||
shadowJar {
|
||||
exclude("architectury-common.accessWidener")
|
||||
exclude("architectury.common.json")
|
||||
|
||||
relocate ("com.ibm.icu", "com.cobblemon.mod.relocations.ibm.icu")
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property("version", rootProject.version)
|
||||
inputs.property("minecraft_version", rootProject.property("mc_version").toString())
|
||||
|
||||
filesMatching("META-INF/neoforge.mods.toml") {
|
||||
expand(
|
||||
"version" to rootProject.version,
|
||||
"minecraft_version" to rootProject.property("mc_version").toString()
|
||||
)
|
||||
tasks.register("addAccessTransformersToToml") {
|
||||
dependsOn(tasks.processResources)
|
||||
doLast {
|
||||
tasks.processResources.get().outputs.files.filter {
|
||||
it.path.endsWith("accesstransformer.cfg")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
sourcesJar {
|
||||
val depSources = project(":common").tasks.sourcesJar
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
dependsOn(depSources)
|
||||
from(depSources.get().archiveFile.map { zipTree(it) }) {
|
||||
exclude("architectury.accessWidener")
|
||||
//Add access tranformers to neoforge.mods.toml
|
||||
tasks.processResources {
|
||||
val accessTransformers = mutableSetOf<String>()
|
||||
eachFile {
|
||||
if (name.endsWith("accesstransformer.cfg")) {
|
||||
accessTransformers.add(relativeSourcePath.pathString)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Stole from architect discord, replaces loom.forge.convertAccessWideners
|
||||
tasks.remapJar {
|
||||
atAccessWideners.add("cobblemon-common.accesswidener")
|
||||
}
|
||||
|
||||
|
||||
//jar {
|
||||
// classifier("dev")
|
||||
// manifest {
|
||||
// attributes(
|
||||
// "Specification-Title" to rootProject.mod_id,
|
||||
// "Specification-Vendor" to "Cable MC",
|
||||
// "Specification-Version" to "1",
|
||||
// "Implementation-Title" to rootProject.mod_id,
|
||||
// "Implementation-Version" to project.version,
|
||||
// "Implementation-Vendor" to "Cable MC",
|
||||
// )
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//sourcesJar {
|
||||
// def commonSources = project(":common").sourcesJar
|
||||
// dependsOn commonSources
|
||||
// from commonSources.archiveFile.map { zipTree(it) }
|
||||
//}
|
||||
//
|
||||
//components.java {
|
||||
// withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
||||
// skip()
|
||||
// }
|
||||
//}
|
||||
doLast {
|
||||
val modsFile = Files.walk(destinationDir.toPath()).filter { it.name == "neoforge.mods.toml" }.findFirst().orElse(null)
|
||||
if (modsFile != null) {
|
||||
val rawFile = Files.readString(modsFile)
|
||||
val genAccessTransformersStr = accessTransformers.joinToString { "[[accessTransformers]]\nfile=\"$it\"\n" }
|
||||
val transformedFile = rawFile.replace("ACCESS_TRANSFORMERS_TEMPLATE", genAccessTransformersStr)
|
||||
Files.writeString(modsFile, transformedFile, StandardOpenOption.TRUNCATE_EXISTING)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright (C) 2023 Cobblemon Contributors
|
||||
* *
|
||||
* * This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* * License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* * file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id("cobblemon.platform-conventions")
|
||||
id("cobblemon.publish-conventions")
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
neoForge()
|
||||
}
|
||||
|
||||
loom {
|
||||
neoForge {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven(url = "${rootProject.projectDir}/deps")
|
||||
maven(url = "https://thedarkcolour.github.io/KotlinForForge/")
|
||||
maven(url = "https://api.modrinth.com/maven")
|
||||
maven(url = "https://maven.neoforged.net/releases")
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
neoForge(libs.neoforge)
|
||||
//Because of the JEI mapping issues if we want
|
||||
//a forge launch we gotta do some wacky stuff
|
||||
//modImplementation(libs.jeiForge)
|
||||
//shadowCommon group: 'commons-io', name: 'commons-io', version: '2.6'
|
||||
//modImplementation(libs.flywheelForge)
|
||||
//include(libs.flywheelForge)
|
||||
modLocalRuntime(libs.neoforge.debugutils)
|
||||
implementation(project(":common", configuration = "namedElements")) {
|
||||
isTransitive = false
|
||||
}
|
||||
implementation(libs.neo.kotlin.forge) {
|
||||
exclude(group = "net.neoforged.fancymodloader", module = "loader")
|
||||
}
|
||||
"developmentNeoForge"(project(":common", configuration = "namedElements")) {
|
||||
isTransitive = false
|
||||
}
|
||||
bundle(project(path = ":common", configuration = "transformProductionNeoForge")) {
|
||||
isTransitive = false
|
||||
}
|
||||
testImplementation(project(":common", configuration = "namedElements"))
|
||||
|
||||
listOf(
|
||||
libs.graal,
|
||||
libs.molang
|
||||
).forEach {
|
||||
forgeRuntimeLibrary(it)
|
||||
bundle(it)
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
shadowJar {
|
||||
exclude("architectury-common.accessWidener")
|
||||
exclude("architectury.common.json")
|
||||
|
||||
relocate ("com.ibm.icu", "com.cobblemon.mod.relocations.ibm.icu")
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property("version", rootProject.version)
|
||||
inputs.property("minecraft_version", rootProject.property("mc_version").toString())
|
||||
|
||||
filesMatching("META-INF/neoforge.mods.toml") {
|
||||
expand(
|
||||
"version" to rootProject.version,
|
||||
"minecraft_version" to rootProject.property("mc_version").toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
sourcesJar {
|
||||
val depSources = project(":common").tasks.sourcesJar
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
dependsOn(depSources)
|
||||
from(depSources.get().archiveFile.map { zipTree(it) }) {
|
||||
exclude("architectury.accessWidener")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Stole from architect discord, replaces loom.forge.convertAccessWideners
|
||||
tasks.remapJar {
|
||||
atAccessWideners.add("cobblemon-common.accesswidener")
|
||||
}
|
||||
|
||||
|
||||
//jar {
|
||||
// classifier("dev")
|
||||
// manifest {
|
||||
// attributes(
|
||||
// "Specification-Title" to rootProject.mod_id,
|
||||
// "Specification-Vendor" to "Cable MC",
|
||||
// "Specification-Version" to "1",
|
||||
// "Implementation-Title" to rootProject.mod_id,
|
||||
// "Implementation-Version" to project.version,
|
||||
// "Implementation-Vendor" to "Cable MC",
|
||||
// )
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//sourcesJar {
|
||||
// def commonSources = project(":common").sourcesJar
|
||||
// dependsOn commonSources
|
||||
// from commonSources.archiveFile.map { zipTree(it) }
|
||||
//}
|
||||
//
|
||||
//components.java {
|
||||
// withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
||||
// skip()
|
||||
// }
|
||||
//}
|
||||
@@ -1 +1,2 @@
|
||||
loom.platform = neoforge
|
||||
mod_accesstranformers = "TEST"
|
||||
@@ -0,0 +1,95 @@
|
||||
[versions]
|
||||
# Kotlin
|
||||
kotlin = "2.0.0"
|
||||
|
||||
# Plugins
|
||||
licenser = "0.6.1"
|
||||
shadow = "8.1.1"
|
||||
blossom = "2.1.0"
|
||||
idea-ext = "1.1.7"
|
||||
|
||||
# Loom
|
||||
loom = "1.7-SNAPSHOT"
|
||||
architectury-plugin = "3.4-SNAPSHOT"
|
||||
|
||||
# Common
|
||||
molang = "1.1.18"
|
||||
graal = "22.3.0"
|
||||
icu4j = "71.1"
|
||||
jei-api = "19.8.2.99"
|
||||
|
||||
# Fabric
|
||||
fabric-loader = "0.16.5"
|
||||
fabric-api = "0.104.0+1.21.1"
|
||||
fabric-kotlin = "1.11.0+kotlin.2.0.0"
|
||||
fabric-permissions-api = "0.2-SNAPSHOT"
|
||||
lambDynamicLights = "3.0.1+1.21.1"
|
||||
debugutils-fabric = "1.21-1.0.6-fabric"
|
||||
|
||||
# NeoForge
|
||||
neoforge = "21.1.66"
|
||||
neo-kotlin-for-forge = "5.5.0"
|
||||
debugutils-forge = "1.21-1.0.6-neoforge"
|
||||
|
||||
# Data Storage
|
||||
mongo = "4.10.2"
|
||||
|
||||
# Testing
|
||||
junit = "5.9.0"
|
||||
mockito = "5.2.0"
|
||||
mockk = "1.12.1"
|
||||
classgraph = "4.8.153"
|
||||
|
||||
[libraries]
|
||||
# General Buildscript Plugins
|
||||
kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
loom = { group = "dev.architectury", name = "architectury-loom", version.ref = "loom" }
|
||||
architectury = { group = "architectury-plugin", name = "architectury-plugin.gradle.plugin", version.ref = "architectury-plugin" }
|
||||
shadow = { group = "com.github.johnrengelman", name = "shadow", version.ref = "shadow" }
|
||||
blossom = { group = "net.kyori", name = "blossom", version.ref = "blossom" }
|
||||
ideaExt = { group = "org.jetbrains.gradle.plugin.idea-ext", name = "org.jetbrains.gradle.plugin.idea-ext.gradle.plugin", version.ref = "idea-ext"}
|
||||
licenser = { group = "gradle.plugin.org.cadixdev.gradle", name = "licenser", version.ref = "licenser" }
|
||||
|
||||
# Kotlin
|
||||
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version.ref = "kotlin" }
|
||||
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", version.ref = "kotlin" }
|
||||
|
||||
# Common
|
||||
jei-api = { group = "mezz.jei", name = "jei-1.21-common-api", version.ref = "jei-api"}
|
||||
molang = { group = "local.com.bedrockk", name = "molang", version.ref = "molang" }
|
||||
graal = { group = "org.graalvm.js", name = "js", version.ref = "graal" }
|
||||
icu4j = { group = "com.ibm.icu", name = "icu4j", version.ref = "icu4j" }
|
||||
|
||||
# Fabric
|
||||
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabric-loader" }
|
||||
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" }
|
||||
fabric-kotlin = { group = "net.fabricmc", name = "fabric-language-kotlin", version.ref = "fabric-kotlin" }
|
||||
fabric-permissions = { group = "me.lucko", name = "fabric-permissions-api", version.ref = "fabric-permissions-api" }
|
||||
adorn-fabric = { group = "maven.modrinth", name = "adorn", version = "6.0.0-neoforge"}
|
||||
lambDynamicLights = { group = "maven.modrinth", name = "lambdynamiclights", version.ref = "lambDynamicLights"}
|
||||
jei-api-fabric = { group = "mezz.jei", name = "jei-1.21-fabric-api", version.ref = "jei-api" }
|
||||
jei-fabric = { group = "mezz.jei", name = "jei-1.21-fabric", version.ref = "jei-api"}
|
||||
fabric-debugutils = { group = "maven.modrinth", name = "debugutils", version.ref = "debugutils-fabric"}
|
||||
|
||||
# NeoForge
|
||||
neoforge = { group = "net.neoforged", name = "neoforge", version.ref = "neoforge" }
|
||||
neo-kotlin-forge = { group = "thedarkcolour", name = "kotlinforforge-neoforge", version.ref = "neo-kotlin-for-forge" }
|
||||
neoforge-debugutils = { group = "maven.modrinth", name = "debugutils", version.ref = "debugutils-forge"}
|
||||
|
||||
# Data Storage
|
||||
mongo-driver-core = { group = "org.mongodb", name = "mongodb-driver-core", version.ref = "mongo" }
|
||||
mongo-driver-sync = { group = "org.mongodb", name = "mongodb-driver-sync", version.ref = "mongo" }
|
||||
|
||||
# Testing
|
||||
junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
|
||||
mockito-core = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
|
||||
mock-kotlin = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
|
||||
classgraph = { group = "io.github.classgraph", name = "classgraph", version.ref = "classgraph" }
|
||||
|
||||
[bundles]
|
||||
kotlin = [ "kotlin-stdlib", "kotlin-reflect" ]
|
||||
fabric = [ "fabric-kotlin", "fabric-permissions" ]
|
||||
fabric-integrations-compileOnly = [ "adorn-fabric", "lambDynamicLights", "jei-api-fabric" ]
|
||||
fabric-integrations-runtimeOnly = [ "jei-fabric" ]
|
||||
mongo = [ "mongo-driver-core", "mongo-driver-sync" ]
|
||||
unitTesting = [ "junit", "mockito-core", "mock-kotlin", "classgraph" ]
|
||||
@@ -0,0 +1,8 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.architectury.dev/")
|
||||
maven("https://maven.fabricmc.net/")
|
||||
}
|
||||
}
|
||||
@@ -111,6 +111,7 @@ class CobblemonNeoForge : CobblemonImplementation {
|
||||
with(MOD_BUS) {
|
||||
this@CobblemonNeoForge.commandArgumentTypes.register(this)
|
||||
addListener(this@CobblemonNeoForge::initialize)
|
||||
val test = ResourceLocation.fromNamespaceAndPath("mincras", "asdfa")
|
||||
Cobblemon.preInitialize(this@CobblemonNeoForge)
|
||||
addListener(CobblemonBiomeModifiers::register)
|
||||
addListener(this@CobblemonNeoForge::on)
|
||||
|
||||
+1
-2
@@ -19,7 +19,6 @@ import com.cobblemon.mod.common.client.pokedex.PokedexType
|
||||
import com.cobblemon.mod.common.client.render.atlas.CobblemonAtlases
|
||||
import com.cobblemon.mod.common.client.render.item.CobblemonModelPredicateRegistry
|
||||
import com.cobblemon.mod.common.client.render.shader.CobblemonShaders
|
||||
import com.cobblemon.mod.common.compat.LambDynamicLightsCompat
|
||||
import com.cobblemon.mod.common.item.PokedexItem
|
||||
import com.cobblemon.mod.common.particle.CobblemonParticles
|
||||
import com.cobblemon.mod.common.particle.SnowstormParticleType
|
||||
@@ -233,7 +232,7 @@ object CobblemonNeoForgeClient : CobblemonClientImplementation {
|
||||
// They have no Maven nor are they published on Modrinth :(
|
||||
// Good thing is they are a copy pasta adapted to Forge :D
|
||||
if (Cobblemon.implementation.isModInstalled("dynamiclightsreforged")) {
|
||||
LambDynamicLightsCompat.hookCompat()
|
||||
//LambDynamicLightsCompat.hookCompat()
|
||||
Cobblemon.LOGGER.info("Dynamic Lights Reforged compatibility enabled")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ issueTrackerURL="https://gitlab.com/cable-mc/cobblemon/-/issues"
|
||||
|
||||
[[mods]] #mandatory
|
||||
modId="cobblemon" #mandatory
|
||||
version="${version}" #mandatory
|
||||
version="1.6.0" #mandatory
|
||||
displayName="Cobblemon" #mandatory
|
||||
displayURL="https://cobblemon.com/"
|
||||
#logoFile="examplemod.png" #optional
|
||||
@@ -24,10 +24,12 @@ config = "mixins.cobblemon-neoforge.json"
|
||||
[[mixins]]
|
||||
config = "mixins.cobblemon-common.json"
|
||||
|
||||
ACCESS_TRANSFORMERS_TEMPLATE
|
||||
|
||||
[[dependencies.cobblemon]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[${minecraft_version}]"
|
||||
versionRange="[1.21.1]"
|
||||
|
||||
[[dependencies.cobblemon]]
|
||||
modId="neoforge" #mandatory
|
||||
|
||||
+11
-20
@@ -1,31 +1,22 @@
|
||||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
|
||||
maven("https://maven.fabricmc.net/")
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.architectury.dev/")
|
||||
maven("https://maven.minecraftforge.net/")
|
||||
maven("https://maven.fabricmc.net/")
|
||||
}
|
||||
|
||||
includeBuild("gradle/build-logic")
|
||||
}
|
||||
|
||||
rootProject.name = "cobblemon"
|
||||
|
||||
listOf(
|
||||
"common",
|
||||
"fabric",
|
||||
"neoforge"
|
||||
).forEach { setupProject(it, file(it)) }
|
||||
|
||||
fun setupProject(name: String, projectDirectory: File) = setupProject(name) {
|
||||
projectDir = projectDirectory
|
||||
includeBuild("build-logic")
|
||||
includeBuild("common") {
|
||||
dependencySubstitution {
|
||||
substitute(module("com.cobblemon:mod")).using(project(":"))
|
||||
substitute(module("com.cobblemon:mod-resources")).using(project(":"))
|
||||
substitute(module("com.cobblemon:mod-accesswideners")).using(project(":"))
|
||||
}
|
||||
}
|
||||
|
||||
inline fun setupProject(name: String, block: ProjectDescriptor.() -> Unit) {
|
||||
include(name)
|
||||
project(":$name").apply(block)
|
||||
}
|
||||
includeBuild("neoforge")
|
||||
includeBuild("fabric")
|
||||
|
||||
Reference in New Issue
Block a user