mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2025-12-20 15:29:20 +00:00
Start splitting into isolated / base modules and adapting to merge changes
This commit is contained in:
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
# See https://github.com/actions/setup-java/commits
|
# See https://github.com/actions/setup-java/commits
|
||||||
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
|
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
|
||||||
with:
|
with:
|
||||||
java-version: 17
|
java-version: 21
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
|
|||||||
31
.github/workflows/publish.yml
vendored
31
.github/workflows/publish.yml
vendored
@@ -1,31 +0,0 @@
|
|||||||
name: Publish
|
|
||||||
on: push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Setup Gradle
|
|
||||||
uses: GeyserMC/actions/setup-gradle-composite@master
|
|
||||||
with:
|
|
||||||
setup-java_java-version: 21
|
|
||||||
|
|
||||||
- name: Build Floodgate-Modded
|
|
||||||
run: ./gradlew build
|
|
||||||
|
|
||||||
- name: Publish to Modrinth
|
|
||||||
if: ${{ success() && github.repository == 'GeyserMC/Floodgate-Modded' && github.ref_name == 'master' }}
|
|
||||||
uses: gradle/gradle-build-action@3bfe3a46584a206fb8361cdedd0647b0c4204232
|
|
||||||
env:
|
|
||||||
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
|
||||||
with:
|
|
||||||
arguments: modrinth
|
|
||||||
gradle-home-cache-cleanup: true
|
|
||||||
|
|
||||||
- name: Archive Artifacts
|
|
||||||
uses: GeyserMC/actions/upload-multi-artifact@master
|
|
||||||
if: success()
|
|
||||||
with:
|
|
||||||
artifacts: |
|
|
||||||
Floodgate-Fabric:fabric/build/libs/floodgate-fabric.jar
|
|
||||||
Floodgate-NeoForge:neoforge/build/libs/floodgate-neoforge.jar
|
|
||||||
2
.github/workflows/pullrequest.yml
vendored
2
.github/workflows/pullrequest.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
# See https://github.com/actions/setup-java/commits
|
# See https://github.com/actions/setup-java/commits
|
||||||
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
|
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
|
||||||
with:
|
with:
|
||||||
java-version: 17
|
java-version: 21
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
plugins {
|
|
||||||
`kotlin-dsl`
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
gradlePluginPortal()
|
|
||||||
mavenCentral()
|
|
||||||
maven("https://maven.architectury.dev/")
|
|
||||||
maven("https://maven.fabricmc.net/")
|
|
||||||
maven("https://maven.neoforged.net/releases/")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
// Used to access version catalogue from the convention plugins
|
|
||||||
// this is OK as long as the same version catalog is used in the main build and build-logic
|
|
||||||
// see https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
|
|
||||||
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
|
|
||||||
implementation(libs.indra)
|
|
||||||
implementation(libs.shadow)
|
|
||||||
implementation(libs.architectury.plugin)
|
|
||||||
implementation(libs.architectury.loom)
|
|
||||||
implementation(libs.minotaur)
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
@file:Suppress("UnstableApiUsage")
|
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
|
||||||
versionCatalogs {
|
|
||||||
create("libs") {
|
|
||||||
from(files("../gradle/libs.versions.toml"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rootProject.name = "build-logic"
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
import org.gradle.api.Project
|
|
||||||
import org.gradle.api.artifacts.MinimalExternalModuleDependency
|
|
||||||
import org.gradle.api.artifacts.ProjectDependency
|
|
||||||
import org.gradle.api.provider.Provider
|
|
||||||
|
|
||||||
val providedDependencies = mutableMapOf<String, MutableSet<String>>()
|
|
||||||
|
|
||||||
fun Project.provided(pattern: String, name: String, excludedOn: Int = 0b110) {
|
|
||||||
providedDependencies.getOrPut(project.name) { mutableSetOf() }
|
|
||||||
.add("${calcExclusion(pattern, 0b100, excludedOn)}:${calcExclusion(name, 0b10, excludedOn)}")
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Project.provided(dependency: ProjectDependency) =
|
|
||||||
provided(dependency.group!!, dependency.name)
|
|
||||||
|
|
||||||
fun Project.provided(dependency: MinimalExternalModuleDependency) =
|
|
||||||
provided(dependency.module.group, dependency.module.name)
|
|
||||||
|
|
||||||
fun Project.provided(provider: Provider<MinimalExternalModuleDependency>) =
|
|
||||||
provided(provider.get())
|
|
||||||
|
|
||||||
fun getProvidedDependenciesForProject(projectName: String): MutableSet<String> {
|
|
||||||
return providedDependencies.getOrDefault(projectName, emptySet()).toMutableSet()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun calcExclusion(section: String, bit: Int, excludedOn: Int): String =
|
|
||||||
if (excludedOn and bit > 0) section else ""
|
|
||||||
|
|
||||||
fun projectVersion(project: Project): String =
|
|
||||||
project.version.toString().replace("SNAPSHOT", "b" + buildNumber())
|
|
||||||
|
|
||||||
fun versionName(project: Project): String =
|
|
||||||
"Floodgate-" + project.name.replaceFirstChar { it.uppercase() } + "-" + projectVersion(project)
|
|
||||||
|
|
||||||
fun buildNumber(): Int =
|
|
||||||
(System.getenv("GITHUB_RUN_NUMBER"))?.let { Integer.parseInt(it) } ?: -1
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
plugins {
|
|
||||||
`java-library`
|
|
||||||
id("net.kyori.indra")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly("org.checkerframework", "checker-qual", "3.19.0")
|
|
||||||
}
|
|
||||||
|
|
||||||
indra {
|
|
||||||
github("GeyserMC", "floodgate-modded") {
|
|
||||||
ci(true)
|
|
||||||
issues(true)
|
|
||||||
scm(true)
|
|
||||||
}
|
|
||||||
mitLicense()
|
|
||||||
|
|
||||||
javaVersions {
|
|
||||||
target(21)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks {
|
|
||||||
processResources {
|
|
||||||
filesMatching(listOf("fabric.mod.json", "META-INF/neoforge.mods.toml")) {
|
|
||||||
expand(
|
|
||||||
"id" to "floodgate",
|
|
||||||
"name" to "Floodgate",
|
|
||||||
"version" to project.version,
|
|
||||||
"description" to project.description,
|
|
||||||
"url" to "https://geysermc.org",
|
|
||||||
"author" to "GeyserMC",
|
|
||||||
"minecraft_version" to libs.versions.minecraft.version.get()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
repositories {
|
|
||||||
// mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
maven("https://maven.fabricmc.net/")
|
|
||||||
maven("https://maven.neoforged.net/releases")
|
|
||||||
maven("https://repo.opencollab.dev/main/")
|
|
||||||
maven("https://jitpack.io") {
|
|
||||||
content {
|
|
||||||
includeGroupByRegex("com.github.*")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
maven("https://oss.sonatype.org/content/repositories/snapshots/")
|
|
||||||
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
|
|
||||||
}
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id("floodgate-modded.publish-conventions")
|
|
||||||
id("architectury-plugin")
|
|
||||||
id("dev.architectury.loom")
|
|
||||||
id("com.modrinth.minotaur")
|
|
||||||
}
|
|
||||||
|
|
||||||
// These are all provided by Minecraft/server platforms
|
|
||||||
provided("com.google.code.gson", "gson")
|
|
||||||
provided("org.slf4j", ".*")
|
|
||||||
provided("com.google.guava", "guava")
|
|
||||||
provided("org.ow2.asm", "asm")
|
|
||||||
provided("com.nukkitx.fastutil", ".*")
|
|
||||||
|
|
||||||
// these we just don't want to include
|
|
||||||
provided("org.checkerframework", ".*")
|
|
||||||
provided("com.google.errorprone", ".*")
|
|
||||||
provided("com.github.spotbugs", "spotbugs-annotations")
|
|
||||||
provided("com.google.code.findbugs", ".*")
|
|
||||||
|
|
||||||
// cloud-fabric/cloud-neoforge jij's all cloud depends already
|
|
||||||
provided("org.incendo", ".*")
|
|
||||||
provided("io.leangen.geantyref", "geantyref")
|
|
||||||
|
|
||||||
architectury {
|
|
||||||
minecraft = libs.versions.minecraft.version.get()
|
|
||||||
}
|
|
||||||
|
|
||||||
loom {
|
|
||||||
silentMojangMappingsLicense()
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
create("includeTransitive").isTransitive = true
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
minecraft(libs.minecraft)
|
|
||||||
mappings(loom.officialMojangMappings())
|
|
||||||
|
|
||||||
// These are under our own namespace
|
|
||||||
shadow(libs.floodgate.api) { isTransitive = false }
|
|
||||||
shadow(libs.floodgate.core) { isTransitive = false }
|
|
||||||
|
|
||||||
// Requires relocation
|
|
||||||
shadow(libs.bstats) { isTransitive = false }
|
|
||||||
|
|
||||||
// Shadow & relocate these since the (indirectly) depend on quite old dependencies
|
|
||||||
shadow(libs.guice) { isTransitive = false }
|
|
||||||
shadow(libs.configutils) {
|
|
||||||
exclude("org.checkerframework")
|
|
||||||
exclude("com.google.errorprone")
|
|
||||||
exclude("com.github.spotbugs")
|
|
||||||
exclude("com.nukkitx.fastutil")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks {
|
|
||||||
sourcesJar {
|
|
||||||
archiveClassifier.set("sources")
|
|
||||||
from(sourceSets.main.get().allSource)
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
// Mirrors the example fabric project, otherwise tons of dependencies are shaded that shouldn't be
|
|
||||||
configurations = listOf(project.configurations.shadow.get())
|
|
||||||
|
|
||||||
// Relocate these
|
|
||||||
relocate("org.bstats", "org.geysermc.floodgate.shadow.bstats")
|
|
||||||
relocate("com.google.inject", "org.geysermc.floodgate.shadow.google.inject")
|
|
||||||
relocate("org.yaml", "org.geysermc.floodgate.shadow.org.yaml")
|
|
||||||
|
|
||||||
// The remapped shadowJar is the final desired mod jar
|
|
||||||
archiveVersion.set(project.version.toString())
|
|
||||||
archiveClassifier.set("shaded")
|
|
||||||
}
|
|
||||||
|
|
||||||
remapJar {
|
|
||||||
dependsOn(shadowJar)
|
|
||||||
inputFile.set(shadowJar.get().archiveFile)
|
|
||||||
archiveClassifier.set("")
|
|
||||||
archiveVersion.set("")
|
|
||||||
}
|
|
||||||
|
|
||||||
register<Copy>("renameTask") {
|
|
||||||
dependsOn(remapJar)
|
|
||||||
|
|
||||||
val modrinthFileName = "${versionName(project)}.jar"
|
|
||||||
val libsFile = remapJar.get().destinationDirectory.get().asFile
|
|
||||||
|
|
||||||
from(remapJar.get().archiveFile)
|
|
||||||
rename { modrinthFileName }
|
|
||||||
into(libsFile)
|
|
||||||
|
|
||||||
outputs.file(libsFile.resolve(modrinthFileName))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Readme sync
|
|
||||||
modrinth.get().dependsOn(tasks.modrinthSyncBody)
|
|
||||||
modrinth.get().dependsOn(tasks.getByName("renameTask"))
|
|
||||||
}
|
|
||||||
|
|
||||||
afterEvaluate {
|
|
||||||
val providedDependencies = getProvidedDependenciesForProject(project.name)
|
|
||||||
|
|
||||||
// These are shaded, no need to JiJ them
|
|
||||||
configurations["shadow"].resolvedConfiguration.resolvedArtifacts.forEach {shadowed ->
|
|
||||||
val string = "${shadowed.moduleVersion.id.group}:${shadowed.moduleVersion.id.name}"
|
|
||||||
println("Not including shadowed dependency: $string")
|
|
||||||
providedDependencies.add(string)
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations["includeTransitive"].resolvedConfiguration.resolvedArtifacts.forEach { dep ->
|
|
||||||
if (!providedDependencies.contains("${dep.moduleVersion.id.group}:${dep.moduleVersion.id.name}")
|
|
||||||
and !providedDependencies.contains("${dep.moduleVersion.id.group}:.*")) {
|
|
||||||
println("Including dependency via JiJ: ${dep.id}")
|
|
||||||
dependencies.add("include", dep.moduleVersion.id.toString())
|
|
||||||
} else {
|
|
||||||
println("Not including ${dep.id} for ${project.name}!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
modrinth {
|
|
||||||
token.set(System.getenv("MODRINTH_TOKEN")) // Even though this is the default value, apparently this prevents GitHub Actions caching the token?
|
|
||||||
projectId.set("bWrNNfkb")
|
|
||||||
versionName.set(versionName(project))
|
|
||||||
versionNumber.set(projectVersion(project))
|
|
||||||
versionType.set("release")
|
|
||||||
changelog.set("A changelog can be found at https://github.com/GeyserMC/Floodgate-Modded/commits")
|
|
||||||
|
|
||||||
syncBodyFrom.set(rootProject.file("README.md").readText())
|
|
||||||
|
|
||||||
uploadFile.set(tasks.remapJar.get().destinationDirectory.get().asFile.resolve("${versionName(project)}.jar"))
|
|
||||||
gameVersions.add(libs.minecraft.get().version as String)
|
|
||||||
failSilently.set(false)
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id("floodgate-modded.shadow-conventions")
|
|
||||||
id("net.kyori.indra.publishing")
|
|
||||||
}
|
|
||||||
|
|
||||||
indra {
|
|
||||||
publishSnapshotsTo("geysermc", "https://repo.opencollab.dev/maven-snapshots")
|
|
||||||
publishReleasesTo("geysermc", "https://repo.opencollab.dev/maven-releases")
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
// skip shadow jar from publishing. Workaround for https://github.com/johnrengelman/shadow/issues/651
|
|
||||||
val javaComponent = project.components["java"] as AdhocComponentWithVariants
|
|
||||||
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) { skip() }
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("floodgate-modded.base-conventions")
|
|
||||||
id("com.github.johnrengelman.shadow")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks {
|
|
||||||
named<Jar>("jar") {
|
|
||||||
archiveClassifier.set("unshaded")
|
|
||||||
from(project.rootProject.file("LICENSE"))
|
|
||||||
}
|
|
||||||
val shadowJar = named<ShadowJar>("shadowJar") {
|
|
||||||
archiveBaseName.set(project.name)
|
|
||||||
archiveVersion.set("")
|
|
||||||
archiveClassifier.set("")
|
|
||||||
|
|
||||||
val sJar: ShadowJar = this
|
|
||||||
|
|
||||||
doFirst {
|
|
||||||
providedDependencies[project.name]?.forEach { string ->
|
|
||||||
sJar.dependencies {
|
|
||||||
println("Excluding $string from ${project.name}")
|
|
||||||
exclude(dependency(string))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sJar.dependencies {
|
|
||||||
exclude(dependency("org.checkerframework:checker-qual:.*"))
|
|
||||||
exclude(dependency("org.jetbrains:annotations:.*"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
named("build") {
|
|
||||||
dependsOn(shadowJar)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,9 +4,17 @@ plugins {
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
mavenCentral()
|
||||||
|
maven("https://maven.architectury.dev/")
|
||||||
|
maven("https://maven.fabricmc.net/")
|
||||||
|
maven("https://maven.neoforged.net/releases/")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
// Used to access version catalogue from the convention plugins
|
||||||
|
// this is OK as long as the same version catalog is used in the main build and build-logic
|
||||||
|
// see https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
|
||||||
|
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
|
||||||
implementation(libs.lombok)
|
implementation(libs.lombok)
|
||||||
implementation(libs.micronaut)
|
implementation(libs.micronaut)
|
||||||
implementation(libs.indra.common)
|
implementation(libs.indra.common)
|
||||||
@@ -14,4 +22,7 @@ dependencies {
|
|||||||
implementation(libs.indra.licenser.spotless)
|
implementation(libs.indra.licenser.spotless)
|
||||||
implementation(libs.shadow)
|
implementation(libs.shadow)
|
||||||
implementation(libs.gradle.idea.ext)
|
implementation(libs.gradle.idea.ext)
|
||||||
|
implementation(libs.architectury.plugin)
|
||||||
|
implementation(libs.architectury.loom)
|
||||||
|
//implementation(libs.minotaur) TODO modrinth publishing
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import org.gradle.accessors.dm.LibrariesForLibs
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.getByType
|
import org.gradle.kotlin.dsl.getByType
|
||||||
|
import org.gradle.accessors.dm.LibrariesForLibs
|
||||||
|
|
||||||
val Project.libs: LibrariesForLibs
|
val Project.libs: LibrariesForLibs
|
||||||
get() = rootProject.extensions.getByType()
|
get() = rootProject.extensions.getByType()
|
||||||
@@ -48,8 +48,28 @@ tasks {
|
|||||||
"version" to fullVersion(),
|
"version" to fullVersion(),
|
||||||
"description" to project.description,
|
"description" to project.description,
|
||||||
"url" to "https://geysermc.org",
|
"url" to "https://geysermc.org",
|
||||||
"author" to "GeyserMC"
|
"author" to "GeyserMC",
|
||||||
|
"minecraft_version" to libs.versions.minecraft.version.get()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven("https://repo.opencollab.dev/main/")
|
||||||
|
|
||||||
|
maven("https://maven.fabricmc.net/")
|
||||||
|
maven("https://maven.neoforged.net/releases")
|
||||||
|
maven("https://repo.papermc.io/repository/maven-public")
|
||||||
|
|
||||||
|
// Spigot
|
||||||
|
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots") {
|
||||||
|
mavenContent { snapshotsOnly() }
|
||||||
|
}
|
||||||
|
|
||||||
|
maven("https://libraries.minecraft.net") {
|
||||||
|
name = "minecraft"
|
||||||
|
mavenContent { releasesOnly() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
plugins {
|
||||||
|
id("floodgate.base-conventions")
|
||||||
|
id("architectury-plugin")
|
||||||
|
id("dev.architectury.loom")
|
||||||
|
}
|
||||||
|
|
||||||
|
architectury {
|
||||||
|
minecraft = libs.versions.minecraft.version.get()
|
||||||
|
}
|
||||||
|
|
||||||
|
loom {
|
||||||
|
silentMojangMappingsLicense()
|
||||||
|
}
|
||||||
|
|
||||||
|
indra {
|
||||||
|
javaVersions {
|
||||||
|
target(21)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
minecraft(libs.minecraft)
|
||||||
|
mappings(loom.officialMojangMappings())
|
||||||
|
}
|
||||||
@@ -6,4 +6,11 @@ plugins {
|
|||||||
indra {
|
indra {
|
||||||
publishSnapshotsTo("geysermc", "https://repo.opencollab.dev/maven-snapshots")
|
publishSnapshotsTo("geysermc", "https://repo.opencollab.dev/maven-snapshots")
|
||||||
publishReleasesTo("geysermc", "https://repo.opencollab.dev/maven-releases")
|
publishReleasesTo("geysermc", "https://repo.opencollab.dev/maven-releases")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
//publishing {
|
||||||
|
// // skip shadow jar from publishing. Workaround for https://github.com/johnrengelman/shadow/issues/651
|
||||||
|
// val javaComponent = project.components["java"] as AdhocComponentWithVariants
|
||||||
|
// javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) { skip() }
|
||||||
|
//}
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
plugins {
|
||||||
|
id("floodgate.modded-conventions")
|
||||||
|
}
|
||||||
|
|
||||||
architectury {
|
architectury {
|
||||||
platformSetupLoomIde()
|
platformSetupLoomIde()
|
||||||
fabric()
|
fabric()
|
||||||
@@ -41,7 +45,8 @@ tasks {
|
|||||||
archiveBaseName.set("floodgate-fabric")
|
archiveBaseName.set("floodgate-fabric")
|
||||||
}
|
}
|
||||||
|
|
||||||
modrinth {
|
// modrinth {
|
||||||
loaders.add("fabric")
|
// loaders.add("fabric")
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
[versions]
|
[versions]
|
||||||
# parent
|
|
||||||
micronaut-gradle = "4.4.2"
|
|
||||||
lombok = "8.4"
|
|
||||||
|
|
||||||
# api
|
# api
|
||||||
cumulus = "2.0.0-SNAPSHOT"
|
cumulus = "2.0.0-SNAPSHOT"
|
||||||
@@ -34,11 +31,29 @@ authlib = "5.0.47"
|
|||||||
# velocity
|
# velocity
|
||||||
velocity = "3.3.0-SNAPSHOT"
|
velocity = "3.3.0-SNAPSHOT"
|
||||||
|
|
||||||
|
# modded
|
||||||
|
architectury-plugin = "3.4-SNAPSHOT"
|
||||||
|
architectury-loom = "1.11-SNAPSHOT"
|
||||||
|
minecraft-version = "1.21.8"
|
||||||
|
minotaur = "2.+"
|
||||||
|
mixin = "0.8.5"
|
||||||
|
asm = "5.2"
|
||||||
|
|
||||||
|
# fabric
|
||||||
|
fabric-loader = "0.16.14"
|
||||||
|
fabric-api = "0.127.1+1.21.6"
|
||||||
|
fabric-permissions-api = "0.4.1-SNAPSHOT"
|
||||||
|
|
||||||
|
# neoforge
|
||||||
|
neoforge-version = "21.6.11-beta"
|
||||||
|
|
||||||
# buildSrc
|
# buildSrc
|
||||||
indra = "3.1.3"
|
indra = "3.1.3"
|
||||||
shadow = "8.3.0"
|
shadow = "8.3.0"
|
||||||
gradle-idea-ext = "1.1.7"
|
gradle-idea-ext = "1.1.7"
|
||||||
checkerframework = "3.42.0"
|
checkerframework = "3.42.0"
|
||||||
|
micronaut-gradle = "4.4.2"
|
||||||
|
lombok = "8.4"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
# indirectly included
|
# indirectly included
|
||||||
@@ -102,6 +117,21 @@ cloud-velocity = { module = "org.incendo:cloud-velocity", version.ref = "cloud-p
|
|||||||
velocity-api = { module = "com.velocitypowered:velocity-api", version.ref = "velocity" }
|
velocity-api = { module = "com.velocitypowered:velocity-api", version.ref = "velocity" }
|
||||||
velocity-proxy = { module = "com.velocitypowered:velocity-proxy", version.ref = "velocity" }
|
velocity-proxy = { module = "com.velocitypowered:velocity-proxy", version.ref = "velocity" }
|
||||||
|
|
||||||
|
# modded
|
||||||
|
mixin = { group = "org.spongepowered", name = "mixin", version.ref = "mixin" }
|
||||||
|
asm = { group = "org.ow2.asm", name = "asm-debug-all", version.ref = "asm" }
|
||||||
|
minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft-version" }
|
||||||
|
|
||||||
|
# fabric
|
||||||
|
cloud-fabric = { group = "org.incendo", name = "cloud-fabric", version.ref = "cloud-platform" }
|
||||||
|
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-permissions-api = { group = "me.lucko", name = "fabric-permissions-api", version.ref = "fabric-permissions-api" }
|
||||||
|
|
||||||
|
# neoforge
|
||||||
|
cloud-neoforge = { group = "org.incendo", name = "cloud-neoforge", version.ref = "cloud-platform" }
|
||||||
|
neoforge = { group = "net.neoforged", name = "neoforge", version.ref = "neoforge-version" }
|
||||||
|
|
||||||
# buildSrc
|
# buildSrc
|
||||||
checker-qual = { module = "org.checkerframework:checker-qual", version.ref = "checkerframework" }
|
checker-qual = { module = "org.checkerframework:checker-qual", version.ref = "checkerframework" }
|
||||||
# plugins
|
# plugins
|
||||||
@@ -112,6 +142,9 @@ shadow = { group = "com.gradleup.shadow", name = "com.gradleup.shadow.gradle.plu
|
|||||||
gradle-idea-ext = { module = "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext", version.ref = "gradle-idea-ext" }
|
gradle-idea-ext = { module = "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext", version.ref = "gradle-idea-ext" }
|
||||||
lombok = { group = "io.freefair.gradle", name = "lombok-plugin", version.ref = "lombok" }
|
lombok = { group = "io.freefair.gradle", name = "lombok-plugin", version.ref = "lombok" }
|
||||||
micronaut = { group = "io.micronaut.library", name = "io.micronaut.library.gradle.plugin", version.ref = "micronaut-gradle" }
|
micronaut = { group = "io.micronaut.library", name = "io.micronaut.library.gradle.plugin", version.ref = "micronaut-gradle" }
|
||||||
|
minotaur = { group = "com.modrinth.minotaur", name = "Minotaur", version.ref = "minotaur" }
|
||||||
|
architectury-plugin = { group = "architectury-plugin", name = "architectury-plugin.gradle.plugin", version.ref = "architectury-plugin" }
|
||||||
|
architectury-loom = { group = "dev.architectury.loom", name = "dev.architectury.loom.gradle.plugin", version.ref = "architectury-loom" }
|
||||||
|
|
||||||
[bundles]
|
[bundles]
|
||||||
fastutil = ["fastutil-short-object-maps", "fastutil-int-object-maps"]
|
fastutil = ["fastutil-short-object-maps", "fastutil-int-object-maps"]
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -1,33 +1,25 @@
|
|||||||
|
plugins {
|
||||||
|
id("floodgate.modded-conventions")
|
||||||
|
}
|
||||||
|
|
||||||
architectury {
|
architectury {
|
||||||
common("neoforge", "fabric")
|
common("neoforge", "fabric")
|
||||||
}
|
}
|
||||||
|
|
||||||
loom {
|
//loom {
|
||||||
accessWidenerPath = file("src/main/resources/floodgate.accesswidener")
|
// accessWidenerPath = file("src/main/resources/floodgate.accesswidener")
|
||||||
mixin.defaultRefmapName.set("floodgate-refmap.json")
|
// mixin.defaultRefmapName.set("floodgate-refmap.json")
|
||||||
}
|
//}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(libs.floodgate.core)
|
api(projects.coreNetty4)
|
||||||
api(libs.floodgate.api)
|
annotationProcessor(projects.coreNetty4)
|
||||||
api(libs.guice)
|
annotationProcessor(libs.micronaut.inject.java)
|
||||||
|
compileOnlyApi(projects.isolation)
|
||||||
|
|
||||||
compileOnly(libs.mixin)
|
compileOnly(libs.mixin)
|
||||||
compileOnly(libs.asm)
|
compileOnly(libs.asm)
|
||||||
modCompileOnly(libs.geyser.mod) { isTransitive = false }
|
|
||||||
modCompileOnly(libs.geyser.core) { isTransitive = false }
|
|
||||||
|
|
||||||
// Only here to suppress "unknown enum constant EnvType.CLIENT" warnings.
|
// Only here to suppress "unknown enum constant EnvType.CLIENT" warnings.
|
||||||
compileOnly(libs.fabric.loader)
|
compileOnly(libs.fabric.loader)
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEvaluate {
|
|
||||||
// We don't need these
|
|
||||||
tasks.named("renameTask").configure {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named("modrinth").configure {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
package org.geysermc.floodgate.mod;
|
|
||||||
|
|
||||||
import com.google.inject.Guice;
|
|
||||||
import com.google.inject.Injector;
|
|
||||||
import com.google.inject.Module;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
||||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
|
||||||
import org.geysermc.floodgate.core.FloodgatePlatform;
|
|
||||||
import org.geysermc.floodgate.mod.module.ModAddonModule;
|
|
||||||
import org.geysermc.floodgate.mod.module.ModListenerModule;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
public abstract class FloodgateMod {
|
|
||||||
public static FloodgateMod INSTANCE;
|
|
||||||
|
|
||||||
private boolean started;
|
|
||||||
private FloodgatePlatform platform;
|
|
||||||
protected Injector injector;
|
|
||||||
|
|
||||||
protected void init(Module... modules) {
|
|
||||||
INSTANCE = this;
|
|
||||||
injector = Guice.createInjector(modules);
|
|
||||||
platform = injector.getInstance(FloodgatePlatform.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void enable(MinecraftServer server) {
|
|
||||||
long ctm = System.currentTimeMillis();
|
|
||||||
|
|
||||||
// Stupid hack, see the class for more information
|
|
||||||
// This can probably be Guice-i-fied but that is beyond me
|
|
||||||
MinecraftServerHolder.set(server);
|
|
||||||
|
|
||||||
if (!started) {
|
|
||||||
platform.enable(
|
|
||||||
new ModAddonModule(),
|
|
||||||
new ModListenerModule()
|
|
||||||
);
|
|
||||||
started = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
long endCtm = System.currentTimeMillis();
|
|
||||||
injector.getInstance(FloodgateLogger.class)
|
|
||||||
.translatedInfo("floodgate.core.finish", endCtm - ctm);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void disable() {
|
|
||||||
platform.disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void enable(Module... module) {
|
|
||||||
platform.enable(module);
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable abstract Path resourcePath(String file);
|
|
||||||
|
|
||||||
public abstract boolean isClient();
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package org.geysermc.floodgate.mod;
|
|
||||||
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
|
|
||||||
public final class MinecraftServerHolder {
|
|
||||||
// Static because commands *need* to be initialized before the server is available
|
|
||||||
// Otherwise it would be a class variable
|
|
||||||
private static MinecraftServer INSTANCE;
|
|
||||||
|
|
||||||
public static MinecraftServer get() {
|
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void set(MinecraftServer instance) {
|
|
||||||
INSTANCE = instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private MinecraftServerHolder() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package org.geysermc.floodgate.mod;
|
||||||
|
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
import org.geysermc.floodgate.core.FloodgatePlatform;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import org.geysermc.floodgate.isolation.library.LibraryManager;
|
||||||
|
|
||||||
|
public abstract class ModPlatform extends FloodgatePlatform {
|
||||||
|
|
||||||
|
protected ModPlatform(LibraryManager manager) {
|
||||||
|
super(manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
public @Nullable abstract Path resourcePath(String file);
|
||||||
|
|
||||||
|
public abstract boolean isClient();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isProxy() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,41 +1,50 @@
|
|||||||
package org.geysermc.floodgate.mod.data;
|
package org.geysermc.floodgate.mod.data;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
import com.google.inject.name.Named;
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.util.AttributeKey;
|
import io.netty.util.AttributeKey;
|
||||||
import org.geysermc.floodgate.api.inject.InjectorAddon;
|
import jakarta.inject.Inject;
|
||||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
import jakarta.inject.Named;
|
||||||
|
import jakarta.inject.Singleton;
|
||||||
|
import org.geysermc.api.connection.Connection;
|
||||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||||
import org.geysermc.floodgate.core.api.SimpleFloodgateApi;
|
import org.geysermc.floodgate.core.api.SimpleFloodgateApi;
|
||||||
|
import org.geysermc.floodgate.core.api.inject.InjectorAddon;
|
||||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||||
import org.geysermc.floodgate.core.player.FloodgateHandshakeHandler;
|
import org.geysermc.floodgate.core.connection.DataSeeker;
|
||||||
|
import org.geysermc.floodgate.core.connection.FloodgateDataHandler;
|
||||||
|
import org.geysermc.floodgate.core.logger.FloodgateLogger;
|
||||||
import org.geysermc.floodgate.core.util.Utils;
|
import org.geysermc.floodgate.core.util.Utils;
|
||||||
|
|
||||||
public final class ModDataAddon implements InjectorAddon {
|
@Singleton
|
||||||
@Inject private FloodgateHandshakeHandler handshakeHandler;
|
public final class ModDataAddon implements InjectorAddon<Channel> {
|
||||||
@Inject private FloodgateConfig config;
|
|
||||||
@Inject private SimpleFloodgateApi api;
|
@Inject
|
||||||
@Inject private FloodgateLogger logger;
|
DataSeeker dataSeeker;
|
||||||
|
@Inject
|
||||||
|
FloodgateDataHandler handshakeHandler;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
FloodgateConfig config;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
FloodgateLogger logger;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named("packetHandler")
|
@Named("packetHandler")
|
||||||
private String packetHandlerName;
|
private String packetHandlerName;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Named("connectionAttribute")
|
||||||
|
AttributeKey<Connection> connectionAttribute;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named("kickMessageAttribute")
|
@Named("kickMessageAttribute")
|
||||||
private AttributeKey<String> kickMessageAttribute;
|
private AttributeKey<String> kickMessageAttribute;
|
||||||
|
|
||||||
@Inject
|
|
||||||
@Named("playerAttribute")
|
|
||||||
private AttributeKey<FloodgatePlayer> playerAttribute;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInject(Channel channel, boolean toServer) {
|
public void onInject(Channel channel, boolean toServer) {
|
||||||
channel.pipeline().addBefore(
|
var dataHandler = new ModDataHandler(handshakeHandler, config, kickMessageAttribute, logger);
|
||||||
packetHandlerName, "floodgate_data_handler",
|
channel.pipeline().addBefore(packetHandlerName, "floodgate_data_handler", dataHandler);
|
||||||
new ModDataHandler(handshakeHandler, config, kickMessageAttribute, logger)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import net.minecraft.server.network.ServerLoginPacketListenerImpl;
|
|||||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||||
import org.geysermc.floodgate.core.addon.data.CommonDataHandler;
|
import org.geysermc.floodgate.core.addon.data.CommonDataHandler;
|
||||||
|
import org.geysermc.floodgate.core.addon.data.CommonNettyDataHandler;
|
||||||
import org.geysermc.floodgate.core.addon.data.PacketBlocker;
|
import org.geysermc.floodgate.core.addon.data.PacketBlocker;
|
||||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||||
import org.geysermc.floodgate.core.player.FloodgateHandshakeHandler;
|
import org.geysermc.floodgate.core.player.FloodgateHandshakeHandler;
|
||||||
@@ -26,7 +27,7 @@ import org.slf4j.Logger;
|
|||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
public final class ModDataHandler extends CommonDataHandler {
|
public final class ModDataHandler extends CommonNettyDataHandler {
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
|
||||||
private final FloodgateLogger logger;
|
private final FloodgateLogger logger;
|
||||||
|
|||||||
@@ -10,40 +10,41 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Mixins into Floodgate's {@link Utils} class to modify how resources are loaded from the jar.
|
// * Mixins into Floodgate's {@link Utils} class to modify how resources are loaded from the jar.
|
||||||
* This must be done due to mod platforms sharing a classloader across mods - this leads to Floodgate
|
// * This must be done due to mod platforms sharing a classloader across mods - this leads to Floodgate
|
||||||
* loading Geyser's language files, as they're not prefixed to avoid conflicts.
|
// * loading Geyser's language files, as they're not prefixed to avoid conflicts.
|
||||||
* To resolve this, this mixin replaces those calls with the platform-appropriate methods to load files.
|
// * To resolve this, this mixin replaces those calls with the platform-appropriate methods to load files.
|
||||||
*/
|
// */
|
||||||
@Mixin(value = Utils.class, remap = false)
|
// TODO
|
||||||
public class FloodgateUtilMixin {
|
//@Mixin(value = Utils.class, remap = false)
|
||||||
|
//public class FloodgateUtilMixin {
|
||||||
@Redirect(method = "readProperties",
|
//
|
||||||
at = @At(value = "INVOKE", target = "Ljava/lang/ClassLoader;getResourceAsStream(Ljava/lang/String;)Ljava/io/InputStream;"))
|
// @Redirect(method = "readProperties",
|
||||||
private static InputStream floodgate$redirectInputStream(ClassLoader instance, String string) {
|
// at = @At(value = "INVOKE", target = "Ljava/lang/ClassLoader;getResourceAsStream(Ljava/lang/String;)Ljava/io/InputStream;"))
|
||||||
Path path = FloodgateMod.INSTANCE.resourcePath(string);
|
// private static InputStream floodgate$redirectInputStream(ClassLoader instance, String string) {
|
||||||
try {
|
// Path path = FloodgateMod.INSTANCE.resourcePath(string);
|
||||||
return path == null ? null : Files.newInputStream(path);
|
// try {
|
||||||
} catch (IOException e) {
|
// return path == null ? null : Files.newInputStream(path);
|
||||||
throw new IllegalStateException(e);
|
// } catch (IOException e) {
|
||||||
}
|
// throw new IllegalStateException(e);
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
@Redirect(method = "getGeneratedClassesForAnnotation(Ljava/lang/String;)Ljava/util/Set;",
|
//
|
||||||
at = @At(value = "INVOKE", target = "Ljava/lang/ClassLoader;getResourceAsStream(Ljava/lang/String;)Ljava/io/InputStream;"))
|
// @Redirect(method = "getGeneratedClassesForAnnotation(Ljava/lang/String;)Ljava/util/Set;",
|
||||||
private static InputStream floodgate$redirectInputStreamAnnotation(ClassLoader instance, String string) {
|
// at = @At(value = "INVOKE", target = "Ljava/lang/ClassLoader;getResourceAsStream(Ljava/lang/String;)Ljava/io/InputStream;"))
|
||||||
Path path = FloodgateMod.INSTANCE.resourcePath(string);
|
// private static InputStream floodgate$redirectInputStreamAnnotation(ClassLoader instance, String string) {
|
||||||
|
// Path path = FloodgateMod.INSTANCE.resourcePath(string);
|
||||||
if (path == null) {
|
//
|
||||||
throw new IllegalStateException("Unable to find classes marked by annotation class! " + string);
|
// if (path == null) {
|
||||||
}
|
// throw new IllegalStateException("Unable to find classes marked by annotation class! " + string);
|
||||||
|
// }
|
||||||
try {
|
//
|
||||||
return Files.newInputStream(path);
|
// try {
|
||||||
} catch (IOException e) {
|
// return Files.newInputStream(path);
|
||||||
throw new RuntimeException(e);
|
// } catch (IOException e) {
|
||||||
}
|
// throw new RuntimeException(e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//}
|
||||||
|
|||||||
@@ -12,14 +12,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Mixin(value = GeyserModInjector.class, remap = false)
|
// TODO
|
||||||
public class GeyserModInjectorMixin {
|
//@Mixin(value = GeyserModInjector.class, remap = false)
|
||||||
|
//public class GeyserModInjectorMixin {
|
||||||
@Shadow
|
//
|
||||||
private List<ChannelFuture> allServerChannels;
|
// @Shadow
|
||||||
|
// private List<ChannelFuture> allServerChannels;
|
||||||
@Inject(method = "initializeLocalChannel0", at = @At(value = "INVOKE_ASSIGN", target = "Ljava/util/List;add(Ljava/lang/Object;)Z"))
|
//
|
||||||
public void floodgate$onChannelAdd(GeyserBootstrap bootstrap, CallbackInfo ci) {
|
// @Inject(method = "initializeLocalChannel0", at = @At(value = "INVOKE_ASSIGN", target = "Ljava/util/List;add(Ljava/lang/Object;)Z"))
|
||||||
ModInjector.INSTANCE.injectClient(this.allServerChannels.get(this.allServerChannels.size() - 1));
|
// public void floodgate$onChannelAdd(GeyserBootstrap bootstrap, CallbackInfo ci) {
|
||||||
}
|
// ModInjector.INSTANCE.injectClient(this.allServerChannels.get(this.allServerChannels.size() - 1));
|
||||||
}
|
// }
|
||||||
|
//}
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
package org.geysermc.floodgate.mod.util;
|
|
||||||
|
|
||||||
import org.geysermc.configutils.file.template.TemplateReader;
|
|
||||||
import org.geysermc.floodgate.mod.FloodgateMod;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
public class ModTemplateReader implements TemplateReader {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BufferedReader read(String configName) {
|
|
||||||
Path path = FloodgateMod.INSTANCE.resourcePath(configName);
|
|
||||||
if (path != null) {
|
|
||||||
try {
|
|
||||||
return Files.newBufferedReader(path);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -55,7 +55,7 @@ tasks {
|
|||||||
archiveBaseName.set("floodgate-neoforge")
|
archiveBaseName.set("floodgate-neoforge")
|
||||||
}
|
}
|
||||||
|
|
||||||
modrinth {
|
// modrinth {
|
||||||
loaders.add("neoforge")
|
// loaders.add("neoforge")
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
@@ -1 +1 @@
|
|||||||
loom.platform=neoforge
|
loom.platform=neoforge
|
||||||
|
|||||||
61
neoforge/isolated/build.gradle.kts
Normal file
61
neoforge/isolated/build.gradle.kts
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
architectury {
|
||||||
|
platformSetupLoomIde()
|
||||||
|
neoForge()
|
||||||
|
}
|
||||||
|
|
||||||
|
provided("com.google.guava", "failureaccess")
|
||||||
|
|
||||||
|
// Used to extend runtime/compile classpaths
|
||||||
|
val common: Configuration by configurations.creating
|
||||||
|
// Needed to read mixin config in the runServer task, and for the architectury transformer
|
||||||
|
// (e.g. the @ExpectPlatform annotation)
|
||||||
|
val developmentNeoForge: Configuration = configurations.getByName("developmentNeoForge")
|
||||||
|
// Our custom transitive include configuration
|
||||||
|
val includeTransitive: Configuration = configurations.getByName("includeTransitive")
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
compileClasspath.get().extendsFrom(configurations["common"])
|
||||||
|
runtimeClasspath.get().extendsFrom(configurations["common"])
|
||||||
|
developmentNeoForge.extendsFrom(configurations["common"])
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// See https://github.com/google/guava/issues/6618
|
||||||
|
modules {
|
||||||
|
module("com.google.guava:listenablefuture") {
|
||||||
|
replacedBy("com.google.guava:guava", "listenablefuture is part of guava")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
neoForge(libs.neoforge)
|
||||||
|
// "namedElements" configuration should be used to depend on different loom projects
|
||||||
|
common(project(":mod", configuration = "namedElements")) { isTransitive = false }
|
||||||
|
// Bundle transformed classes of the common module for production mod jar
|
||||||
|
shadow(project(path = ":mod", configuration = "transformProductionNeoForge")) { isTransitive = false }
|
||||||
|
|
||||||
|
includeTransitive(libs.floodgate.core)
|
||||||
|
|
||||||
|
implementation(libs.floodgate.core)
|
||||||
|
implementation(libs.guice)
|
||||||
|
|
||||||
|
modImplementation(libs.cloud.neoforge)
|
||||||
|
include(libs.cloud.neoforge)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
processResources {
|
||||||
|
from(project(":mod").file("src/main/resources/floodgate.accesswidener")) {
|
||||||
|
into("/assets/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
remapJar {
|
||||||
|
dependsOn(processResources)
|
||||||
|
atAccessWideners.add("floodgate.accesswidener")
|
||||||
|
archiveBaseName.set("floodgate-neoforge")
|
||||||
|
}
|
||||||
|
|
||||||
|
// modrinth {
|
||||||
|
// loaders.add("neoforge")
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -1,46 +1,6 @@
|
|||||||
@file:Suppress("UnstableApiUsage")
|
@file:Suppress("UnstableApiUsage")
|
||||||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
|
||||||
repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
|
|
||||||
// Geyser, Cumulus etc.
|
|
||||||
maven("https://repo.opencollab.dev/maven-releases") {
|
|
||||||
mavenContent { releasesOnly() }
|
|
||||||
}
|
|
||||||
maven("https://repo.opencollab.dev/maven-snapshots") {
|
|
||||||
mavenContent { snapshotsOnly() }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Paper, Velocity
|
|
||||||
// maven("https://repo.papermc.io/repository/maven-releases") {
|
|
||||||
// mavenContent { releasesOnly() }
|
|
||||||
// }
|
|
||||||
// maven("https://repo.papermc.io/repository/maven-snapshots") {
|
|
||||||
// mavenContent { snapshotsOnly() }
|
|
||||||
// }
|
|
||||||
maven("https://repo.papermc.io/repository/maven-public")
|
|
||||||
// Spigot
|
|
||||||
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots") {
|
|
||||||
mavenContent { snapshotsOnly() }
|
|
||||||
}
|
|
||||||
|
|
||||||
// BungeeCord
|
|
||||||
maven("https://oss.sonatype.org/content/repositories/snapshots") {
|
|
||||||
mavenContent { snapshotsOnly() }
|
|
||||||
}
|
|
||||||
|
|
||||||
maven("https://libraries.minecraft.net") {
|
|
||||||
name = "minecraft"
|
|
||||||
mavenContent { releasesOnly() }
|
|
||||||
}
|
|
||||||
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
@@ -74,7 +34,7 @@ arrayOf("common", "netty4").forEach {
|
|||||||
project(id).projectDir = file("core/$it")
|
project(id).projectDir = file("core/$it")
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayOf("bungee", "spigot", "velocity", "fabric", "neoforge").forEach { platform ->
|
arrayOf("bungee", "spigot", "velocity").forEach { platform ->
|
||||||
arrayOf("base", "isolated").forEach {
|
arrayOf("base", "isolated").forEach {
|
||||||
var id = ":$platform-$it"
|
var id = ":$platform-$it"
|
||||||
// isolated is the new default
|
// isolated is the new default
|
||||||
|
|||||||
Reference in New Issue
Block a user