Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 33 additions & 76 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,104 +1,61 @@
import net.fabricmc.loom.api.LoomGradleExtensionAPI
import net.kyori.indra.licenser.spotless.IndraSpotlessLicenserExtension

plugins {
base
alias(libs.plugins.loom) apply false
alias(libs.plugins.spotless)
alias(libs.plugins.indra.spotlessLicenser) apply false
java
alias(libs.plugins.architectury.loom) apply false
alias(libs.plugins.architectury.plugin)
alias(libs.plugins.shadow) apply false
// TODO: Reinsert the spotless plugin.
//alias(libs.plugins.spotless)
//alias(libs.plugins.indra.spotlessLicenser) apply false
}

allprojects {
subprojects {
apply(plugin = "base")
apply(plugin = "java")
apply(plugin = "dev.architectury.loom")
apply(plugin = "architectury-plugin")
apply(plugin = "maven-publish")

group = "org.enginehub.worldeditcui"
version = "${rootProject.libs.versions.minecraft.get()}+02+SNAPSHOT"
base.archivesName = "${rootProject.name}-${project.name}"

repositories {
// mirrors:
// - https://maven.minecraftforge.net/
// - https://maven.neoforged.net/
// - https://maven.parchmentmc.org/
maven(url = "https://maven.enginehub.org/repo/") {
name = "enginehub"
mavenContent {
excludeGroup("org.lwjgl") // workaround for lwjgl-freetype
}
}
maven(url = "https://maven.terraformersmc.com/releases/") {
name = "terraformersmc"
}
maven(url = "https://repo.viaversion.com/") {
name = "viaversion"
}
// The EngineHub repository mirror the following repository.
// maven { setUrl("https://maven.parchmentmc.org") }
maven { setUrl("https://maven.enginehub.org/repo/") }
}
}

subprojects {
apply(plugin = "java")
apply(plugin = "com.diffplug.spotless")
apply(plugin = "net.kyori.indra.licenser.spotless")
apply(plugin = "maven-publish")
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

val targetJavaVersion: String by project
val targetVersion = targetJavaVersion.toInt()
extensions.configure(JavaPluginExtension::class) {
sourceCompatibility = JavaVersion.toVersion(targetVersion)
targetCompatibility = sourceCompatibility
if (JavaVersion.current() < JavaVersion.toVersion(targetVersion)) {
toolchain.languageVersion = JavaLanguageVersion.of(targetVersion)
}
withSourcesJar()
}

tasks.withType(JavaCompile::class).configureEach {
options.release = targetVersion
options.release = 21
options.encoding = "UTF-8"
options.compilerArgs.addAll(listOf("-Xlint:all", "-Xlint:-processing"))
}

tasks.named("processResources", ProcessResources::class).configure {
inputs.property("version", project.version)

sequenceOf("fabric.mod.json", "META-INF/neoforge.mods.toml").forEach {
filesMatching(it) {
expand("version" to project.version)
}
}
architectury {
minecraft = rootProject.libs.versions.minecraft.get()
}

extensions.configure(IndraSpotlessLicenserExtension::class) {
licenseHeaderFile(rootProject.file("HEADER"))
val loom = extensions.getByType(LoomGradleExtensionAPI::class)
loom.run {
silentMojangMappingsLicense()
}

plugins.withId("dev.architectury.loom") {
val loom = extensions.getByType(LoomGradleExtensionAPI::class)
loom.run {
decompilerOptions.named("vineflower") {
options.put("win", "0")
}
silentMojangMappingsLicense()
}

// Ugly hack for easy genSourcening
afterEvaluate {
tasks.matching { it.name == "genSources" }.configureEach {
setDependsOn(setOf("genSourcesWithVineflower"))
}
}

dependencies {
"minecraft"(libs.minecraft)
"mappings"(loom.layered {
officialMojangMappings {
nameSyntheticMembers = false
}
parchment(variantOf(libs.parchment) { artifactType("zip") })
})
"vineflowerDecompilerClasspath"(libs.vineflower)
}

configurations.named("modLocalRuntime") {
shouldResolveConsistentlyWith(configurations.getByName("modImplementation"))
}
dependencies {
"minecraft"(rootProject.libs.minecraft)
"mappings"(loom.layered() {
officialMojangMappings()
parchment(variantOf(rootProject.libs.parchment) { artifactType("zip") })
})
}

extensions.configure(PublishingExtension::class) {
Expand Down
21 changes: 21 additions & 0 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import dev.architectury.plugin.ArchitectPluginExtension

extensions.configure<ArchitectPluginExtension> {
common(rootProject.properties["enabledPlatforms"].toString().split(','))
}

dependencies {
// We depend on Fabric Loader here to use the Fabric @Environment annotations,
// which get remapped to the correct annotations on each platform.
// Do NOT use other classes from Fabric Loader.
modImplementation(rootProject.libs.fabric.loader)

// Architectury API. This is optional, and you can comment it out if you don't need it.
modImplementation(rootProject.libs.architectury)

modImplementation(rootProject.libs.cuiProtocol.common)
}

loom {
accessWidenerPath = file("src/main/resources/worldeditcui.accesswidener")
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import net.fabricmc.loader.api.FabricLoader;
import dev.architectury.platform.Platform;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import org.enginehub.worldeditcui.InitialisationFactory;
Expand Down Expand Up @@ -144,7 +144,7 @@ public void setClearAllOnKey(boolean clearAllOnKey) {
}

private static Path getConfigFile() {
return FabricLoader.getInstance().getConfigDir().resolve(CUIConfiguration.CONFIG_FILE_NAME);
return Platform.getConfigFolder().resolve(CUIConfiguration.CONFIG_FILE_NAME);
}

public static CUIConfiguration create() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
package org.enginehub.worldeditcui.debug;

import net.fabricmc.loader.api.FabricLoader;
import dev.architectury.platform.Platform;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.Layout;
Expand All @@ -33,7 +33,7 @@
*/
public final class CUIDebug implements InitialisationFactory
{
private static final boolean LOG_ALL_ERRORS = Boolean.getBoolean("wecui.debug.logall") || FabricLoader.getInstance().isDevelopmentEnvironment();
private static final boolean LOG_ALL_ERRORS = Boolean.getBoolean("wecui.debug.logall") || Platform.isDevelopmentEnvironment();
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger("WorldEditCUI");

private final WorldEditCUI controller;
Expand All @@ -50,7 +50,7 @@ public void initialise() throws InitialisationException
// Create a logger that logs to console (if in debug mode), and logs to a debug file
final Logger loggerImpl = (Logger) LogManager.getLogger("WorldEditCUI");

final Path debugFile = FabricLoader.getInstance().getGameDir().resolve("worldeditcui.debug.log");
final Path debugFile = Platform.getGameFolder().resolve("worldeditcui.debug.log");

// Apply defined layout from MC's configured file appender, if possible
Layout<?> layout = null;
Expand Down
66 changes: 66 additions & 0 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
repositories {
maven { setUrl("https://maven.terraformersmc.com/") }
maven { setUrl("https://repo.viaversion.com") }
}

plugins {
alias(libs.plugins.shadow)
}

architectury {
platformSetupLoomIde()
fabric()
}

val common: Configuration by configurations.creating
val shadowBundle: Configuration by configurations.creating
val developmentFabric: Configuration by configurations.getting

configurations {
common.isCanBeResolved = true
common.isCanBeConsumed = false

compileClasspath {
extendsFrom(common)
}
runtimeClasspath {
extendsFrom(common)
}
developmentFabric.extendsFrom(common)

// Files in this configuration will be bundled into your mod using the Shadow plugin.
// Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files.
shadowBundle.isCanBeResolved = true
shadowBundle.isCanBeConsumed = false
}

dependencies {
modImplementation(rootProject.libs.fabric.loader)
modImplementation(rootProject.libs.fabric.api)

common(project(":common", "namedElements")) { isTransitive = false }
shadowBundle(project(":common", "transformProductionFabric"))

modImplementation(rootProject.libs.cuiProtocol.fabric)
modImplementation(rootProject.libs.modmenu)
modCompileOnly(rootProject.libs.viaversion)
}

tasks.processResources {
inputs.property("version", project.version)

filesMatching("fabric.mod.json") {
expand("version" to project.version)
}
}

tasks.shadowJar {
configurations = listOf(shadowBundle)
archiveClassifier.set("dev-shadow")
}

tasks.remapJar {
inputFile.set(tasks.shadowJar.get().archiveFile)
}

// TODO: Add the releasing build scripts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,9 @@
},
"depends": {
"worldeditcui_protocol": "*",
"fabric-api-base": "*",
"fabric-key-binding-api-v1": "^1.0.0",
"fabric-networking-api-v1": "*",
"fabric-rendering-v1": ">=1.5.0",
"fabric-lifecycle-events-v1": "^2.0.0",
"fabric-screen-api-v1": ">=1.0.9",
"fabric-resource-loader-v0": ">=0.4.17",
"fabric-transitive-access-wideners-v1": "*",
"fabricloader": ">=0.18.3",
"fabric-api": "*",
"architectury": ">=19.0.1",
"minecraft": ">=1.21.9"
},
"suggests": {
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
cfProjectId=402098

# Project configuration
targetJavaVersion=21
enabledPlatforms=fabric,neoforge

# Gradle
Expand Down
73 changes: 48 additions & 25 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,69 @@
format = { version = "1.1" }

[versions]
indra = "3.1.3"
minecraft = "1.21.11"

# Mod Loaders & Wrapper
fabricLoader = "0.18.3"
fabricApi = "0.140.0+1.21.11"
neoforge = "21.11.32-beta"
architectury = "19.0.1"
architecturyPlugin = "3.4.162"
architecturyLoom = "1.13.463"

# CUI dependencies
worldedit = "7.3.14"
cuiProtocol = "4.0.2"
modmenu = "16.0.0-rc.1"
viafabricplus = "3.3.0"
viaversion = "5.0.5"

# Dev Dependencies (Workflow, Publish)
parchment = "2025.10.12"
indra = "3.1.3"
vineflower = "1.10.1"
cuiProtocol = "4.0.2"
shadow = "8.3.5"
spotless = "6.25.0"
jvmConflictResolution = "2.1.2"
versions = "0.51.0"
curseForgeGradle = "1.1.26"
publishGithubRelease = "0.1.0"
minotaur = "2.8.7"

[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
parchment = { module = "org.parchmentmc.data:parchment-1.21.10", version = "2025.10.12" }

# Mod Loaders
fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabricLoader" }
fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabricApi" }
fabric-api-bom = { module = "net.fabricmc.fabric-api:fabric-api-bom", version.ref = "fabricApi" }
fabric-api-networking = { module = "net.fabricmc.fabric-api:fabric-networking-api-v1" }
neoforge = { module = "net.neoforged:neoforge", version.ref = "neoforge"}
architectury = { module = "dev.architectury:architectury", version.ref = "architectury" }

# CUI Dependencies
worldedit = { module = "com.sk89q.worldedit:worldedit-fabric-mc1.21", version.ref = "worldedit" }
modmenu = { module = "com.terraformersmc:modmenu", version.ref = "modmenu" }
neoforge = { module = "net.neoforged:neoforge", version = "21.10.9-beta"}
viafabricplus-api = { module = "de.florianmichael:ViaFabricPlus", version.ref = "viafabricplus" }
viaversion = { module = "com.viaversion:viaversion-common", version = "5.0.5" }
viaversion = { module = "com.viaversion:viaversion-common", version.ref = "viaversion" }
cuiProtocol-common = { module = "org.enginehub.worldeditcui-protocol:worldeditcui-protocol-common-mc1.21.11", version.ref = "cuiProtocol"}
cuiProtocol-fabric = { module = "org.enginehub.worldeditcui-protocol:worldeditcui-protocol-fabric-mc1.21.11", version.ref = "cuiProtocol"}
cuiProtocol-neoforge = { module = "org.enginehub.worldeditcui-protocol:worldeditcui-protocol-neoforge-mc1.21.11", version.ref = "cuiProtocol"}

# Dev Dependencies
vineflower = { module = "org.vineflower:vineflower", version.ref = "vineflower" }
worldedit = { module = "com.sk89q.worldedit:worldedit-fabric-mc1.21", version = "7.3.14" }
parchment = { module = "org.parchmentmc.data:parchment-1.21.10", version.ref = "parchment" }

[plugins]
architecturyPlugin = { id = "architectury-plugin", version = "3.4.160" }
curseForgeGradle = { id = "net.darkhax.curseforgegradle", version = "1.1.26" }
# From the Architectury Template
architectury-plugin = { id = "architectury-plugin", version.ref = "architecturyPlugin" }
architectury-loom = { id = "dev.architectury.loom", version.ref = "architecturyLoom" }
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }

# Dev Workflow
indra-git = { id = "net.kyori.indra.git", version.ref = "indra" }
indra-spotlessLicenser = { id = "net.kyori.indra.licenser.spotless", version.ref = "indra" }
jvmConflictResolution = { id = "org.gradlex.jvm-dependency-conflict-resolution", version = "2.1.2" }
loom = { id = "dev.architectury.loom", version = "1.13.463" }
minotaur = { id = "com.modrinth.minotaur", version = "2.8.7" }
publishGithubRelease = { id = "ca.stellardrift.publish-github-release", version = "0.1.0" }
shadow = { id = "com.gradleup.shadow", version = "8.3.5" }
spotless = { id = "com.diffplug.spotless", version = "6.25.0" }
versions = { id = "com.github.ben-manes.versions", version = "0.51.0" }

[libraries.cuiProtocol-fabric]
module = "org.enginehub.worldeditcui-protocol:worldeditcui-protocol-fabric-mc1.21.11"
version.ref = "cuiProtocol"

[libraries.cuiProtocol-neoforge]
module = "org.enginehub.worldeditcui-protocol:worldeditcui-protocol-neoforge-mc1.21.11"
version.ref = "cuiProtocol"
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
jvmConflictResolution = { id = "org.gradlex.jvm-dependency-conflict-resolution", version.ref = "jvmConflictResolution" }
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
curseForgeGradle = { id = "net.darkhax.curseforgegradle", version.ref = "curseForgeGradle" }
publishGithubRelease = { id = "ca.stellardrift.publish-github-release", version.ref = "publishGithubRelease" }
minotaur = { id = "com.modrinth.minotaur", version.ref = "minotaur" }
Loading