Skip to content
Closed
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
5 changes: 5 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ pluginManagement {
name = "EngineHub Repository"
url = uri("https://maven.enginehub.org/repo/")
}
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
}
}
plugins {
Expand Down Expand Up @@ -64,6 +68,7 @@ listOf("bukkit", "core", "cli").forEach {
include("worldedit-$it")
}
include("worldedit-libs:core:ap")
include("worldedit-fabric")


enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
122 changes: 35 additions & 87 deletions worldedit-fabric/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,109 +1,57 @@
import buildlogic.getLibrary
import buildlogic.stringyLibs
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.task.RemapJarTask
import net.fabricmc.loom.task.RunGameTask
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar.Companion.shadowJar

plugins {
id("fabric-loom")
`java-library`
id("buildlogic.platform")
id("net.fabricmc.fabric-loom-remap") version "1.14-SNAPSHOT"
}

platform {
kind = buildlogic.WorldEditKind.Mod
includeClasspath = true
}

val fabricApiConfiguration: Configuration = configurations.create("fabricApi")

loom {
accessWidenerPath.set(project.file("src/main/resources/worldedit.accesswidener"))
}

tasks.withType<RunGameTask>().configureEach {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}

repositories {
afterEvaluate {
verifyEngineHubRepositories()
serverOnlyMinecraftJar()

splitEnvironmentSourceSets()
mods {
register("fawe") {
sourceSet(sourceSets["main"])
sourceSet(sourceSets["client"])
}
}
}
repositories {

}
dependencies {
"api"(project(":worldedit-core"))
implementation(project(":worldedit-core"));

"minecraft"(libs.fabric.minecraft)
"mappings"(loom.layered {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${libs.versions.parchment.minecraft.get()}:${libs.versions.parchment.mappings.get()}@zip")
})
"modImplementation"(libs.fabric.loader)
"include"(libs.cuiProtocol.fabric)
"modImplementation"(libs.cuiProtocol.fabric)
minecraft("com.mojang:minecraft:${project.findProperty("minecraft_version")}")
mappings(loom.officialMojangMappings())

// [1] Load the API dependencies from the fabric mod json...
@Suppress("UNCHECKED_CAST")
val fabricModJson = file("src/main/resources/fabric.mod.json").bufferedReader().use {
groovy.json.JsonSlurper().parse(it) as Map<String, Map<String, *>>
}
val wantedDependencies = (fabricModJson["depends"] ?: error("no depends in fabric.mod.json")).keys
.filter { it == "fabric-api-base" || it.contains(Regex("v\\d$")) }
.toSet()
// [2] Request the matching dependency from fabric-loom
for (wantedDependency in wantedDependencies) {
val dep = fabricApi.module(wantedDependency, libs.versions.fabric.api.get())
"include"(dep)
"modImplementation"(dep)
}

// No need for this at runtime
"modCompileOnly"(libs.fabric.permissions.api)

// Silence some warnings, since apparently this isn't on the compile classpath like it should be.
"compileOnly"(libs.errorprone.annotations)
modImplementation("net.fabricmc:fabric-loader:${project.findProperty("loader_version")}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.findProperty("fabric_api_version")}")
}
tasks.processResources {
inputs.property("version", project.rootProject.version)

configure<BasePluginExtension> {
archivesName.set("${project.name}-mc${libs.fabric.minecraft.get().version}")
}

configure<PublishingExtension> {
publications.named<MavenPublication>("maven") {
artifactId = the<BasePluginExtension>().archivesName.get()
from(components["java"])
filesMatching("fabric.mod.json") {
expand("version" to project.rootProject.version)
}
}

tasks.named<Copy>("processResources") {
val internalVersion = project.ext["internalVersion"]
// this will ensure that this task is redone when the versions change.
inputs.property("version", internalVersion)
filesMatching("fabric.mod.json") {
this.expand("version" to internalVersion)
}
tasks.withType<JavaCompile>().configureEach {
options.release.set(21)
}

tasks.named<ShadowJar>("shadowJar") {
archiveClassifier.set("dist-dev")
dependencies {
relocate("org.antlr.v4", "com.sk89q.worldedit.antlr4")
relocate("net.royawesome.jlibnoise", "com.sk89q.worldedit.jlibnoise")
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

include(dependency("org.antlr:antlr4-runtime"))
include(dependency("com.sk89q.lib:jlibnoise"))
}
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

tasks.register<RemapJarTask>("remapShadowJar") {
val shadowJar = tasks.getByName<ShadowJar>("shadowJar")
dependsOn(shadowJar)
inputFile.set(shadowJar.archiveFile)
archiveFileName.set(shadowJar.archiveFileName.get().replace(Regex("-dev\\.jar$"), ".jar"))
addNestedDependencies.set(true)
}
tasks.jar {
inputs.property("archivesName", project.base.archivesName)

tasks.named("assemble").configure {
dependsOn("remapShadowJar")
from("LICENSE") {
rename { "${it}_${inputs.properties["archivesName"]}" }
}
}
11 changes: 11 additions & 0 deletions worldedit-fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.11
loader_version=0.18.4

# Mod Properties
maven_group=com.fastasyncworldedit.fabric
archives_base_name=fawe

# Dependencies
fabric_api_version=0.140.2+1.21.11
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.fastasyncworldedit.fabric;

import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Fawe implements ModInitializer {

private static final Logger log = LoggerFactory.getLogger(Fawe.class);

@Override
public void onInitialize() {
}

}

This file was deleted.

Loading
Loading