Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Shanwer committed Jun 18, 2024
2 parents 03fe9cd + 77fa37f commit 7819e7e
Show file tree
Hide file tree
Showing 16 changed files with 88 additions and 34 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,12 @@ jobs:
bootstrap/viaproxy/build/libs/Geyser-ViaProxy.jar
changelog: ${{ steps.metadata.outputs.body }}

- name: Publish to Modrinth (Fabric)
- name: Publish to Modrinth
if: ${{ success() && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }}
env:
BUILD_NUMBER: ${{ steps.release-info.outputs.curentRelease }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
run: ./gradlew fabric:modrinth

- name: Publish to Modrinth (NeoForge)
if: ${{ success() && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }}
env:
BUILD_NUMBER: ${{ steps.release-info.outputs.curentRelease }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
run: ./gradlew neoforge:modrinth
run: ./gradlew modrinth

- name: Notify Discord
if: ${{ (success() || failure()) && github.repository == 'GeyserMC/Geyser' }}
Expand Down
5 changes: 5 additions & 0 deletions bootstrap/bungeecord/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
exclude(dependency("io.netty:netty-resolver-dns:.*"))
}
}

modrinth {
uploadFile.set(tasks.getByPath("shadowJar"))
loaders.add("bungeecord")
}
7 changes: 7 additions & 0 deletions bootstrap/mod/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ loom {
mixin.defaultRefmapName.set("geyser-refmap.json")
}

afterEvaluate {
// We don't need these
tasks.named("remapModrinthJar").configure {
enabled = false
}
}

dependencies {
api(projects.core)
compileOnly(libs.mixin)
Expand Down
1 change: 1 addition & 0 deletions bootstrap/mod/fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ tasks {

modrinth {
loaders.add("fabric")
uploadFile.set(tasks.getByPath("remapModrinthJar"))
dependencies {
required.project("fabric-api")
}
Expand Down
1 change: 1 addition & 0 deletions bootstrap/mod/neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ tasks {

modrinth {
loaders.add("neoforge")
uploadFile.set(tasks.getByPath("remapModrinthJar"))
}
5 changes: 5 additions & 0 deletions bootstrap/spigot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,8 @@ tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
exclude(dependency("com.mojang:.*"))
}
}

modrinth {
uploadFile.set(tasks.getByPath("shadowJar"))
loaders.addAll("spigot", "paper")
}
5 changes: 5 additions & 0 deletions bootstrap/velocity/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,9 @@ tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
exclude(dependency("net.kyori:adventure-text-serializer-legacy:.*"))
exclude(dependency("net.kyori:adventure-nbt:.*"))
}
}

modrinth {
uploadFile.set(tasks.getByPath("shadowJar"))
loaders.addAll("velocity")
}
3 changes: 3 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ repositories {
}

dependencies {
// 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)
Expand Down
6 changes: 6 additions & 0 deletions build-logic/src/main/kotlin/LibsAccessor.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType

val Project.libs: LibrariesForLibs
get() = rootProject.extensions.getByType()
27 changes: 6 additions & 21 deletions build-logic/src/main/kotlin/geyser.modded-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ plugins {
id("geyser.publish-conventions")
id("architectury-plugin")
id("dev.architectury.loom")
id("com.modrinth.minotaur")
}

// These are provided by Minecraft/modded platforms already, no need to include them
Expand Down Expand Up @@ -39,7 +38,7 @@ provided("io.netty", "netty-resolver-dns-native-macos")
provided("org.ow2.asm", "asm")

architectury {
minecraft = "1.20.5"
minecraft = libs.minecraft.get().version as String
}

loom {
Expand Down Expand Up @@ -83,7 +82,7 @@ tasks {
register("remapModrinthJar", RemapJarTask::class) {
dependsOn(shadowJar)
inputFile.set(shadowJar.get().archiveFile)
archiveVersion.set(project.version.toString() + "+build." + System.getenv("GITHUB_RUN_NUMBER"))
archiveVersion.set(project.version.toString() + "+build." + System.getenv("BUILD_NUMBER"))
archiveClassifier.set("")
}
}
Expand All @@ -93,24 +92,24 @@ afterEvaluate {

// These are shaded, no need to JiJ them
configurations["shadow"].dependencies.forEach {shadowed ->
println("Not including shadowed dependency: ${shadowed.group}:${shadowed.name}")
//println("Not including shadowed dependency: ${shadowed.group}:${shadowed.name}")
providedDependencies.add("${shadowed.group}:${shadowed.name}")
}

// Now: Include all transitive dependencies that aren't excluded
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}")
//println("Including dependency via JiJ: ${dep.id}")
dependencies.add("include", dep.moduleVersion.id.toString())
} else {
println("Not including ${dep.id} for ${project.name}!")
//println("Not including ${dep.id} for ${project.name}!")
}
}
}

dependencies {
minecraft("com.mojang:minecraft:1.21")
minecraft(libs.minecraft)
mappings(loom.officialMojangMappings())
}

Expand All @@ -121,18 +120,4 @@ repositories {
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven("https://maven.neoforged.net/releases")
}

modrinth {
token.set(System.getenv("MODRINTH_TOKEN")) // Even though this is the default value, apparently this prevents GitHub Actions caching the token?
projectId.set("wKkoqHrH")
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/Geyser/commits")

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

uploadFile.set(tasks.getByPath("remapModrinthJar"))
gameVersions.addAll("1.21")
failSilently.set(true)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
plugins {
id("com.modrinth.minotaur")
}

// Ensure that the readme is synched
tasks.modrinth.get().dependsOn(tasks.modrinthSyncBody)

modrinth {
token.set(System.getenv("MODRINTH_TOKEN") ?: "") // Even though this is the default value, apparently this prevents GitHub Actions caching the token?
projectId.set("geyser")
versionNumber.set(project.version as String + "-" + System.getenv("BUILD_NUMBER"))
versionType.set("beta")
changelog.set("A changelog can be found at https://github.com/GeyserMC/Geyser/commits")
gameVersions.add(libs.minecraft.get().version as String)
failSilently.set(true)

syncBodyFrom.set(rootProject.file("README.md").readText())
}
14 changes: 14 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ val moddedPlatforms = setOf(
projects.mod
).map { it.dependencyProject }

val modrinthPlatforms = setOf(
projects.bungeecord,
projects.fabric,
projects.neoforge,
projects.spigot,
projects.velocity
).map { it.dependencyProject }

subprojects {
apply {
plugin("java-library")
Expand All @@ -38,4 +46,10 @@ subprojects {
in moddedPlatforms -> plugins.apply("geyser.modded-conventions")
else -> plugins.apply("geyser.base-conventions")
}

// Not combined with platform-conventions as that also contains
// platforms which we cant publish to modrinth
if (modrinthPlatforms.contains(this)) {
plugins.apply("geyser.modrinth-uploading-conventions")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ public boolean getValue(Property<Boolean> property, boolean def) {
return (Boolean) value;
}

public <T extends Comparable<T>> T getValue(Property<T> property, T def) {
var value = get(property);
if (value == null) {
return def;
}
//noinspection unchecked
return (T) value;
}

@Nullable
private Comparable<?> get(Property<?> property) {
Property<?>[] keys = this.block.propertyKeys();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.cloudburstmc.nbt.NbtMapBuilder;
import org.geysermc.geyser.level.block.property.Properties;
import org.geysermc.geyser.level.block.type.BlockState;
import org.geysermc.geyser.level.physics.Direction;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.inventory.ShulkerInventoryTranslator;
import org.geysermc.mcprotocollib.protocol.data.game.level.block.BlockEntityType;
Expand All @@ -42,6 +43,6 @@ public class ShulkerBoxBlockEntityTranslator extends BlockEntityTranslator imple
*/
@Override
public void translateTag(GeyserSession session, NbtMapBuilder bedrockNbt, @Nullable NbtMap javaNbt, BlockState blockState) {
bedrockNbt.putByte("facing", (byte) blockState.getValue(Properties.FACING).ordinal());
bedrockNbt.putByte("facing", (byte) blockState.getValue(Properties.FACING, Direction.UP).ordinal());
}
}
2 changes: 1 addition & 1 deletion core/src/main/resources/mappings
Submodule mappings updated 1 files
+2 −2 effects.json
5 changes: 3 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ commodore = "2.2"
bungeecord = "a7c6ede"
velocity = "3.3.0-SNAPSHOT"
viaproxy = "3.2.1"
fabric-minecraft = "1.21"
fabric-loader = "0.15.11"
fabric-api = "0.100.1+1.21"
fabric-permissions = "0.2-SNAPSHOT"
neoforge-minecraft = "21.0.0-beta"
mixin = "0.8.5"
minecraft = "1.21"

# plugin versions
indra = "3.1.3"
Expand Down Expand Up @@ -90,8 +90,9 @@ paper-mojangapi = { group = "io.papermc.paper", name = "paper-mojangapi", versio

mixin = { group = "org.spongepowered", name = "mixin", version.ref = "mixin" }

minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" }

# Check these on https://modmuss50.me/fabric.html
fabric-minecraft = { group = "com.mojang", name = "minecraft", version.ref = "fabric-minecraft" }
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 = { group = "me.lucko", name = "fabric-permissions-api", version.ref = "fabric-permissions" }
Expand Down

0 comments on commit 7819e7e

Please sign in to comment.