Skip to content

Commit

Permalink
Update cloud to 2.0, update to Floodgate 2.2.3, support 1.20.5 (#115)
Browse files Browse the repository at this point in the history
* Update for floodgate 2.2.2-SNAPSHOT

* Fix spacing on //no-op comment

* Add jitpack repo and target floodgat-master

* update gradle, loom, shade + relocate old version of cloud

* exclude meta-inf too

* - Update to Floodgate 2.2.3
- Update bstats properly to fix shutdown bug
- Move to kts build/settings file
- Fix command permission issues
- Update to cloud 2.0

* prepare for 1.20.5

* 1.20.5.. i dislike this

* also register channels to send packets

* update cloud, use jitpack to pull in floodgate

* some minor stuff

* proper permissions check

* update dependencies, finally

* update modrinth version

---------

Co-authored-by: Konicai <71294714+Konicai@users.noreply.github.com>
  • Loading branch information
onebeastchris and Konicai committed Apr 28, 2024
1 parent 046311d commit f05ed8c
Show file tree
Hide file tree
Showing 22 changed files with 382 additions and 263 deletions.
166 changes: 0 additions & 166 deletions build.gradle

This file was deleted.

144 changes: 144 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import net.fabricmc.loom.task.RemapJarTask

plugins {
id("com.github.johnrengelman.shadow") version "8.1.1"
id("fabric-loom") version "1.6-SNAPSHOT"
id("java")
id("maven-publish")
id("com.modrinth.minotaur") version "2.+"
}

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

dependencies {
//to change the versions see the gradle.properties file
minecraft("com.mojang:minecraft:1.20.5")
mappings(loom.officialMojangMappings())
modImplementation("net.fabricmc:fabric-loader:0.15.10")

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation("net.fabricmc.fabric-api:fabric-api:0.97.6+1.20.5")

// Base Floodgate
implementation("org.geysermc.floodgate:core:2.2.3-SNAPSHOT")
shadow("org.geysermc.floodgate:core:2.2.3-SNAPSHOT") { isTransitive = false }
shadow("org.geysermc.floodgate:api:2.2.3-SNAPSHOT") { isTransitive = false }

// Requires relocation
shadow("org.bstats:bstats-base:3.0.2")

// Shadow & relocate these since the (indirectly) depend on quite old dependencies
shadow("com.google.inject:guice:6.0.0") { isTransitive = false }
shadow("org.geysermc.configutils:configutils:1.0-SNAPSHOT") {
exclude("org.checkerframework")
exclude("com.google.errorprone")
exclude("com.github.spotbugs")
exclude("com.nukkitx.fastutil")
}

include("aopalliance:aopalliance:1.0")
include("javax.inject:javax.inject:1")
include("jakarta.inject:jakarta.inject-api:2.0.1")
include("org.java-websocket:Java-WebSocket:1.5.2")

// Just like Geyser, include these
include("org.geysermc.geyser", "common", "2.2.3-SNAPSHOT")
include("org.geysermc.cumulus", "cumulus", "1.1.2")
include("org.geysermc.event", "events", "1.1-SNAPSHOT")
include("org.lanternpowered", "lmbda", "2.0.0") // used in events

// cloud
include("org.incendo:cloud-fabric:2.0.0-SNAPSHOT")
modImplementation("org.incendo:cloud-fabric:2.0.0-SNAPSHOT")

// Lombok
compileOnly("org.projectlombok:lombok:1.18.32")
annotationProcessor("org.projectlombok:lombok:1.18.32")
}

repositories {
//mavenLocal()
mavenCentral()
maven("https://maven.fabricmc.net/")
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/")
}

java {
withSourcesJar()
}

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

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")
}

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

remapJar {
dependsOn(shadowJar)
mustRunAfter(shadowJar)
inputFile.set(shadowJar.get().archiveFile)
addNestedDependencies = true // todo?
archiveFileName.set("floodgate-fabric.jar")
}

register("remapModrinthJar", RemapJarTask::class) {
dependsOn(shadowJar)
inputFile.set(remapJar.get().archiveFile)
addNestedDependencies = true
archiveVersion.set(project.version.toString() + "+build." + System.getenv("GITHUB_RUN_NUMBER"))
archiveClassifier.set("")
}
}

publishing {
publications {
register("publish", MavenPublication::class) {
from(project.components["java"])

// 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() }
}
}

repositories {
mavenLocal()
}
}

modrinth {
token.set(System.getenv("MODRINTH_TOKEN")) // Prevent GitHub Actions from caching empty Modrinth token
projectId.set("bWrNNfkb")
versionNumber.set(project.version as String + "-" + System.getenv("GITHUB_RUN_NUMBER"))
versionType.set("beta")
changelog.set("A changelog can be found at https://github.com/GeyserMC/Floodgate-Fabric/commits")

syncBodyFrom.set(rootProject.file("README.md").readText())

uploadFile.set(tasks.named("remapModrinthJar"))
gameVersions.addAll("1.20.5")

loaders.add("fabric")

dependencies {
required.project("fabric-api")
}
}
13 changes: 2 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.4
loader_version=0.15.2
# Mod Properties
mod_version=2.2.0-SNAPSHOT
maven_group=org.geysermc.floodgate
version=2.2.3-SNAPSHOT
group=org.geysermc.floodgate
archives_base_name=floodgate-fabric
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.91.2+1.20.4
# Our stuff
lombok_version=1.18.20
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-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 5 additions & 5 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
Expand Down
10 changes: 0 additions & 10 deletions settings.gradle

This file was deleted.

8 changes: 8 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pluginManagement {
repositories {
//mavenLocal()
mavenCentral()
gradlePluginPortal()
maven("https://maven.fabricmc.net/")
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/geysermc/floodgate/FabricMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void onInitialize() {
new FabricPlatformModule()
);

FabricPlatform platform = injector.getInstance(FabricPlatform.class);
FloodgatePlatform platform = injector.getInstance(FloodgatePlatform.class);

platform.enable(new FabricCommandModule());

Expand Down
Loading

0 comments on commit f05ed8c

Please sign in to comment.