Search in sources :

Example 1 with ClientboundRespawnPacket

use of net.minecraft.network.protocol.game.ClientboundRespawnPacket in project SpongeCommon by SpongePowered.

the class ServerPlayerMixin method impl$prepareForPortalTeleport.

@Override
protected final void impl$prepareForPortalTeleport(final ServerLevel currentWorld, final ServerLevel targetWorld) {
    final LevelData levelData = targetWorld.getLevelData();
    this.connection.send(new ClientboundRespawnPacket(targetWorld.dimensionType(), targetWorld.dimension(), BiomeManager.obfuscateSeed(targetWorld.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), targetWorld.isDebug(), targetWorld.isFlat(), true));
    this.connection.send(new ClientboundChangeDifficultyPacket(levelData.getDifficulty(), levelData.isDifficultyLocked()));
    final PlayerList playerlist = this.server.getPlayerList();
    playerlist.sendPlayerPermissionLevel((net.minecraft.server.level.ServerPlayer) (Object) this);
    currentWorld.removePlayerImmediately((net.minecraft.server.level.ServerPlayer) (Object) this);
    this.removed = false;
}
Also used : PlayerList(net.minecraft.server.players.PlayerList) ClientboundRespawnPacket(net.minecraft.network.protocol.game.ClientboundRespawnPacket) ClientboundChangeDifficultyPacket(net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket) LevelData(net.minecraft.world.level.storage.LevelData)

Aggregations

ClientboundChangeDifficultyPacket (net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket)1 ClientboundRespawnPacket (net.minecraft.network.protocol.game.ClientboundRespawnPacket)1 PlayerList (net.minecraft.server.players.PlayerList)1 LevelData (net.minecraft.world.level.storage.LevelData)1