mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-17 20:28:59 +01:00
Fix crash on some devices when logging into a different dimension
This commit is contained in:
parent
d8ff735626
commit
95bcc04177
3 changed files with 13 additions and 11 deletions
|
@ -149,15 +149,6 @@ public class GeyserSession implements CommandSender {
|
|||
public void connect(RemoteServer remoteServer) {
|
||||
startGame();
|
||||
this.remoteServer = remoteServer;
|
||||
if (connector.getAuthType() != AuthType.ONLINE) {
|
||||
connector.getLogger().info(
|
||||
"Attempting to login using " + connector.getAuthType().name().toLowerCase() + " mode... " +
|
||||
(connector.getAuthType() == AuthType.OFFLINE ?
|
||||
"authentication is disabled." : "authentication will be encrypted"
|
||||
)
|
||||
);
|
||||
authenticate(authData.getName());
|
||||
}
|
||||
|
||||
ChunkUtils.sendEmptyChunks(this, playerEntity.getPosition().toInt(), 0, false);
|
||||
|
||||
|
@ -174,6 +165,18 @@ public class GeyserSession implements CommandSender {
|
|||
upstream.sendPacket(playStatusPacket);
|
||||
}
|
||||
|
||||
public void login() {
|
||||
if (connector.getAuthType() != AuthType.ONLINE) {
|
||||
connector.getLogger().info(
|
||||
"Attempting to login using " + connector.getAuthType().name().toLowerCase() + " mode... " +
|
||||
(connector.getAuthType() == AuthType.OFFLINE ?
|
||||
"authentication is disabled." : "authentication will be encrypted"
|
||||
)
|
||||
);
|
||||
authenticate(authData.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public void authenticate(String username) {
|
||||
authenticate(username, "");
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslat
|
|||
if (session.getPlayerEntity().getGeyserId() == packet.getRuntimeEntityId()) {
|
||||
if (!session.getUpstream().isInitialized()) {
|
||||
session.getUpstream().setInitialized(true);
|
||||
session.login();
|
||||
|
||||
for (PlayerEntity entity : session.getEntityCache().getEntitiesByType(PlayerEntity.class)) {
|
||||
if (!entity.isValid()) {
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.geysermc.connector.entity.PlayerEntity;
|
|||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
import org.geysermc.connector.network.translators.Translator;
|
||||
import org.geysermc.connector.utils.ChunkUtils;
|
||||
import org.geysermc.connector.utils.DimensionUtils;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
||||
|
@ -69,7 +68,6 @@ public class JavaJoinGameTranslator extends PacketTranslator<ServerJoinGamePacke
|
|||
session.setRenderDistance(packet.getViewDistance());
|
||||
|
||||
if (DimensionUtils.javaToBedrock(packet.getDimension()) != entity.getDimension()) {
|
||||
ChunkUtils.sendEmptyChunks(session, entity.getPosition().toInt(), 3, true);
|
||||
DimensionUtils.switchDimension(session, packet.getDimension());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue