Possibly fix #3421

This commit is contained in:
Camotoy 2022-11-29 23:59:01 -05:00
parent 5fd041db4e
commit c6e417a6af
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
2 changed files with 13 additions and 14 deletions

View file

@ -28,8 +28,6 @@ package org.geysermc.geyser.network;
import com.github.steveice10.mc.protocol.codec.MinecraftCodec; import com.github.steveice10.mc.protocol.codec.MinecraftCodec;
import com.github.steveice10.mc.protocol.codec.PacketCodec; import com.github.steveice10.mc.protocol.codec.PacketCodec;
import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
import com.nukkitx.protocol.bedrock.v527.Bedrock_v527;
import com.nukkitx.protocol.bedrock.v534.Bedrock_v534;
import com.nukkitx.protocol.bedrock.v544.Bedrock_v544; import com.nukkitx.protocol.bedrock.v544.Bedrock_v544;
import com.nukkitx.protocol.bedrock.v545.Bedrock_v545; import com.nukkitx.protocol.bedrock.v545.Bedrock_v545;
import com.nukkitx.protocol.bedrock.v554.Bedrock_v554; import com.nukkitx.protocol.bedrock.v554.Bedrock_v554;

View file

@ -123,6 +123,19 @@ public class DimensionUtils {
stopSoundPacket.setSoundName(""); stopSoundPacket.setSoundName("");
session.sendUpstreamPacket(stopSoundPacket); session.sendUpstreamPacket(stopSoundPacket);
// Kind of silly but Bedrock 1.19.50 requires an acknowledgement after the
// initial chunks are sent, prior to the client acknowledgement
if (GameProtocol.supports1_19_50(session)) {
// Note: send this before chunks are sent. Fixed https://github.com/GeyserMC/Geyser/issues/3421
PlayerActionPacket ackPacket = new PlayerActionPacket();
ackPacket.setRuntimeEntityId(player.getGeyserId());
ackPacket.setAction(PlayerActionType.DIMENSION_CHANGE_SUCCESS);
ackPacket.setBlockPosition(Vector3i.ZERO);
ackPacket.setResultPosition(Vector3i.ZERO);
ackPacket.setFace(0);
session.sendUpstreamPacket(ackPacket);
}
// TODO - fix this hack of a fix by sending the final dimension switching logic after sections have been sent. // TODO - fix this hack of a fix by sending the final dimension switching logic after sections have been sent.
// The client wants sections sent to it before it can successfully respawn. // The client wants sections sent to it before it can successfully respawn.
ChunkUtils.sendEmptyChunks(session, player.getPosition().toInt(), 3, true); ChunkUtils.sendEmptyChunks(session, player.getPosition().toInt(), 3, true);
@ -137,18 +150,6 @@ public class DimensionUtils {
session.removeFog("minecraft:fog_hell"); session.removeFog("minecraft:fog_hell");
} }
} }
// Kind of silly but Bedrock 1.19.50 requires an acknowledgement after the
// initial chunks are sent, prior to the client acknowledgement
if (GameProtocol.supports1_19_50(session)) {
PlayerActionPacket ackPacket = new PlayerActionPacket();
ackPacket.setRuntimeEntityId(player.getGeyserId());
ackPacket.setAction(PlayerActionType.DIMENSION_CHANGE_SUCCESS);
ackPacket.setBlockPosition(Vector3i.ZERO);
ackPacket.setResultPosition(Vector3i.ZERO);
ackPacket.setFace(0);
session.sendUpstreamPacket(ackPacket);
}
} }
public static void setBedrockDimension(GeyserSession session, String javaDimension) { public static void setBedrockDimension(GeyserSession session, String javaDimension) {