Skip to content

Commit

Permalink
Initial 1.21.3 changes for mod platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
onebeastchris committed Oct 24, 2024
1 parent e17ad64 commit 1a04aa6
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
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;
Expand Down Expand Up @@ -80,7 +80,7 @@ public void onInitialize() {
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
);
Expand Down
4 changes: 2 additions & 2 deletions bootstrap/mod/fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"geyser.mixins.json"
],
"depends": {
"fabricloader": ">=0.15.11",
"fabricloader": ">=0.16.7",
"fabric": "*",
"minecraft": ">=1.21"
"minecraft": ">=1.21.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -72,7 +72,7 @@ public GeyserNeoForgeBootstrap(ModContainer container) {
var sourceConverter = CommandSourceConverter.layered(
CommandSourceStack.class,
id -> getServer().getPlayerList().getPlayer(id),
Player::createCommandSourceStack,
ServerPlayer::createCommandSourceStack,
() -> getServer().createCommandSourceStack(),
ModCommandSource::new
);
Expand Down Expand Up @@ -104,7 +104,9 @@ private void onClientStopping(GameShuttingDownEvent ignored) {
}

private void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent event) {
GeyserModUpdateListener.onPlayReady(event.getEntity());
if (event.getEntity() instanceof ServerPlayer player) {
GeyserModUpdateListener.onPlayReady(player);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
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
Expand All @@ -45,7 +45,7 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public int getBlockAt(GeyserSession session, int x, int y, int z) {
}

Level level = player.level();
if (y < level.getMinBuildHeight()) {
if (y < level.getMinY()) {
return 0;
}

Expand All @@ -93,7 +93,7 @@ public int getBlockAt(GeyserSession session, int x, int y, int z) {
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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
4 changes: 4 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/mappings
Submodule mappings updated 3 files
+ blocks.nbt
+ collisions.nbt
+1,790 −1,850 items.json
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
13 changes: 7 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" }

Expand All @@ -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" }
Expand Down

0 comments on commit 1a04aa6

Please sign in to comment.