Search in sources :

Example 1 with SPacketSetExperience

use of net.minecraft.network.play.server.SPacketSetExperience in project SpongeCommon by SpongePowered.

the class MixinPlayerList method recreatePlayerEntity.

/**
 * @author Zidane - June 13th, 2015
 * @author simon816 - June 24th, 2015
 * @author Zidane - March 29th, 2016
 * @author gabizou - June 5th, 2016 - Update for teleportation changes to keep the same player.
 *
 * @reason - Direct respawning players to use Sponge events
 * and process appropriately.
 *
 * @param playerIn The player being respawned/created
 * @param targetDimension The target dimension
 * @param conqueredEnd Whether the end was conquered
 * @return The new player
 */
@Overwrite
public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int targetDimension, boolean conqueredEnd) {
    // UNLESS comming back from the end.
    if (!conqueredEnd && targetDimension == 0) {
        targetDimension = playerIn.dimension;
    }
    if (playerIn.isBeingRidden()) {
        playerIn.removePassengers();
    }
    if (playerIn.isRiding()) {
        playerIn.dismountRidingEntity();
    }
    final Player player = (Player) playerIn;
    final Transform<World> fromTransform = player.getTransform();
    WorldServer worldServer = this.mcServer.getWorld(targetDimension);
    Transform<World> toTransform = new Transform<>(EntityUtil.getPlayerRespawnLocation(playerIn, worldServer), Vector3d.ZERO, Vector3d.ZERO);
    targetDimension = ((IMixinWorldServer) toTransform.getExtent()).getDimensionId();
    Location<World> location = toTransform.getLocation();
    // If coming from end, fire a teleport event for plugins
    if (conqueredEnd) {
        // When leaving the end, players are never placed inside the teleporter but instead "respawned" in the target world
        MoveEntityEvent.Teleport teleportEvent = EntityUtil.handleDisplaceEntityTeleportEvent(playerIn, location);
        if (teleportEvent.isCancelled()) {
            playerIn.queuedEndExit = false;
            return playerIn;
        }
        toTransform = teleportEvent.getToTransform();
        location = toTransform.getLocation();
    }
    // Keep players out of blocks
    Vector3d tempPos = player.getLocation().getPosition();
    playerIn.setPosition(location.getX(), location.getY(), location.getZ());
    while (!((WorldServer) location.getExtent()).getCollisionBoxes(playerIn, playerIn.getEntityBoundingBox()).isEmpty()) {
        playerIn.setPosition(playerIn.posX, playerIn.posY + 1.0D, playerIn.posZ);
        location = location.add(0, 1, 0);
    }
    playerIn.setPosition(tempPos.getX(), tempPos.getY(), tempPos.getZ());
    // ### PHASE 2 ### Remove player from current dimension
    playerIn.getServerWorld().getEntityTracker().removePlayerFromTrackers(playerIn);
    playerIn.getServerWorld().getEntityTracker().untrack(playerIn);
    playerIn.getServerWorld().getPlayerChunkMap().removePlayer(playerIn);
    this.playerEntityList.remove(playerIn);
    this.mcServer.getWorld(playerIn.dimension).removeEntityDangerously(playerIn);
    final BlockPos bedPos = SpongeImplHooks.getBedLocation(playerIn, targetDimension);
    // ### PHASE 3 ### Reset player (if applicable)
    // Recreate the player object in order to support Forge's PlayerEvent.Clone
    PlayerInteractionManager playerinteractionmanager;
    if (this.mcServer.isDemo()) {
        playerinteractionmanager = new DemoPlayerInteractionManager(this.mcServer.getWorld(targetDimension));
    } else {
        playerinteractionmanager = new PlayerInteractionManager(this.mcServer.getWorld(targetDimension));
    }
    EntityPlayerMP newPlayer = new EntityPlayerMP(SpongeImpl.getServer(), worldServer, playerIn.getGameProfile(), playerinteractionmanager);
    newPlayer.connection = playerIn.connection;
    newPlayer.copyFrom(playerIn, conqueredEnd);
    // set player dimension for RespawnPlayerEvent
    newPlayer.dimension = targetDimension;
    newPlayer.setEntityId(playerIn.getEntityId());
    newPlayer.setCommandStats(playerIn);
    newPlayer.setPrimaryHand(playerIn.getPrimaryHand());
    // over to the new player
    if (bedPos != null) {
        newPlayer.setSpawnPoint(bedPos, playerIn.isSpawnForced());
    }
    for (String s : playerIn.getTags()) {
        newPlayer.addTag(s);
    }
    this.setPlayerGameTypeBasedOnOther(newPlayer, playerIn, worldServer);
    newPlayer.setSneaking(false);
    // update to safe location
    toTransform = toTransform.setLocation(location);
    // ### PHASE 4 ### Fire event and set new location on the player
    Sponge.getCauseStackManager().pushCause(newPlayer);
    final RespawnPlayerEvent event = SpongeEventFactory.createRespawnPlayerEvent(Sponge.getCauseStackManager().getCurrentCause(), fromTransform, toTransform, (Player) playerIn, (Player) newPlayer, EntityUtil.tempIsBedSpawn, !conqueredEnd);
    EntityUtil.tempIsBedSpawn = false;
    SpongeImpl.postEvent(event);
    Sponge.getCauseStackManager().popCause();
    ((IMixinEntity) player).setLocationAndAngles(event.getToTransform());
    toTransform = event.getToTransform();
    location = toTransform.getLocation();
    if (!(location.getExtent() instanceof WorldServer)) {
        SpongeImpl.getLogger().warn("Location set in PlayerRespawnEvent was invalid, using original location instead");
        location = event.getFromTransform().getLocation();
    }
    worldServer = (WorldServer) location.getExtent();
    final IMixinWorldServer mixinWorldServer = (IMixinWorldServer) worldServer;
    // Set the dimension again in case a plugin changed the target world during RespawnPlayerEvent
    newPlayer.dimension = mixinWorldServer.getDimensionId();
    newPlayer.setWorld(worldServer);
    newPlayer.interactionManager.setWorld(worldServer);
    worldServer.getChunkProvider().loadChunk((int) location.getX() >> 4, (int) location.getZ() >> 4);
    // ### PHASE 5 ### Respawn player in new world
    // Support vanilla clients logging into custom dimensions
    final int dimensionId = WorldManager.getClientDimensionId(newPlayer, worldServer);
    // Send dimension registration
    if (((IMixinEntityPlayerMP) newPlayer).usesCustomClient()) {
        WorldManager.sendDimensionRegistration(newPlayer, worldServer.provider);
    } else {
        // Force vanilla client to refresh its chunk cache if same dimension type
        if (fromTransform.getExtent() != worldServer && fromTransform.getExtent().getDimension().getType() == toTransform.getExtent().getDimension().getType()) {
            newPlayer.connection.sendPacket(new SPacketRespawn((dimensionId >= 0 ? -1 : 0), worldServer.getDifficulty(), worldServer.getWorldInfo().getTerrainType(), newPlayer.interactionManager.getGameType()));
        }
    }
    newPlayer.connection.sendPacket(new SPacketRespawn(dimensionId, worldServer.getDifficulty(), worldServer.getWorldInfo().getTerrainType(), newPlayer.interactionManager.getGameType()));
    newPlayer.connection.setPlayerLocation(location.getX(), location.getY(), location.getZ(), (float) toTransform.getYaw(), (float) toTransform.getPitch());
    final BlockPos spawnLocation = worldServer.getSpawnPoint();
    newPlayer.connection.sendPacket(new SPacketSpawnPosition(spawnLocation));
    newPlayer.connection.sendPacket(new SPacketSetExperience(newPlayer.experience, newPlayer.experienceTotal, newPlayer.experienceLevel));
    this.updateTimeAndWeatherForPlayer(newPlayer, worldServer);
    this.updatePermissionLevel(newPlayer);
    worldServer.getPlayerChunkMap().addPlayer(newPlayer);
    org.spongepowered.api.entity.Entity spongeEntity = (org.spongepowered.api.entity.Entity) newPlayer;
    ((org.spongepowered.api.world.World) worldServer).spawnEntity(spongeEntity);
    this.playerEntityList.add(newPlayer);
    this.uuidToPlayerMap.put(newPlayer.getUniqueID(), newPlayer);
    newPlayer.addSelfToInternalCraftingInventory();
    // Update reducedDebugInfo game rule
    newPlayer.connection.sendPacket(new SPacketEntityStatus(newPlayer, worldServer.getGameRules().getBoolean(DefaultGameRules.REDUCED_DEBUG_INFO) ? (byte) 22 : 23));
    for (PotionEffect potioneffect : newPlayer.getActivePotionEffects()) {
        newPlayer.connection.sendPacket(new SPacketEntityEffect(newPlayer.getEntityId(), potioneffect));
    }
    ((IMixinEntityPlayerMP) newPlayer).refreshScaledHealth();
    return newPlayer;
}
Also used : IMixinEntity(org.spongepowered.common.interfaces.entity.IMixinEntity) Entity(net.minecraft.entity.Entity) MoveEntityEvent(org.spongepowered.api.event.entity.MoveEntityEvent) SPacketSpawnPosition(net.minecraft.network.play.server.SPacketSpawnPosition) PotionEffect(net.minecraft.potion.PotionEffect) WorldServer(net.minecraft.world.WorldServer) IMixinWorldServer(org.spongepowered.common.interfaces.world.IMixinWorldServer) IMixinEntity(org.spongepowered.common.interfaces.entity.IMixinEntity) IMixinEntityPlayerMP(org.spongepowered.common.interfaces.entity.player.IMixinEntityPlayerMP) World(org.spongepowered.api.world.World) SPacketSetExperience(net.minecraft.network.play.server.SPacketSetExperience) BlockPos(net.minecraft.util.math.BlockPos) SPacketRespawn(net.minecraft.network.play.server.SPacketRespawn) Player(org.spongepowered.api.entity.living.player.Player) RespawnPlayerEvent(org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent) IMixinWorldServer(org.spongepowered.common.interfaces.world.IMixinWorldServer) SPacketEntityStatus(net.minecraft.network.play.server.SPacketEntityStatus) Vector3d(com.flowpowered.math.vector.Vector3d) DemoPlayerInteractionManager(net.minecraft.server.management.DemoPlayerInteractionManager) PlayerInteractionManager(net.minecraft.server.management.PlayerInteractionManager) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) IMixinEntityPlayerMP(org.spongepowered.common.interfaces.entity.player.IMixinEntityPlayerMP) SPacketEntityEffect(net.minecraft.network.play.server.SPacketEntityEffect) Transform(org.spongepowered.api.entity.Transform) DemoPlayerInteractionManager(net.minecraft.server.management.DemoPlayerInteractionManager) Overwrite(org.spongepowered.asm.mixin.Overwrite)

Example 2 with SPacketSetExperience

use of net.minecraft.network.play.server.SPacketSetExperience in project MorePlanets by SteveKunG.

the class TeleportUtil method teleportEntity.

@Deprecated
private static EntityPlayerMP teleportEntity(World worldNew, EntityPlayerMP player, int x, int y, int z, int dimID, boolean nether) {
    BlockPos blockpos = player.getBedLocation(dimID);
    boolean flag = player.isSpawnForced(dimID);
    boolean dimChange = player.world != worldNew;
    player.world.updateEntityWithOptionalForce(player, false);
    int oldDimID = GCCoreUtil.getDimensionID(player.world);
    ChunkPos pair = worldNew.getChunkFromChunkCoords(x, z).getPos();
    y = (int) (y + 1.5F);
    if (dimChange) {
        World worldOld = player.world;
        try {
            ((WorldServer) worldOld).getPlayerChunkMap().removePlayer(player);
        } catch (Exception e) {
            e.printStackTrace();
        }
        player.closeScreen();
        player.dimension = dimID;
        player.connection.sendPacket(new SPacketRespawn(dimID, player.world.getDifficulty(), player.world.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));
        worldOld.playerEntities.remove(player);
        worldOld.updateAllPlayersSleepingFlag();
        int i = player.chunkCoordX;
        int j = player.chunkCoordZ;
        if (player.addedToChunk && worldOld.isBlockLoaded(new BlockPos(i << 4, 63, j << 4), true)) {
            Chunk chunkOld = worldOld.getChunkFromChunkCoords(player.chunkCoordX, player.chunkCoordZ);
            chunkOld.removeEntity(player);
            chunkOld.setModified(true);
        }
        worldOld.loadedEntityList.remove(player);
        worldOld.onEntityRemoved(player);
        worldNew.spawnEntity(player);
        player.setWorld(worldNew);
        ((WorldServer) worldNew).getChunkProvider().loadChunk(pair.x, pair.z);
        worldNew.updateEntityWithOptionalForce(player, false);
        if (!nether) {
            player.setLocationAndAngles(x + 0.5F, y + 0.5F, z + 0.5F, player.rotationYaw, player.rotationPitch);
            player.mcServer.getPlayerList().preparePlayer(player, (WorldServer) worldNew);
            player.connection.setPlayerLocation(x + 0.5F, y + 0.5F, z + 0.5F, player.rotationYaw, player.rotationPitch);
        } else {
            if (blockpos != null) {
                BlockPos blockpos1 = EntityPlayer.getBedSpawnLocation(player.mcServer.getWorld(player.dimension), blockpos, flag);
                if (blockpos1 != null) {
                    player.setLocationAndAngles(blockpos1.getX() + 0.5F, blockpos1.getY() + 0.1F, blockpos1.getZ() + 0.5F, 0.0F, 0.0F);
                    player.setSpawnPoint(blockpos, flag);
                }
            }
        }
        player.interactionManager.setWorld((WorldServer) worldNew);
        player.mcServer.getPlayerList().updateTimeAndWeatherForPlayer(player, (WorldServer) worldNew);
        player.mcServer.getPlayerList().syncPlayerInventory(player);
        player.setSneaking(false);
        for (Object o : player.getActivePotionEffects()) {
            PotionEffect potion = (PotionEffect) o;
            player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potion));
        }
        player.connection.sendPacket(new SPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
    } else {
        player.closeScreen();
        player.setSneaking(false);
        worldNew.updateEntityWithOptionalForce(player, false);
        player.connection.setPlayerLocation(x + 0.5F, y + 0.5F, z + 0.5F, player.rotationYaw, player.rotationPitch);
        player.setLocationAndAngles(x + 0.5F, y + 0.5F, z + 0.5F, player.rotationYaw, player.rotationPitch);
        worldNew.updateEntityWithOptionalForce(player, false);
    }
    FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldDimID, dimID);
    return player;
}
Also used : SPacketSetExperience(net.minecraft.network.play.server.SPacketSetExperience) PotionEffect(net.minecraft.potion.PotionEffect) BlockPos(net.minecraft.util.math.BlockPos) ChunkPos(net.minecraft.util.math.ChunkPos) SPacketRespawn(net.minecraft.network.play.server.SPacketRespawn) SPacketEntityEffect(net.minecraft.network.play.server.SPacketEntityEffect) World(net.minecraft.world.World) Chunk(net.minecraft.world.chunk.Chunk)

Example 3 with SPacketSetExperience

use of net.minecraft.network.play.server.SPacketSetExperience in project MorePlanets by SteveKunG.

the class TeleportUtil method startNewDimension.

@Deprecated
public static void startNewDimension(EntityPlayerMP player) {
    WorldServer worldOld = (WorldServer) player.world;
    WorldServer worldNew = WorldDimensionHelper.getStartWorld(worldOld);
    BlockPos blockpos = worldNew.getTopSolidOrLiquidBlock(worldNew.getSpawnPoint());
    boolean dimChange = player.world != worldNew;
    player.world.updateEntityWithOptionalForce(player, false);
    int oldDimID = GCCoreUtil.getDimensionID(player.world);
    ChunkPos pair = worldNew.getChunkFromChunkCoords(blockpos.getX(), blockpos.getZ()).getPos();
    if (dimChange) {
        try {
            worldOld.getPlayerChunkMap().removePlayer(player);
        } catch (Exception e) {
            e.printStackTrace();
        }
        player.closeScreen();
        player.dimension = GCCoreUtil.getDimensionID(worldNew);
        player.connection.sendPacket(new SPacketRespawn(GCCoreUtil.getDimensionID(worldNew), player.world.getDifficulty(), player.world.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));
        worldOld.playerEntities.remove(player);
        worldOld.updateAllPlayersSleepingFlag();
        if (player.addedToChunk && worldOld.getChunkProvider().chunkExists(player.chunkCoordX, player.chunkCoordZ)) {
            Chunk chunkOld = worldOld.getChunkFromChunkCoords(player.chunkCoordX, player.chunkCoordZ);
            chunkOld.removeEntity(player);
            chunkOld.setModified(true);
        }
        worldOld.loadedEntityList.remove(player);
        worldOld.onEntityRemoved(player);
        worldNew.spawnEntity(player);
        player.setWorld(worldNew);
        MorePlanetsCore.PROXY.resetFloatingTick(player);
        if (!(worldNew.provider instanceof IGalacticraftWorldProvider)) {
            MPLog.error("{} is not space world!", ConfigManagerMP.startedPlanet);
            throw new RuntimeException(ConfigManagerMP.startedPlanet + " is not space world!");
        }
        if (worldNew.provider instanceof IStartedDimension) {
            IStartedDimension dimension = (IStartedDimension) worldNew.provider;
            MPLog.debug("Setting up player gear");
            dimension.setup(player);
        } else {
            GCPlayerStats stats = GCPlayerStats.get(player);
            MPLog.debug("Setting up player gear for Non-IStartedDimension world");
            // Knows how to build T2 rocket
            SchematicRegistry.unlockNewPage(player, new ItemStack(GCItems.schematic, 1, 1));
            // Knows how to build T3 rocket
            SchematicRegistry.unlockNewPage(player, new ItemStack(MarsItems.schematic, 1, 0));
            stats.getExtendedInventory().setInventorySlotContents(0, new ItemStack(GCItems.oxMask, 1, 0));
            stats.getExtendedInventory().setInventorySlotContents(1, new ItemStack(GCItems.oxygenGear, 1, 0));
            stats.getExtendedInventory().setInventorySlotContents(2, new ItemStack(GCItems.oxTankHeavy, 1, 0));
            stats.getExtendedInventory().setInventorySlotContents(3, new ItemStack(GCItems.oxTankHeavy, 1, 0));
            stats.getExtendedInventory().setInventorySlotContents(5, new ItemStack(GCItems.basicItem, 1, 19));
            stats.getExtendedInventory().setInventorySlotContents(6, new ItemStack(AsteroidsItems.thermalPadding, 1, 0));
            stats.getExtendedInventory().setInventorySlotContents(7, new ItemStack(AsteroidsItems.thermalPadding, 1, 1));
            stats.getExtendedInventory().setInventorySlotContents(8, new ItemStack(AsteroidsItems.thermalPadding, 1, 2));
            stats.getExtendedInventory().setInventorySlotContents(9, new ItemStack(AsteroidsItems.thermalPadding, 1, 3));
            player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
            player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
            player.inventory.addItemStackToInventory(new ItemStack(AsteroidsItems.canisterLOX));
        }
        worldNew.getChunkProvider().loadChunk(pair.x, pair.z);
        worldNew.updateEntityWithOptionalForce(player, false);
        player.setLocationAndAngles(blockpos.getX(), blockpos.getY() + 16.0D, blockpos.getZ(), player.rotationYaw, player.rotationPitch);
        player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 15 * 20, 5));
        player.mcServer.getPlayerList().preparePlayer(player, worldNew);
        player.connection.setPlayerLocation(blockpos.getX(), blockpos.getY() + 16.0D, blockpos.getZ(), player.rotationYaw, player.rotationPitch);
        player.interactionManager.setWorld(worldNew);
        player.mcServer.getPlayerList().updateTimeAndWeatherForPlayer(player, worldNew);
        player.mcServer.getPlayerList().syncPlayerInventory(player);
        for (Object o : player.getActivePotionEffects()) {
            PotionEffect potion = (PotionEffect) o;
            player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potion));
        }
        player.connection.sendPacket(new SPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
    } else {
        player.closeScreen();
        worldNew.updateEntityWithOptionalForce(player, false);
        player.connection.setPlayerLocation(blockpos.getX(), blockpos.getY() + 16.0D, blockpos.getZ(), player.rotationYaw, player.rotationPitch);
        player.setLocationAndAngles(blockpos.getX(), blockpos.getY() + 16.0D, blockpos.getZ(), player.rotationYaw, player.rotationPitch);
        player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 15 * 20, 5));
        worldNew.updateEntityWithOptionalForce(player, false);
    }
    FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldDimID, GCCoreUtil.getDimensionID(worldNew));
    if (player.onGround && player.getBedLocation(GCCoreUtil.getDimensionID(player.world)) == null) {
        int i = 30000000;
        int j = Math.min(i, Math.max(-i, MathHelper.floor(player.posX + 0.5D)));
        int k = Math.min(256, Math.max(0, MathHelper.floor(player.posY + 1.5D)));
        int l = Math.min(i, Math.max(-i, MathHelper.floor(player.posZ + 0.5D)));
        BlockPos coords = new BlockPos(j, k, l);
        player.setSpawnChunk(coords, true, GCCoreUtil.getDimensionID(player.world));
    }
}
Also used : IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) PotionEffect(net.minecraft.potion.PotionEffect) GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) WorldServer(net.minecraft.world.WorldServer) Chunk(net.minecraft.world.chunk.Chunk) IStartedDimension(stevekung.mods.moreplanets.world.IStartedDimension) SPacketSetExperience(net.minecraft.network.play.server.SPacketSetExperience) BlockPos(net.minecraft.util.math.BlockPos) ChunkPos(net.minecraft.util.math.ChunkPos) SPacketRespawn(net.minecraft.network.play.server.SPacketRespawn) SPacketEntityEffect(net.minecraft.network.play.server.SPacketEntityEffect) ItemStack(net.minecraft.item.ItemStack)

Example 4 with SPacketSetExperience

use of net.minecraft.network.play.server.SPacketSetExperience in project MorePlanets by SteveKunG.

the class TeleportUtil method teleportPlayerInternational.

private static EntityPlayer teleportPlayerInternational(EntityPlayerMP player, MinecraftServer server, int sourceDim, int targetDim, double xCoord, double yCoord, double zCoord, float yaw, float pitch) {
    WorldServer sourceWorld = server.getWorld(sourceDim);
    WorldServer targetWorld = server.getWorld(targetDim);
    PlayerList playerList = server.getPlayerList();
    player.dimension = targetDim;
    player.connection.sendPacket(new SPacketRespawn(player.dimension, targetWorld.getDifficulty(), targetWorld.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));
    playerList.updatePermissionLevel(player);
    sourceWorld.removeEntityDangerously(player);
    player.isDead = false;
    // world transfer
    player.setLocationAndAngles(xCoord, yCoord, zCoord, yaw, pitch);
    player.connection.setPlayerLocation(xCoord, yCoord, zCoord, yaw, pitch);
    targetWorld.spawnEntity(player);
    targetWorld.updateEntityWithOptionalForce(player, false);
    player.setWorld(targetWorld);
    playerList.preparePlayer(player, sourceWorld);
    player.connection.setPlayerLocation(xCoord, yCoord, zCoord, yaw, pitch);
    player.interactionManager.setWorld(targetWorld);
    player.connection.sendPacket(new SPacketPlayerAbilities(player.capabilities));
    playerList.updateTimeAndWeatherForPlayer(player, targetWorld);
    playerList.syncPlayerInventory(player);
    for (PotionEffect potion : player.getActivePotionEffects()) {
        player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potion));
    }
    player.connection.sendPacket(new SPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
    FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, sourceDim, targetDim);
    player.setLocationAndAngles(xCoord, yCoord, zCoord, yaw, pitch);
    return player;
}
Also used : SPacketSetExperience(net.minecraft.network.play.server.SPacketSetExperience) SPacketPlayerAbilities(net.minecraft.network.play.server.SPacketPlayerAbilities) PlayerList(net.minecraft.server.management.PlayerList) PotionEffect(net.minecraft.potion.PotionEffect) WorldServer(net.minecraft.world.WorldServer) SPacketRespawn(net.minecraft.network.play.server.SPacketRespawn) SPacketEntityEffect(net.minecraft.network.play.server.SPacketEntityEffect)

Aggregations

SPacketEntityEffect (net.minecraft.network.play.server.SPacketEntityEffect)4 SPacketRespawn (net.minecraft.network.play.server.SPacketRespawn)4 SPacketSetExperience (net.minecraft.network.play.server.SPacketSetExperience)4 PotionEffect (net.minecraft.potion.PotionEffect)4 BlockPos (net.minecraft.util.math.BlockPos)3 WorldServer (net.minecraft.world.WorldServer)3 ChunkPos (net.minecraft.util.math.ChunkPos)2 Chunk (net.minecraft.world.chunk.Chunk)2 Vector3d (com.flowpowered.math.vector.Vector3d)1 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)1 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)1 Entity (net.minecraft.entity.Entity)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 ItemStack (net.minecraft.item.ItemStack)1 SPacketEntityStatus (net.minecraft.network.play.server.SPacketEntityStatus)1 SPacketPlayerAbilities (net.minecraft.network.play.server.SPacketPlayerAbilities)1 SPacketSpawnPosition (net.minecraft.network.play.server.SPacketSpawnPosition)1 DemoPlayerInteractionManager (net.minecraft.server.management.DemoPlayerInteractionManager)1 PlayerInteractionManager (net.minecraft.server.management.PlayerInteractionManager)1 PlayerList (net.minecraft.server.management.PlayerList)1