3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-27 08:30:12 +01:00
Dieser Commit ist enthalten in:
AJ Ferguson 2019-12-28 21:45:41 -09:00
Ursprung 6635241526
Commit c4658ecdae
3 geänderte Dateien mit 7 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -27,6 +27,7 @@ package org.geysermc.connector.network.translators.bedrock;
import com.github.steveice10.mc.protocol.data.game.ClientRequest; import com.github.steveice10.mc.protocol.data.game.ClientRequest;
import com.github.steveice10.mc.protocol.packet.ingame.client.ClientRequestPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientRequestPacket;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.packet.RespawnPacket; import com.nukkitx.protocol.bedrock.packet.RespawnPacket;
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;
@ -36,6 +37,12 @@ public class BedrockRespawnTranslator extends PacketTranslator<RespawnPacket> {
@Override @Override
public void translate(RespawnPacket packet, GeyserSession session) { public void translate(RespawnPacket packet, GeyserSession session) {
if (packet.getSpawnState() == RespawnPacket.State.CLIENT_READY) { if (packet.getSpawnState() == RespawnPacket.State.CLIENT_READY) {
RespawnPacket respawnPacket = new RespawnPacket();
respawnPacket.setRuntimeEntityId(0);
respawnPacket.setPosition(Vector3f.ZERO);
respawnPacket.setSpawnState(RespawnPacket.State.SERVER_SEARCHING);
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

@ -52,12 +52,6 @@ public class JavaPlayerPositionRotationTranslator extends PacketTranslator<Serve
RespawnPacket respawnPacket = new RespawnPacket(); RespawnPacket respawnPacket = new RespawnPacket();
respawnPacket.setRuntimeEntityId(0); respawnPacket.setRuntimeEntityId(0);
respawnPacket.setPosition(Vector3f.ZERO);
respawnPacket.setSpawnState(RespawnPacket.State.SERVER_SEARCHING);
session.getUpstream().sendPacket(respawnPacket);
respawnPacket = new RespawnPacket();
respawnPacket.setRuntimeEntityId(0);
respawnPacket.setPosition(pos); respawnPacket.setPosition(pos);
respawnPacket.setSpawnState(RespawnPacket.State.SERVER_READY); respawnPacket.setSpawnState(RespawnPacket.State.SERVER_READY);
session.getUpstream().sendPacket(respawnPacket); session.getUpstream().sendPacket(respawnPacket);

Datei anzeigen

@ -28,12 +28,6 @@ public class DimensionUtils {
stopSoundPacket.setSoundName(""); stopSoundPacket.setSoundName("");
session.getUpstream().sendPacket(stopSoundPacket); session.getUpstream().sendPacket(stopSoundPacket);
EntityEventPacket eventPacket = new EntityEventPacket();
eventPacket.setRuntimeEntityId(player.getGeyserId());
eventPacket.setEvent(EntityEventPacket.Event.RESPAWN);
eventPacket.setData(0);
session.getUpstream().sendPacket(eventPacket);
session.setSpawned(false); session.setSpawned(false);
session.setSwitchingDimension(true); session.setSwitchingDimension(true);
} }