3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-03 14:50:19 +01:00

Attempt to fix crashes on login

Dieser Commit ist enthalten in:
RednedEpic 2019-11-10 16:53:01 -06:00 committet von RednedEpic
Ursprung 21ddf8af1e
Commit 3ffaf5c0e5
7 geänderte Dateien mit 70 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -716,4 +716,49 @@ public class LoggingPacketHandler implements BedrockPacketHandler {
public boolean handle(VideoStreamConnectPacket packet) { public boolean handle(VideoStreamConnectPacket packet) {
return defaultHandler(packet); return defaultHandler(packet);
} }
@Override
public boolean handle(EmotePacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(TickSyncPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(AnvilDamagePacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(NetworkSettingsPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(PlayerAuthInputPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(SettingsCommandPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(EducationSettingsPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(CompletedUsingItemPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(MultiplayerSettingsPacket packet) {
return defaultHandler(packet);
}
} }

Datei anzeigen

@ -43,7 +43,10 @@ import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.protocol.bedrock.BedrockServerSession; import com.nukkitx.protocol.bedrock.BedrockServerSession;
import com.nukkitx.protocol.bedrock.data.GamePublishSetting; import com.nukkitx.protocol.bedrock.data.GamePublishSetting;
import com.nukkitx.protocol.bedrock.data.GameRule; import com.nukkitx.protocol.bedrock.data.GameRule;
import com.nukkitx.protocol.bedrock.packet.AvailableEntityIdentifiersPacket;
import com.nukkitx.protocol.bedrock.packet.BiomeDefinitionListPacket;
import com.nukkitx.protocol.bedrock.packet.LevelChunkPacket; import com.nukkitx.protocol.bedrock.packet.LevelChunkPacket;
import com.nukkitx.protocol.bedrock.packet.NetworkChunkPublisherUpdatePacket;
import com.nukkitx.protocol.bedrock.packet.PlayStatusPacket; import com.nukkitx.protocol.bedrock.packet.PlayStatusPacket;
import com.nukkitx.protocol.bedrock.packet.StartGamePacket; import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
import com.nukkitx.protocol.bedrock.packet.TextPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket;
@ -131,8 +134,13 @@ public class GeyserSession implements Player {
Vector3f pos = Vector3f.ZERO; Vector3f pos = Vector3f.ZERO;
int chunkX = pos.getFloorX() >> 4; int chunkX = pos.getFloorX() >> 4;
int chunkZ = pos.getFloorZ() >> 4; int chunkZ = pos.getFloorZ() >> 4;
for (int x = -3; x < 3; x++) { for (int x = -5; x < 5; x++) {
for (int z = -3; z < 3; z++) { for (int z = -5; z < 5; z++) {
NetworkChunkPublisherUpdatePacket chunkPublisherUpdatePacket = new NetworkChunkPublisherUpdatePacket();
chunkPublisherUpdatePacket.setPosition(pos.toInt());
chunkPublisherUpdatePacket.setRadius(renderDistance << 4);
upstream.sendPacket(chunkPublisherUpdatePacket);
LevelChunkPacket data = new LevelChunkPacket(); LevelChunkPacket data = new LevelChunkPacket();
data.setChunkX(chunkX + x); data.setChunkX(chunkX + x);
data.setChunkZ(chunkZ + z); data.setChunkZ(chunkZ + z);
@ -142,6 +150,9 @@ public class GeyserSession implements Player {
} }
} }
upstream.sendPacket(new BiomeDefinitionListPacket());
upstream.sendPacket(new AvailableEntityIdentifiersPacket());
PlayStatusPacket playStatusPacket = new PlayStatusPacket(); PlayStatusPacket playStatusPacket = new PlayStatusPacket();
playStatusPacket.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN); playStatusPacket.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN);
upstream.sendPacket(playStatusPacket); upstream.sendPacket(playStatusPacket);
@ -279,15 +290,15 @@ public class GeyserSession implements Player {
startGamePacket.setPlayerPosition(Vector3f.from(0, 69, 0)); startGamePacket.setPlayerPosition(Vector3f.from(0, 69, 0));
startGamePacket.setRotation(Vector2f.from(1, 1)); startGamePacket.setRotation(Vector2f.from(1, 1));
startGamePacket.setSeed(0); startGamePacket.setSeed(-1);
startGamePacket.setDimensionId(playerEntity.getDimension()); startGamePacket.setDimensionId(playerEntity.getDimension());
startGamePacket.setGeneratorId(1); startGamePacket.setGeneratorId(1);
startGamePacket.setLevelGamemode(0); startGamePacket.setLevelGamemode(0);
startGamePacket.setDifficulty(1); startGamePacket.setDifficulty(1);
startGamePacket.setDefaultSpawn(Vector3i.ZERO); startGamePacket.setDefaultSpawn(Vector3i.ZERO);
startGamePacket.setAcheivementsDisabled(true); startGamePacket.setAcheivementsDisabled(true);
startGamePacket.setTime(0); startGamePacket.setTime(-1);
startGamePacket.setEduLevel(false); startGamePacket.setEduEditionOffers(0);
startGamePacket.setEduFeaturesEnabled(false); startGamePacket.setEduFeaturesEnabled(false);
startGamePacket.setRainLevel(0); startGamePacket.setRainLevel(0);
startGamePacket.setLightningLevel(0); startGamePacket.setLightningLevel(0);
@ -313,12 +324,13 @@ public class GeyserSession implements Player {
startGamePacket.setLevelId("world"); startGamePacket.setLevelId("world");
startGamePacket.setWorldName("world"); startGamePacket.setWorldName("world");
startGamePacket.setPremiumWorldTemplateId("00000000-0000-0000-0000-000000000000"); startGamePacket.setPremiumWorldTemplateId("00000000-0000-0000-0000-000000000000");
startGamePacket.setCurrentTick(0); // startGamePacket.setCurrentTick(0);
startGamePacket.setEnchantmentSeed(0); startGamePacket.setEnchantmentSeed(0);
startGamePacket.setMultiplayerCorrelationId(""); startGamePacket.setMultiplayerCorrelationId("");
startGamePacket.setBlockPalette(Toolbox.BLOCKS); startGamePacket.setBlockPalette(Toolbox.BLOCKS);
startGamePacket.setItemEntries(Toolbox.ITEMS); startGamePacket.setItemEntries(Toolbox.ITEMS);
startGamePacket.setVanillaVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getMinecraftVersion()); startGamePacket.setVanillaVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getMinecraftVersion());
// startGamePacket.setMovementServerAuthoritative(true);
upstream.sendPacket(startGamePacket); upstream.sendPacket(startGamePacket);
} }
} }

Datei anzeigen

@ -49,7 +49,7 @@ public class JavaJoinGameTranslator extends PacketTranslator<ServerJoinGamePacke
PlayStatusPacket playStatus = new PlayStatusPacket(); PlayStatusPacket playStatus = new PlayStatusPacket();
playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS); playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS);
session.getUpstream().sendPacket(playStatus); // session.getUpstream().sendPacket(playStatus);
PlayerEntity entity = session.getPlayerEntity(); PlayerEntity entity = session.getPlayerEntity();
entity.setEntityId(packet.getEntityId()); entity.setEntityId(packet.getEntityId());

Datei anzeigen

@ -57,9 +57,11 @@ public class JavaRespawnTranslator extends PacketTranslator<ServerRespawnPacket>
session.getUpstream().sendPacket(playerGameTypePacket); session.getUpstream().sendPacket(playerGameTypePacket);
session.setGameMode(packet.getGamemode()); session.setGameMode(packet.getGamemode());
/*
PlayStatusPacket playStatusPacket = new PlayStatusPacket(); PlayStatusPacket playStatusPacket = new PlayStatusPacket();
playStatusPacket.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN); playStatusPacket.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN);
session.getUpstream().sendPacket(playStatusPacket); session.getUpstream().sendPacket(playStatusPacket);
*/
} }
private int getDimension(int javaDimension) { private int getDimension(int javaDimension) {

Datei anzeigen

@ -63,8 +63,8 @@ public class JavaPlayerHealthTranslator extends PacketTranslator<ServerPlayerHea
RespawnPacket respawnPacket = new RespawnPacket(); RespawnPacket respawnPacket = new RespawnPacket();
respawnPacket.setRuntimeEntityId(entity.getGeyserId()); respawnPacket.setRuntimeEntityId(entity.getGeyserId());
respawnPacket.setPosition(Vector3f.from(0, 72, 0)); respawnPacket.setPosition(Vector3f.from(0, 72, 0));
respawnPacket.setSpawnState(2); // client ready to respawn respawnPacket.setSpawnState(0); // state searching for spawn
session.getUpstream().sendPacket(new RespawnPacket()); session.getUpstream().sendPacket(respawnPacket);
ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN); ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN);
session.getDownstream().getSession().send(javaRespawnPacket); session.getDownstream().getSession().send(javaRespawnPacket);

Datei anzeigen

@ -48,7 +48,7 @@ public class SkinUtils {
public static PlayerListPacket.Entry buildEntryManually(UUID uuid, String username, long geyserId, public static PlayerListPacket.Entry buildEntryManually(UUID uuid, String username, long geyserId,
String skinId, byte[] skinData, byte[] capeData, String skinId, byte[] skinData, byte[] capeData,
String geometryName, String geometryData) { String geometryName, String geometryData) {
SerializedSkin serializedSkin = SerializedSkin.of(skinId, ImageData.of(32, 64, skinData), ImageData.of(32, 64, capeData), geometryName, geometryData, true); SerializedSkin serializedSkin = SerializedSkin.of(skinId, ImageData.of(64, 64, skinData), ImageData.of(64, 32, capeData), geometryName, geometryData, true);
PlayerListPacket.Entry entry = new PlayerListPacket.Entry(uuid); PlayerListPacket.Entry entry = new PlayerListPacket.Entry(uuid);
entry.setName(username); entry.setName(username);