mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-12-19 14:59:27 +00:00
Fix: Build issues for Geyser-Fabric and Geyser-NeoForge
resolves: https://github.com/GeyserMC/Geyser/issues/5718 how did this work until now? we'll never know
This commit is contained in:
@@ -15,26 +15,24 @@ dependencies {
|
|||||||
modApi(libs.fabric.api)
|
modApi(libs.fabric.api)
|
||||||
|
|
||||||
api(project(":mod", configuration = "namedElements"))
|
api(project(":mod", configuration = "namedElements"))
|
||||||
shadow(project(path = ":mod", configuration = "transformProductionFabric")) {
|
shadowBundle(project(path = ":mod", configuration = "transformProductionFabric"))
|
||||||
isTransitive = false
|
shadowBundle(projects.core)
|
||||||
}
|
|
||||||
shadow(projects.core) { isTransitive = false }
|
|
||||||
includeTransitive(projects.core)
|
includeTransitive(projects.core)
|
||||||
|
|
||||||
// These are NOT transitively included, and instead shadowed + relocated.
|
// These are NOT transitively included, and instead shadowed + relocated.
|
||||||
// Avoids fabric complaining about non-SemVer versioning
|
// Avoids fabric complaining about non-SemVer versioning
|
||||||
shadow(libs.protocol.connection) { isTransitive = false }
|
shadowBundle(libs.protocol.connection)
|
||||||
shadow(libs.protocol.common) { isTransitive = false }
|
shadowBundle(libs.protocol.common)
|
||||||
shadow(libs.protocol.codec) { isTransitive = false }
|
shadowBundle(libs.protocol.codec)
|
||||||
shadow(libs.raknet) { isTransitive = false }
|
shadowBundle(libs.raknet)
|
||||||
shadow(libs.mcprotocollib) { isTransitive = false }
|
shadowBundle(libs.mcprotocollib)
|
||||||
|
|
||||||
// Since we also relocate cloudburst protocol: shade erosion common
|
// Since we also relocate cloudburst protocol: shade erosion common
|
||||||
shadow(libs.erosion.common) { isTransitive = false }
|
shadowBundle(libs.erosion.common)
|
||||||
|
|
||||||
// Let's shade in our own api/common module
|
// Let's shade in our own api/common module
|
||||||
shadow(projects.api) { isTransitive = false }
|
shadowBundle(projects.api)
|
||||||
shadow(projects.common) { isTransitive = false }
|
shadowBundle(projects.common)
|
||||||
|
|
||||||
modImplementation(libs.cloud.fabric)
|
modImplementation(libs.cloud.fabric)
|
||||||
include(libs.cloud.fabric)
|
include(libs.cloud.fabric)
|
||||||
|
|||||||
@@ -29,19 +29,17 @@ dependencies {
|
|||||||
neoForge(libs.neoforge.minecraft)
|
neoForge(libs.neoforge.minecraft)
|
||||||
|
|
||||||
api(project(":mod", configuration = "namedElements"))
|
api(project(":mod", configuration = "namedElements"))
|
||||||
shadow(project(path = ":mod", configuration = "transformProductionNeoForge")) {
|
shadowBundle(project(path = ":mod", configuration = "transformProductionNeoForge"))
|
||||||
isTransitive = false
|
shadowBundle(projects.core)
|
||||||
}
|
|
||||||
shadow(projects.core) { isTransitive = false }
|
|
||||||
|
|
||||||
// Minecraft (1.21.2+) includes jackson. But an old version!
|
// Minecraft (1.21.2+) includes jackson. But an old version!
|
||||||
shadow(libs.jackson.core) { isTransitive = false }
|
shadowBundle(libs.jackson.core)
|
||||||
shadow(libs.jackson.databind) { isTransitive = false }
|
shadowBundle(libs.jackson.databind)
|
||||||
shadow(libs.jackson.dataformat.yaml) { isTransitive = false }
|
shadowBundle(libs.jackson.dataformat.yaml)
|
||||||
shadow(libs.jackson.annotations) { isTransitive = false }
|
shadowBundle(libs.jackson.annotations)
|
||||||
|
|
||||||
// Let's shade in our own api
|
// Let's shade in our own api
|
||||||
shadow(projects.api) { isTransitive = false }
|
shadowBundle(projects.api)
|
||||||
|
|
||||||
// cannot be shaded, since neoforge will complain if floodgate-neoforge tries to provide this
|
// cannot be shaded, since neoforge will complain if floodgate-neoforge tries to provide this
|
||||||
include(projects.common)
|
include(projects.common)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
|||||||
exclude(dependency("io.netty:.*"))
|
exclude(dependency("io.netty:.*"))
|
||||||
exclude(dependency("org.slf4j:.*"))
|
exclude(dependency("org.slf4j:.*"))
|
||||||
exclude(dependency("org.ow2.asm:.*"))
|
exclude(dependency("org.ow2.asm:.*"))
|
||||||
// Exclude all Kyori dependencies except the legacy NBT serializer
|
// Exclude all Kyori dependencies
|
||||||
exclude(dependency("net.kyori:.*:.*"))
|
exclude(dependency("net.kyori:.*:.*"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,11 @@ indra {
|
|||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
create("includeTransitive").isTransitive = true
|
create("includeTransitive").isTransitive = true
|
||||||
|
create("shadowBundle") {
|
||||||
|
isCanBeResolved = true
|
||||||
|
isCanBeConsumed = false
|
||||||
|
isTransitive = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
@@ -68,7 +73,7 @@ tasks {
|
|||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
// Mirrors the example fabric project, otherwise tons of dependencies are shaded that shouldn't be
|
// Mirrors the example fabric project, otherwise tons of dependencies are shaded that shouldn't be
|
||||||
configurations = listOf(project.configurations.shadow.get())
|
configurations = listOf(project.configurations.getByName("shadowBundle"))
|
||||||
// The remapped shadowJar is the final desired mod jar
|
// The remapped shadowJar is the final desired mod jar
|
||||||
archiveVersion.set(project.version.toString())
|
archiveVersion.set(project.version.toString())
|
||||||
archiveClassifier.set("shaded")
|
archiveClassifier.set("shaded")
|
||||||
@@ -91,17 +96,15 @@ tasks {
|
|||||||
|
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
val providedDependencies = providedDependencies[project.name]!!
|
val providedDependencies = providedDependencies[project.name]!!
|
||||||
|
val shadedDependencies = configurations.getByName("shadowBundle")
|
||||||
// These are shaded, no need to JiJ them
|
.dependencies.stream().map { dependency -> "${dependency.group}:${dependency.name}" }.toList()
|
||||||
configurations["shadow"].dependencies.forEach {shadowed ->
|
|
||||||
//println("Not including shadowed dependency: ${shadowed.group}:${shadowed.name}")
|
|
||||||
providedDependencies.add("${shadowed.group}:${shadowed.name}")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now: Include all transitive dependencies that aren't excluded
|
// Now: Include all transitive dependencies that aren't excluded
|
||||||
configurations["includeTransitive"].resolvedConfiguration.resolvedArtifacts.forEach { dep ->
|
configurations["includeTransitive"].resolvedConfiguration.resolvedArtifacts.forEach { dep ->
|
||||||
if (!providedDependencies.contains("${dep.moduleVersion.id.group}:${dep.moduleVersion.id.name}")
|
val name = "${dep.moduleVersion.id.group}:${dep.moduleVersion.id.name}"
|
||||||
and !providedDependencies.contains("${dep.moduleVersion.id.group}:.*")) {
|
if (!shadedDependencies.contains(name) and !providedDependencies.contains(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())
|
dependencies.add("include", dep.moduleVersion.id.toString())
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ package org.geysermc.geyser.network;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.DefaultEventLoopGroup;
|
import io.netty.channel.DefaultEventLoopGroup;
|
||||||
import io.netty.util.concurrent.DefaultThreadFactory;
|
import io.netty.util.concurrent.DefaultThreadFactory;
|
||||||
|
import lombok.Getter;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.cloudburstmc.protocol.bedrock.BedrockPeer;
|
import org.cloudburstmc.protocol.bedrock.BedrockPeer;
|
||||||
import org.cloudburstmc.protocol.bedrock.BedrockServerSession;
|
import org.cloudburstmc.protocol.bedrock.BedrockServerSession;
|
||||||
@@ -41,16 +42,13 @@ import java.net.InetSocketAddress;
|
|||||||
public class GeyserServerInitializer extends BedrockServerInitializer {
|
public class GeyserServerInitializer extends BedrockServerInitializer {
|
||||||
private final GeyserImpl geyser;
|
private final GeyserImpl geyser;
|
||||||
// There is a constructor that doesn't require inputting threads, but older Netty versions don't have it
|
// There is a constructor that doesn't require inputting threads, but older Netty versions don't have it
|
||||||
|
@Getter
|
||||||
private final DefaultEventLoopGroup eventLoopGroup = new DefaultEventLoopGroup(0, new DefaultThreadFactory("Geyser player thread"));
|
private final DefaultEventLoopGroup eventLoopGroup = new DefaultEventLoopGroup(0, new DefaultThreadFactory("Geyser player thread"));
|
||||||
|
|
||||||
public GeyserServerInitializer(GeyserImpl geyser) {
|
public GeyserServerInitializer(GeyserImpl geyser) {
|
||||||
this.geyser = geyser;
|
this.geyser = geyser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultEventLoopGroup getEventLoopGroup() {
|
|
||||||
return eventLoopGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initSession(@NonNull BedrockServerSession bedrockServerSession) {
|
public void initSession(@NonNull BedrockServerSession bedrockServerSession) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user