From 1a04aa6ea6c44071a84f3e8022d7f35e9f91fb5a Mon Sep 17 00:00:00 2001 From: onebeastchris Date: Fri, 25 Oct 2024 02:15:51 +0800 Subject: [PATCH] Initial 1.21.3 changes for mod platforms --- .../platform/fabric/GeyserFabricBootstrap.java | 4 ++-- .../mod/fabric/src/main/resources/fabric.mod.json | 4 ++-- .../platform/neoforge/GeyserNeoForgeBootstrap.java | 8 +++++--- .../platform/mod/GeyserModCompressionDisabler.java | 4 ++-- .../platform/mod/GeyserModUpdateListener.java | 4 ++-- .../platform/mod/world/GeyserModWorldManager.java | 4 ++-- ...geyser.modrinth-uploading-conventions.gradle.kts | 2 +- core/build.gradle.kts | 4 ++++ core/src/main/resources/mappings | 2 +- gradle.properties | 5 ++++- gradle/libs.versions.toml | 13 +++++++------ 11 files changed, 32 insertions(+), 22 deletions(-) diff --git a/bootstrap/mod/fabric/src/main/java/org/geysermc/geyser/platform/fabric/GeyserFabricBootstrap.java b/bootstrap/mod/fabric/src/main/java/org/geysermc/geyser/platform/fabric/GeyserFabricBootstrap.java index 149246d59..96a60322b 100644 --- a/bootstrap/mod/fabric/src/main/java/org/geysermc/geyser/platform/fabric/GeyserFabricBootstrap.java +++ b/bootstrap/mod/fabric/src/main/java/org/geysermc/geyser/platform/fabric/GeyserFabricBootstrap.java @@ -32,7 +32,7 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.commands.CommandSourceStack; -import net.minecraft.world.entity.player.Player; +import net.minecraft.server.level.ServerPlayer; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandRegistry; import org.geysermc.geyser.command.CommandSourceConverter; @@ -80,7 +80,7 @@ public class GeyserFabricBootstrap extends GeyserModBootstrap implements ModInit var sourceConverter = CommandSourceConverter.layered( CommandSourceStack.class, id -> getServer().getPlayerList().getPlayer(id), - Player::createCommandSourceStack, + ServerPlayer::createCommandSourceStack, () -> getServer().createCommandSourceStack(), // NPE if method reference is used, since server is not available yet ModCommandSource::new ); diff --git a/bootstrap/mod/fabric/src/main/resources/fabric.mod.json b/bootstrap/mod/fabric/src/main/resources/fabric.mod.json index 262f9833a..a801eb207 100644 --- a/bootstrap/mod/fabric/src/main/resources/fabric.mod.json +++ b/bootstrap/mod/fabric/src/main/resources/fabric.mod.json @@ -23,8 +23,8 @@ "geyser.mixins.json" ], "depends": { - "fabricloader": ">=0.15.11", + "fabricloader": ">=0.16.7", "fabric": "*", - "minecraft": ">=1.21" + "minecraft": ">=1.21.2" } } diff --git a/bootstrap/mod/neoforge/src/main/java/org/geysermc/geyser/platform/neoforge/GeyserNeoForgeBootstrap.java b/bootstrap/mod/neoforge/src/main/java/org/geysermc/geyser/platform/neoforge/GeyserNeoForgeBootstrap.java index ad56eda39..aa731befc 100644 --- a/bootstrap/mod/neoforge/src/main/java/org/geysermc/geyser/platform/neoforge/GeyserNeoForgeBootstrap.java +++ b/bootstrap/mod/neoforge/src/main/java/org/geysermc/geyser/platform/neoforge/GeyserNeoForgeBootstrap.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.platform.neoforge; import net.minecraft.commands.CommandSourceStack; -import net.minecraft.world.entity.player.Player; +import net.minecraft.server.level.ServerPlayer; import net.neoforged.bus.api.EventPriority; import net.neoforged.fml.ModContainer; import net.neoforged.fml.common.Mod; @@ -72,7 +72,7 @@ public class GeyserNeoForgeBootstrap extends GeyserModBootstrap { var sourceConverter = CommandSourceConverter.layered( CommandSourceStack.class, id -> getServer().getPlayerList().getPlayer(id), - Player::createCommandSourceStack, + ServerPlayer::createCommandSourceStack, () -> getServer().createCommandSourceStack(), ModCommandSource::new ); @@ -104,7 +104,9 @@ public class GeyserNeoForgeBootstrap extends GeyserModBootstrap { } private void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent event) { - GeyserModUpdateListener.onPlayReady(event.getEntity()); + if (event.getEntity() instanceof ServerPlayer player) { + GeyserModUpdateListener.onPlayReady(player); + } } @Override diff --git a/bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/GeyserModCompressionDisabler.java b/bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/GeyserModCompressionDisabler.java index 631a21510..89ca53544 100644 --- a/bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/GeyserModCompressionDisabler.java +++ b/bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/GeyserModCompressionDisabler.java @@ -28,8 +28,8 @@ package org.geysermc.geyser.platform.mod; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelOutboundHandlerAdapter; import io.netty.channel.ChannelPromise; -import net.minecraft.network.protocol.login.ClientboundGameProfilePacket; import net.minecraft.network.protocol.login.ClientboundLoginCompressionPacket; +import net.minecraft.network.protocol.login.ClientboundLoginFinishedPacket; /** * Disables the compression packet (and the compression handlers from being added to the pipeline) for Geyser clients @@ -45,7 +45,7 @@ public class GeyserModCompressionDisabler extends ChannelOutboundHandlerAdapter Class msgClass = msg.getClass(); // Don't let any compression packet get through if (!ClientboundLoginCompressionPacket.class.isAssignableFrom(msgClass)) { - if (ClientboundGameProfilePacket.class.isAssignableFrom(msgClass)) { + if (ClientboundLoginFinishedPacket.class.isAssignableFrom(msgClass)) { // We're past the point that a compression packet can be sent, so we can safely yeet ourselves away ctx.channel().pipeline().remove(this); diff --git a/bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/GeyserModUpdateListener.java b/bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/GeyserModUpdateListener.java index 6a724155f..ec34766dc 100644 --- a/bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/GeyserModUpdateListener.java +++ b/bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/GeyserModUpdateListener.java @@ -25,13 +25,13 @@ package org.geysermc.geyser.platform.mod; -import net.minecraft.world.entity.player.Player; +import net.minecraft.server.level.ServerPlayer; import org.geysermc.geyser.Permissions; import org.geysermc.geyser.platform.mod.command.ModCommandSource; import org.geysermc.geyser.util.VersionCheckUtils; public final class GeyserModUpdateListener { - public static void onPlayReady(Player player) { + public static void onPlayReady(ServerPlayer player) { // Should be creating this in the supplier, but we need it for the permission check. // Not a big deal currently because ModCommandSource doesn't load locale, so don't need to try to wait for it. ModCommandSource source = new ModCommandSource(player.createCommandSourceStack()); diff --git a/bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/world/GeyserModWorldManager.java b/bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/world/GeyserModWorldManager.java index 89452eba3..ec41a0d79 100644 --- a/bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/world/GeyserModWorldManager.java +++ b/bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/world/GeyserModWorldManager.java @@ -84,7 +84,7 @@ public class GeyserModWorldManager extends GeyserWorldManager { } Level level = player.level(); - if (y < level.getMinBuildHeight()) { + if (y < level.getMinY()) { return 0; } @@ -93,7 +93,7 @@ public class GeyserModWorldManager extends GeyserWorldManager { return 0; } - int worldOffset = level.getMinBuildHeight() >> 4; + int worldOffset = level.getMinY() >> 4; int chunkOffset = (y >> 4) - worldOffset; if (chunkOffset < chunk.getSections().length) { LevelChunkSection section = chunk.getSections()[chunkOffset]; diff --git a/build-logic/src/main/kotlin/geyser.modrinth-uploading-conventions.gradle.kts b/build-logic/src/main/kotlin/geyser.modrinth-uploading-conventions.gradle.kts index d2e207fa4..3c0d102f7 100644 --- a/build-logic/src/main/kotlin/geyser.modrinth-uploading-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/geyser.modrinth-uploading-conventions.gradle.kts @@ -12,7 +12,7 @@ modrinth { versionNumber.set(projectVersion(project)) versionType.set("beta") changelog.set(System.getenv("CHANGELOG") ?: "") - gameVersions.addAll("1.21", libs.minecraft.get().version as String) + gameVersions.addAll("1.21.2", libs.minecraft.get().version as String) failSilently.set(true) syncBodyFrom.set(rootProject.file("README.md").readText()) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index b0ea5fdf6..ff1de4dc0 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -6,6 +6,10 @@ plugins { id("io.freefair.lombok") } +tasks.test { + enabled = false +} + dependencies { constraints { implementation(libs.raknet) // Ensure protocol does not override the RakNet version diff --git a/core/src/main/resources/mappings b/core/src/main/resources/mappings index 93f207e7e..4594e8f88 160000 --- a/core/src/main/resources/mappings +++ b/core/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit 93f207e7e9d73f58a7c8902f7deda9dcb0524c8e +Subproject commit 4594e8f88738d2e623d0854a8831b9033e60154a diff --git a/gradle.properties b/gradle.properties index 1ee0e12cc..09943725b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,10 @@ org.gradle.parallel=true org.gradle.caching=true org.gradle.vfs.watch=false +# TODO remove once architectury loom updates to 1.8 +loom.ignoreDependencyLoomVersionValidation=true + group=org.geysermc id=geyser -version=2.4.3-SNAPSHOT +version=2.5.0-SNAPSHOT description=Allows for players from Minecraft: Bedrock Edition to join Minecraft: Java Edition servers. diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e5582e5c1..a88862965 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -33,12 +33,12 @@ commodore = "2.2" bungeecord = "a7c6ede" velocity = "3.3.0-SNAPSHOT" viaproxy = "3.3.2-SNAPSHOT" -fabric-loader = "0.15.11" -fabric-api = "0.100.1+1.21" -neoforge-minecraft = "21.1.1" +fabric-loader = "0.16.7" +fabric-api = "0.106.1+1.21.3" +neoforge-minecraft = "21.3.0-beta" mixin = "0.8.5" mixinextras = "0.3.5" -minecraft = "1.21.1" +minecraft = "1.21.3" mockito = "5.+" # plugin versions @@ -105,7 +105,7 @@ mixinextras = { module = "io.github.llamalad7:mixinextras-common", version.ref = minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" } -# Check these on https://modmuss50.me/fabric.html +# Check these on https://fabricmc.net/develop/ 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" } @@ -120,7 +120,8 @@ guava = { group = "com.google.guava", name = "guava", version.ref = "guava" } gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" } minecraftauth = { group = "net.raphimc", name = "MinecraftAuth", version.ref = "minecraftauth" } -mcprotocollib = { group = "org.geysermc.mcprotocollib", name = "protocol", version.ref = "mcprotocollib" } +#mcprotocollib = { group = "org.geysermc.mcprotocollib", name = "protocol", version.ref = "mcprotocollib" } +mcprotocollib = { group = "com.github.geysermc", name = "mcprotocollib", version = "feature~1.21.2-SNAPSHOT"} raknet = { group = "org.cloudburstmc.netty", name = "netty-transport-raknet", version.ref = "raknet" } terminalconsoleappender = { group = "net.minecrell", name = "terminalconsoleappender", version.ref = "terminalconsoleappender" } velocity-api = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }