3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

Fix crash on some devices when logging into a different dimension

Dieser Commit ist enthalten in:
AJ Ferguson 2020-04-11 10:33:06 -08:00
Ursprung d8ff735626
Commit 95bcc04177
3 geänderte Dateien mit 13 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -149,15 +149,6 @@ public class GeyserSession implements CommandSender {
public void connect(RemoteServer remoteServer) { public void connect(RemoteServer remoteServer) {
startGame(); startGame();
this.remoteServer = remoteServer; 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); ChunkUtils.sendEmptyChunks(this, playerEntity.getPosition().toInt(), 0, false);
@ -174,6 +165,18 @@ public class GeyserSession implements CommandSender {
upstream.sendPacket(playStatusPacket); 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) { public void authenticate(String username) {
authenticate(username, ""); authenticate(username, "");
} }

Datei anzeigen

@ -40,6 +40,7 @@ public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslat
if (session.getPlayerEntity().getGeyserId() == packet.getRuntimeEntityId()) { if (session.getPlayerEntity().getGeyserId() == packet.getRuntimeEntityId()) {
if (!session.getUpstream().isInitialized()) { if (!session.getUpstream().isInitialized()) {
session.getUpstream().setInitialized(true); session.getUpstream().setInitialized(true);
session.login();
for (PlayerEntity entity : session.getEntityCache().getEntitiesByType(PlayerEntity.class)) { for (PlayerEntity entity : session.getEntityCache().getEntitiesByType(PlayerEntity.class)) {
if (!entity.isValid()) { if (!entity.isValid()) {

Datei anzeigen

@ -29,7 +29,6 @@ import org.geysermc.connector.entity.PlayerEntity;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.Translator;
import org.geysermc.connector.utils.ChunkUtils;
import org.geysermc.connector.utils.DimensionUtils; import org.geysermc.connector.utils.DimensionUtils;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
@ -69,7 +68,6 @@ public class JavaJoinGameTranslator extends PacketTranslator<ServerJoinGamePacke
session.setRenderDistance(packet.getViewDistance()); session.setRenderDistance(packet.getViewDistance());
if (DimensionUtils.javaToBedrock(packet.getDimension()) != entity.getDimension()) { if (DimensionUtils.javaToBedrock(packet.getDimension()) != entity.getDimension()) {
ChunkUtils.sendEmptyChunks(session, entity.getPosition().toInt(), 3, true);
DimensionUtils.switchDimension(session, packet.getDimension()); DimensionUtils.switchDimension(session, packet.getDimension());
} }
} }