Minecraft mod adapter
This commit is contained in:
parent
ad119cdb0b
commit
a6abc783b4
@ -12,6 +12,7 @@
|
|||||||
<option value="$PROJECT_DIR$/gson" />
|
<option value="$PROJECT_DIR$/gson" />
|
||||||
<option value="$PROJECT_DIR$/gson-linear-algebra" />
|
<option value="$PROJECT_DIR$/gson-linear-algebra" />
|
||||||
<option value="$PROJECT_DIR$/guava" />
|
<option value="$PROJECT_DIR$/guava" />
|
||||||
|
<option value="$PROJECT_DIR$/kommons-mc" />
|
||||||
<option value="$PROJECT_DIR$/linear-algebra" />
|
<option value="$PROJECT_DIR$/linear-algebra" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
|
@ -5,6 +5,15 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
maven(url = "https://maven.minecraftforge.net") {
|
||||||
|
name = "Minecraft Forge"
|
||||||
|
|
||||||
|
content {
|
||||||
|
includeGroup("net.minecraftforge.gradle")
|
||||||
|
includeGroup("net.minecraftforge")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ kotlin.code.style=official
|
|||||||
specifyKotlinAsDependency=false
|
specifyKotlinAsDependency=false
|
||||||
|
|
||||||
projectGroup=ru.dbotthepony.kommons
|
projectGroup=ru.dbotthepony.kommons
|
||||||
projectVersion=2.9.13
|
projectVersion=2.9.15
|
||||||
|
|
||||||
guavaDepVersion=33.0.0
|
guavaDepVersion=33.0.0
|
||||||
gsonDepVersion=2.8.9
|
gsonDepVersion=2.8.9
|
||||||
|
66
kommons-mc/build.gradle.kts
Normal file
66
kommons-mc/build.gradle.kts
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
// this whole shit is required because you can't have non-mods be
|
||||||
|
// loaded on the GAME layer in Minecraft Forge, and hence,
|
||||||
|
// Kommons can not see Kotlin at runtime (because Kommons being
|
||||||
|
// loaded with system classloader, while Kotlin is loaded by
|
||||||
|
// FML classloader).
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("jvm")
|
||||||
|
id("net.minecraftforge.gradle").version("[6.0.14,6.2)")
|
||||||
|
`maven-publish`
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
minecraft("net.minecraftforge:forge:1.20.2-48.1.0")
|
||||||
|
|
||||||
|
testImplementation("org.jetbrains.kotlin:kotlin-test")
|
||||||
|
|
||||||
|
implementation(project(":")) { setTransitive(false) }
|
||||||
|
implementation(project(":gson")) { setTransitive(false) }
|
||||||
|
implementation(project(":guava")) { setTransitive(false) }
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.jar {
|
||||||
|
dependsOn(":jar")
|
||||||
|
dependsOn(":gson:jar")
|
||||||
|
dependsOn(":guava:jar")
|
||||||
|
from(zipTree(project(":").tasks.jar.get().outputs.files.asPath))
|
||||||
|
from(zipTree(project(":gson").tasks.jar.get().outputs.files.asPath))
|
||||||
|
from(zipTree(project(":guava").tasks.jar.get().outputs.files.asPath))
|
||||||
|
}
|
||||||
|
|
||||||
|
minecraft {
|
||||||
|
mappings("official", "1.20.2")
|
||||||
|
}
|
||||||
|
|
||||||
|
val projectVersion: String by project
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>("mavenJava") {
|
||||||
|
from(components["java"])
|
||||||
|
artifact(tasks["sourceJar"])
|
||||||
|
artifactId = "kommons-mc"
|
||||||
|
|
||||||
|
pom {
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(ProcessResources::class.java) {
|
||||||
|
val replaceProperties = mapOf("mod_version" to projectVersion)
|
||||||
|
inputs.properties(replaceProperties)
|
||||||
|
|
||||||
|
filesMatching(arrayListOf("META-INF/mods.toml")) {
|
||||||
|
expand(replaceProperties)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package ru.dbotthepony.kommons;
|
||||||
|
|
||||||
|
import kotlin.KotlinVersion;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@Mod("kommons")
|
||||||
|
public class KommonsMod {
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
|
|
||||||
|
private static void checkIfKotlinIsInstalled() {
|
||||||
|
if (!KotlinVersion.CURRENT.isAtLeast(1, 8, 0)) {
|
||||||
|
throw new UnsupportedClassVersionError("Installed kotlin version is " + KotlinVersion.CURRENT + ", when at least 1.9.0 is required.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public KommonsMod() {
|
||||||
|
try {
|
||||||
|
checkIfKotlinIsInstalled();
|
||||||
|
} catch (Throwable err) {
|
||||||
|
if (err instanceof NoClassDefFoundError) {
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
LOGGER.fatal("Kommons requires Kotlin to be installed, get Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge");
|
||||||
|
|
||||||
|
LOGGER.fatal("Kommons requires Kotlin to be installed, get Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge", err);
|
||||||
|
throw new RuntimeException("Kommons requires Kotlin to be installed, get Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
LOGGER.fatal("Kommons' Kotlin version is not satisfied, get newer Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge");
|
||||||
|
|
||||||
|
LOGGER.fatal("Kommons' Kotlin version is not satisfied, get newer Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge", err);
|
||||||
|
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.info("Kommons seems to be loaded");
|
||||||
|
}
|
||||||
|
}
|
10
kommons-mc/src/main/resources/META-INF/mods.toml
Normal file
10
kommons-mc/src/main/resources/META-INF/mods.toml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
modLoader="javafml"
|
||||||
|
loaderVersion="[41,)"
|
||||||
|
license="2 Clause BSD"
|
||||||
|
[[mods]] #mandatory
|
||||||
|
modId="kommons"
|
||||||
|
version="${mod_version}"
|
||||||
|
displayName="Kommons"
|
||||||
|
authors="DBotThePony"
|
||||||
|
description='''Adapter "mod" to load my library "Kommons" in minecraft environment'''
|
6
kommons-mc/src/main/resources/pack.mcmeta
Normal file
6
kommons-mc/src/main/resources/pack.mcmeta
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"pack": {
|
||||||
|
"description": "Kommons resources",
|
||||||
|
"pack_format": 18
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,19 @@
|
|||||||
|
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven(url = "https://maven.minecraftforge.net") {
|
||||||
|
name = "Minecraft Forge"
|
||||||
|
|
||||||
|
content {
|
||||||
|
includeGroup("net.minecraftforge.gradle")
|
||||||
|
includeGroup("net.minecraftforge")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
//kotlin("jvm") version "1.9.21"
|
//kotlin("jvm") version "1.9.21"
|
||||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0"
|
id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0"
|
||||||
@ -9,3 +24,4 @@ include("guava")
|
|||||||
include("gson")
|
include("gson")
|
||||||
include("linear-algebra")
|
include("linear-algebra")
|
||||||
include("gson-linear-algebra")
|
include("gson-linear-algebra")
|
||||||
|
include("kommons-mc")
|
||||||
|
Loading…
Reference in New Issue
Block a user