Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge floodgate-fabric #353

Closed
wants to merge 11 commits into from
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
13 changes: 10 additions & 3 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up JDK 1.8
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '8'
java-version: '17'
cache: 'gradle'

- name: Build with Maven
- name: Build with Gradle
run: ./gradlew build

- name: Archive artifacts (Floodgate Bungee)
Expand All @@ -27,6 +27,13 @@ jobs:
name: Floodgate Bungee
path: bungee/build/libs/floodgate-bungee.jar

- name: Archive artifacts (Floodgate Fabric)
uses: actions/upload-artifact@v2
if: success()
with:
name: Floodgate Fabric
path: fabric/build/libs/floodgate-fabric.jar

- name: Archive artifacts (Floodgate Spigot)
uses: actions/upload-artifact@v2
if: success()
Expand Down
6 changes: 5 additions & 1 deletion build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ repositories {
dependencies {
implementation("net.kyori", "indra-common", "2.0.6")
implementation("org.jfrog.buildinfo", "build-info-extractor-gradle", "4.26.1")
implementation("gradle.plugin.com.github.johnrengelman", "shadow", "7.1.1")
implementation("gradle.plugin.com.github.johnrengelman", "shadow", "7.1.2")

// Within the gradle plugin classpath, there is a version conflict between loom and some other
// plugin for databind. This fixes it: minimum 1.13.2 is required by loom.
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.3")
}

tasks.withType<KotlinCompile> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies {

tasks {
processResources {
filesMatching(listOf("plugin.yml", "bungee.yml", "velocity-plugin.json")) {
filesMatching(listOf("plugin.yml", "bungee.yml", "velocity-plugin.json", "fabric.mod.json")) {
expand(
"id" to "floodgate",
"name" to "floodgate",
Expand Down
39 changes: 39 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,58 @@ plugins {
`java-library`
id("floodgate.build-logic")
id("io.freefair.lombok") version "6.3.0" apply false
id("fabric-loom") version "1.0-SNAPSHOT" apply false
}

allprojects {
group = "org.geysermc.floodgate"
version = "2.2.0-SNAPSHOT"
description = "Allows Bedrock players to join Java edition servers while keeping the server in online mode"

repositories {
// mavenLocal()

// Geyser, Cumulus etc.
maven("https://repo.opencollab.dev/maven-releases") {
mavenContent { releasesOnly() }
}
maven("https://repo.opencollab.dev/maven-snapshots") {
mavenContent { snapshotsOnly() }
}

// Spigot, BungeeCord
maven("https://oss.sonatype.org/content/repositories/snapshots") {
mavenContent { snapshotsOnly() }
}

// Paper, Velocity
maven("https://repo.papermc.io/repository/maven-public") {
content {
includeGroupByRegex(
"(io\\.papermc\\..*|com\\.destroystokyo\\..*|com\\.velocitypowered)"
)
}
}

maven("https://libraries.minecraft.net") {
name = "minecraft"
mavenContent { releasesOnly() }
}

mavenCentral()

maven("https://jitpack.io") {
content { includeGroupByRegex("com\\.github\\..*") }
}
}
}

val deployProjects = setOf(
projects.api,
// for future Floodgate integration + Fabric
projects.core,
projects.bungee,
projects.fabric,
projects.spigot,
projects.velocity
).map { it.dependencyProject }
Expand Down
100 changes: 100 additions & 0 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.task.RemapJarTask

val minecraftVersion = "1.19"
val loaderVersion = "0.14.6"
val fabricVersion = "0.55.3+1.19"

plugins {
id("fabric-loom") //version "1.0-SNAPSHOT"
id("java")
id("maven-publish")
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
sourceCompatibility = "17"
targetCompatibility = "17"
options.release.set(17)
}

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

// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
//val sourcesJar = tasks.create<Jar>("sourcesJar") {
//archiveClassifier.set("sources")
//from(sourceSets["main"].allSource)
//}

// This is easier than what is immediately above?
java {
withSourcesJar()
}

tasks {
shadowJar {
configurations = listOf(project.configurations.shadow.get())
}
}

val remappedShadowJar = tasks.create<RemapJarTask>("remappedShadowJar") {
dependsOn(tasks.shadowJar)
input.set(tasks.shadowJar.get().archiveFile) //fixme: deprecated
addNestedDependencies.set(true)
archiveFileName.set("floodgate-fabric.jar")
}

tasks.assemble {
dependsOn(remappedShadowJar)
}

artifacts {
archives(remappedShadowJar)
shadow(tasks.shadowJar)
}

repositories {
// specifically for adventure-platform-fabric:5.4.0-SNAPSHOT
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "sonatype-oss-snapshots1"
mavenContent { snapshotsOnly() }
}
}

// todo: perform exclusions using floodgate build logic
dependencies {
api(projects.core) {
exclude("com.google.guava", "guava")
exclude("com.google.code.gson", "gson")
exclude("org.slf4j", "slf4j-api")
exclude("net.kyori", "*") // Let Adventure-Platform provide its desired Adventure version
exclude("it.unimi.dsi.fastutil", "*")
}

minecraft("com.mojang", "minecraft", minecraftVersion)
mappings(loom.officialMojangMappings())

modImplementation("net.fabricmc", "fabric-loader", loaderVersion)
modImplementation("net.fabricmc.fabric-api", "fabric-api", fabricVersion)

include(modImplementation("cloud.commandframework", "cloud-fabric", "1.7.0-SNAPSHOT") {
because("Commands library implementation for Fabric")
})

include(modImplementation("net.kyori", "adventure-platform-fabric", "5.4.0-SNAPSHOT") {
because("Chat library implementation for Fabric that includes methods for communicating with the server")
// Thanks to zml for this fix
// The package modifies Brigadier which causes a LinkageError at runtime if included
exclude("ca.stellardrift", "colonel")
})
}
31 changes: 31 additions & 0 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"schemaVersion": 1,
"id": "floodgate",
"version": "${version}",
"name": "Floodgate-Fabric",
"description": "",
"authors": [
"GeyserMC"
],
"contact": {
"website": "https://geysermc.org",
"repo": "https://github.com/GeyserMC/Floodgate-Fabric"
},
"license": "MIT",
"icon": "assets/floodgate/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"org.geysermc.floodgate.FabricMod"
]
},
"accessWidener": "floodgate.accesswidener",
"mixins": [
"floodgate.mixins.json"
],
"depends": {
"fabricloader": ">=0.14.6",
"fabric": "*",
"minecraft": ">=1.19"
}
}
6 changes: 6 additions & 0 deletions fabric/src/main/resources/floodgate.accesswidener
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessWidener v1 named

# To change login state
accessible class net/minecraft/server/network/ServerLoginPacketListenerImpl$State
# For player skin refreshing
accessible class net/minecraft/server/level/ChunkMap$TrackedEntity
16 changes: 16 additions & 0 deletions fabric/src/main/resources/floodgate.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"required": true,
"minVersion": "0.8",
"package": "org.geysermc.floodgate.mixin",
"compatibilityLevel": "JAVA_16",
"mixins": [
"ChunkMapMixin",
"ClientIntentionPacketMixin",
"ConnectionMixin",
"ServerConnectionListenerMixin",
"ServerLoginPacketListenerImplMixin"
],
"injectors": {
"defaultRequire": 1
}
}
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
org.gradle.configureondemand=true
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.parallel=true

# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
52 changes: 2 additions & 50 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,57 +1,8 @@
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

dependencyResolutionManagement {
repositoriesMode.set(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") {
content {
includeGroupByRegex(
"(io\\.papermc\\..*|com\\.destroystokyo\\..*|com\\.velocitypowered)"
)
}
}
// 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()

maven("https://jitpack.io") {
content { includeGroupByRegex("com\\.github\\..*") }
}
}
}

pluginManagement {
repositories {
maven("https://maven.fabricmc.net") { name = "Fabric" }
gradlePluginPortal()
}
plugins {
Expand All @@ -66,6 +17,7 @@ include(":api")
include(":ap")
include(":core")
include(":bungee")
include(":fabric")
include(":spigot")
include(":velocity")
include(":sqlite")
Expand Down