Java 类net.minecraft.network.play.server.S05PacketSpawnPosition 实例源码

项目:DecompiledMinecraft    文件:CommandSetDefaultSpawnpoint.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    BlockPos blockpos;

    if (args.length == 0)
    {
        blockpos = getCommandSenderAsPlayer(sender).getPosition();
    }
    else
    {
        if (args.length != 3 || sender.getEntityWorld() == null)
        {
            throw new WrongUsageException("commands.setworldspawn.usage", new Object[0]);
        }

        blockpos = parseBlockPos(sender, args, 0, true);
    }

    sender.getEntityWorld().setSpawnPoint(blockpos);
    MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(new S05PacketSpawnPosition(blockpos));
    notifyOperators(sender, this, "commands.setworldspawn.success", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())});
}
项目:DecompiledMinecraft    文件:CommandSetDefaultSpawnpoint.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    BlockPos blockpos;

    if (args.length == 0)
    {
        blockpos = getCommandSenderAsPlayer(sender).getPosition();
    }
    else
    {
        if (args.length != 3 || sender.getEntityWorld() == null)
        {
            throw new WrongUsageException("commands.setworldspawn.usage", new Object[0]);
        }

        blockpos = parseBlockPos(sender, args, 0, true);
    }

    sender.getEntityWorld().setSpawnPoint(blockpos);
    MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(new S05PacketSpawnPosition(blockpos));
    notifyOperators(sender, this, "commands.setworldspawn.success", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())});
}
项目:BaseClient    文件:CommandSetDefaultSpawnpoint.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    BlockPos blockpos;

    if (args.length == 0)
    {
        blockpos = getCommandSenderAsPlayer(sender).getPosition();
    }
    else
    {
        if (args.length != 3 || sender.getEntityWorld() == null)
        {
            throw new WrongUsageException("commands.setworldspawn.usage", new Object[0]);
        }

        blockpos = parseBlockPos(sender, args, 0, true);
    }

    sender.getEntityWorld().setSpawnPoint(blockpos);
    MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(new S05PacketSpawnPosition(blockpos));
    notifyOperators(sender, this, "commands.setworldspawn.success", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())});
}
项目:BaseClient    文件:CommandSetDefaultSpawnpoint.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    BlockPos blockpos;

    if (args.length == 0)
    {
        blockpos = getCommandSenderAsPlayer(sender).getPosition();
    }
    else
    {
        if (args.length != 3 || sender.getEntityWorld() == null)
        {
            throw new WrongUsageException("commands.setworldspawn.usage", new Object[0]);
        }

        blockpos = parseBlockPos(sender, args, 0, true);
    }

    sender.getEntityWorld().setSpawnPoint(blockpos);
    MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(new S05PacketSpawnPosition(blockpos));
    notifyOperators(sender, this, "commands.setworldspawn.success", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())});
}
项目:DecompiledMinecraft    文件:NetHandlerPlayClient.java   
public void handleSpawnPosition(S05PacketSpawnPosition packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.thePlayer.setSpawnPoint(packetIn.getSpawnPos(), true);
    this.gameController.theWorld.getWorldInfo().setSpawn(packetIn.getSpawnPos());
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
public void handleSpawnPosition(S05PacketSpawnPosition packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.thePlayer.setSpawnPoint(packetIn.getSpawnPos(), true);
    this.gameController.theWorld.getWorldInfo().setSpawn(packetIn.getSpawnPos());
}
项目:BaseClient    文件:NetHandlerPlayClient.java   
public void handleSpawnPosition(S05PacketSpawnPosition packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.thePlayer.setSpawnPoint(packetIn.getSpawnPos(), true);
    this.gameController.theWorld.getWorldInfo().setSpawn(packetIn.getSpawnPos());
}
项目:Resilience-Client-Source    文件:NetHandlerPlayClient.java   
public void handleSpawnPosition(S05PacketSpawnPosition p_147271_1_)
{
    this.gameController.thePlayer.setSpawnChunk(new ChunkCoordinates(p_147271_1_.func_149360_c(), p_147271_1_.func_149359_d(), p_147271_1_.func_149358_e()), true);
    this.gameController.theWorld.getWorldInfo().setSpawnPosition(p_147271_1_.func_149360_c(), p_147271_1_.func_149359_d(), p_147271_1_.func_149358_e());
}
项目:Resilience-Client-Source    文件:ServerConfigurationManager.java   
public void initializeConnectionToPlayer(NetworkManager par1INetworkManager, EntityPlayerMP par2EntityPlayerMP)
{
    NBTTagCompound var3 = this.readPlayerDataFromFile(par2EntityPlayerMP);
    par2EntityPlayerMP.setWorld(this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension));
    par2EntityPlayerMP.theItemInWorldManager.setWorld((WorldServer)par2EntityPlayerMP.worldObj);
    String var4 = "local";

    if (par1INetworkManager.getSocketAddress() != null)
    {
        var4 = par1INetworkManager.getSocketAddress().toString();
    }

    logger.info(par2EntityPlayerMP.getCommandSenderName() + "[" + var4 + "] logged in with entity id " + par2EntityPlayerMP.getEntityId() + " at (" + par2EntityPlayerMP.posX + ", " + par2EntityPlayerMP.posY + ", " + par2EntityPlayerMP.posZ + ")");
    WorldServer var5 = this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension);
    ChunkCoordinates var6 = var5.getSpawnPoint();
    this.func_72381_a(par2EntityPlayerMP, (EntityPlayerMP)null, var5);
    NetHandlerPlayServer var7 = new NetHandlerPlayServer(this.mcServer, par1INetworkManager, par2EntityPlayerMP);
    var7.sendPacket(new S01PacketJoinGame(par2EntityPlayerMP.getEntityId(), par2EntityPlayerMP.theItemInWorldManager.getGameType(), var5.getWorldInfo().isHardcoreModeEnabled(), var5.provider.dimensionId, var5.difficultySetting, this.getMaxPlayers(), var5.getWorldInfo().getTerrainType()));
    var7.sendPacket(new S3FPacketCustomPayload("MC|Brand", this.getServerInstance().getServerModName().getBytes(Charsets.UTF_8)));
    var7.sendPacket(new S05PacketSpawnPosition(var6.posX, var6.posY, var6.posZ));
    var7.sendPacket(new S39PacketPlayerAbilities(par2EntityPlayerMP.capabilities));
    var7.sendPacket(new S09PacketHeldItemChange(par2EntityPlayerMP.inventory.currentItem));
    par2EntityPlayerMP.func_147099_x().func_150877_d();
    par2EntityPlayerMP.func_147099_x().func_150884_b(par2EntityPlayerMP);
    this.func_96456_a((ServerScoreboard)var5.getScoreboard(), par2EntityPlayerMP);
    this.mcServer.func_147132_au();
    ChatComponentTranslation var8 = new ChatComponentTranslation("multiplayer.player.joined", new Object[] {par2EntityPlayerMP.func_145748_c_()});
    var8.getChatStyle().setColor(EnumChatFormatting.YELLOW);
    this.func_148539_a(var8);
    this.playerLoggedIn(par2EntityPlayerMP);
    var7.setPlayerLocation(par2EntityPlayerMP.posX, par2EntityPlayerMP.posY, par2EntityPlayerMP.posZ, par2EntityPlayerMP.rotationYaw, par2EntityPlayerMP.rotationPitch);
    this.updateTimeAndWeatherForPlayer(par2EntityPlayerMP, var5);

    if (this.mcServer.func_147133_T().length() > 0)
    {
        par2EntityPlayerMP.func_147095_a(this.mcServer.func_147133_T());
    }

    Iterator var9 = par2EntityPlayerMP.getActivePotionEffects().iterator();

    while (var9.hasNext())
    {
        PotionEffect var10 = (PotionEffect)var9.next();
        var7.sendPacket(new S1DPacketEntityEffect(par2EntityPlayerMP.getEntityId(), var10));
    }

    par2EntityPlayerMP.addSelfToInternalCraftingInventory();

    if (var3 != null && var3.func_150297_b("Riding", 10))
    {
        Entity var11 = EntityList.createEntityFromNBT(var3.getCompoundTag("Riding"), var5);

        if (var11 != null)
        {
            var11.forceSpawn = true;
            var5.spawnEntityInWorld(var11);
            par2EntityPlayerMP.mountEntity(var11);
            var11.forceSpawn = false;
        }
    }
}
项目:NeptuneMod    文件:NeptunePacketFactory.java   
@Override
public Packet spawnPosition(int x, int y, int z) {
    return (Packet) new S05PacketSpawnPosition(new BlockPos(x, y, z));
}
项目:Cauldron    文件:NetHandlerPlayServer.java   
public void sendPacket(final Packet p_147359_1_)
{
    if (p_147359_1_ instanceof S02PacketChat)
    {
        S02PacketChat s02packetchat = (S02PacketChat)p_147359_1_;
        EntityPlayer.EnumChatVisibility enumchatvisibility = this.playerEntity.func_147096_v();

        if (enumchatvisibility == EntityPlayer.EnumChatVisibility.HIDDEN)
        {
            return;
        }

        if (enumchatvisibility == EntityPlayer.EnumChatVisibility.SYSTEM && !s02packetchat.func_148916_d())
        {
            return;
        }
    }

    // CraftBukkit start
    if (p_147359_1_ == null)
    {
        return;
    }
    else if (p_147359_1_ instanceof S05PacketSpawnPosition)
    {
        S05PacketSpawnPosition packet6 = (S05PacketSpawnPosition) p_147359_1_;
        this.playerEntity.compassTarget = new Location(this.getPlayerB().getWorld(), packet6.field_149364_a, packet6.field_149362_b, packet6.field_149363_c);
    }

    // CraftBukkit end

    try
    {
        this.netManager.scheduleOutboundPacket(p_147359_1_, new GenericFutureListener[0]);
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Sending packet");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Packet being sent");
        crashreportcategory.addCrashSectionCallable("Packet class", new Callable()
        {
            private static final String __OBFID = "CL_00001454";
            public String call()
            {
                return p_147359_1_.getClass().getCanonicalName();
            }
        });
        throw new ReportedException(crashreport);
    }
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleSpawnPosition(S05PacketSpawnPosition p_147271_1_)
{
    this.gameController.thePlayer.setSpawnChunk(new ChunkCoordinates(p_147271_1_.func_149360_c(), p_147271_1_.func_149359_d(), p_147271_1_.func_149358_e()), true);
    this.gameController.theWorld.getWorldInfo().setSpawnPosition(p_147271_1_.func_149360_c(), p_147271_1_.func_149359_d(), p_147271_1_.func_149358_e());
}
项目:Cauldron    文件:NetHandlerPlayClient.java   
public void handleSpawnPosition(S05PacketSpawnPosition p_147271_1_)
{
    this.gameController.thePlayer.setSpawnChunk(new ChunkCoordinates(p_147271_1_.func_149360_c(), p_147271_1_.func_149359_d(), p_147271_1_.func_149358_e()), true);
    this.gameController.theWorld.getWorldInfo().setSpawnPosition(p_147271_1_.func_149360_c(), p_147271_1_.func_149359_d(), p_147271_1_.func_149358_e());
}
项目:nailed    文件:NailedEventFactory.java   
public static void onPlayerRespawn(EntityPlayerMP ent){
    MinecraftServer server = MinecraftServer.getServer();
    NailedPlayer player = ((NailedPlayer) NailedPlatform.instance().getPlayerFromEntity(ent));
    NailedWorld destWorld = NailedDimensionManager.instance().getWorld(ent.dimension);
    NailedWorld currentWorld = NailedDimensionManager.instance().getWorld(ent.dimension);
    Map destMap = destWorld.getMap();

    currentWorld.getWrapped().getEntityTracker().removePlayerFromTrackers(ent); //Remove from EntityTracker
    currentWorld.getWrapped().getEntityTracker().untrackEntity(ent); //Notify other players of entity death
    currentWorld.getWrapped().getPlayerManager().removePlayer(ent); //Remove player's ChunkLoader
    server.getConfigurationManager().playerEntityList.remove(ent); //Remove from the global player list
    currentWorld.getWrapped().removePlayerEntityDangerously(ent); //Force the entity to be removed from it's current world

    Mappack mappack = destMap != null ? destMap.mappack() : null;
    Location pos = mappack == null ? new Location(destWorld, 0, 64, 0) : Location.builder().copy(destWorld.getConfig().spawnPoint()).setWorld(destWorld).build();

    if(destMap != null && destMap.getGameManager().isGameRunning()){
        if(destMap.getPlayerTeam(player) == null){
            //TODO: random spawnpoints
            /*if(mappack != null && mappack.getMetadata.isChoosingRandomSpawnpointAtRespawn()){
              List<Location> spawnpoints = mappack.getMappackMetadata().getRandomSpawnpoints();
              pos = spawnpoints.get(NailedAPI.getMapLoader().getRandomSpawnpointSelector().nextInt(spawnpoints.size()));
            }*/
        }else{
            Location p = destMap.getPlayerTeam(player).getSpawnPoint();
            if(p != null) pos = p;
        }
    }

    ent.dimension = destWorld.getDimensionId();

    ItemInWorldManager worldManager = new ItemInWorldManager(destWorld.getWrapped());

    EntityPlayerMP newPlayer = new EntityPlayerMP(server, destWorld.getWrapped(), ent.getGameProfile(), worldManager);
    newPlayer.playerNetServerHandler = ent.playerNetServerHandler;
    newPlayer.clonePlayer(ent, false);
    newPlayer.dimension = destWorld.getDimensionId();
    newPlayer.setEntityId(ent.getEntityId());

    worldManager.setGameType(ent.theItemInWorldManager.getGameType());

    newPlayer.setLocationAndAngles(pos.getX(), pos.getY(), pos.getZ(), pos.getYaw(), pos.getPitch());
    destWorld.getWrapped().theChunkProviderServer.loadChunk((int)(newPlayer.posX) >> 4, (int)(newPlayer.posZ) >> 4);

    player.sendPacket(new S07PacketRespawn(destWorld.getConfig().dimension().getId(), destWorld.getWrapped().getDifficulty(), destWorld.getWrapped().getWorldInfo().getTerrainType(), worldManager.getGameType()));
    player.netHandler.setPlayerLocation(pos.getX(), pos.getY(), pos.getZ(), pos.getYaw(), pos.getPitch());
    player.sendPacket(new S05PacketSpawnPosition(new BlockPos(pos.getX(), pos.getY(), pos.getZ())));
    player.sendPacket(new S1FPacketSetExperience(newPlayer.experience, newPlayer.experienceTotal, newPlayer.experienceLevel));
    server.getConfigurationManager().updateTimeAndWeatherForPlayer(newPlayer, destWorld.getWrapped());
    destWorld.getWrapped().getPlayerManager().addPlayer(newPlayer);
    destWorld.getWrapped().spawnEntityInWorld(newPlayer);
    //noinspection unchecked
    ((List<EntityPlayer>) server.getConfigurationManager().playerEntityList).add(newPlayer);
    newPlayer.addSelfToInternalCraftingInventory();
    newPlayer.setHealth(newPlayer.getHealth());

    player.netHandler.playerEntity = newPlayer;
    player.entity = newPlayer;

    //TODO: respawn event
}
项目:DecompiledMinecraft    文件:INetHandlerPlayClient.java   
void handleSpawnPosition(S05PacketSpawnPosition packetIn);
项目:DecompiledMinecraft    文件:INetHandlerPlayClient.java   
void handleSpawnPosition(S05PacketSpawnPosition packetIn);
项目:BaseClient    文件:INetHandlerPlayClient.java   
void handleSpawnPosition(S05PacketSpawnPosition packetIn);
项目:BaseClient    文件:INetHandlerPlayClient.java   
void handleSpawnPosition(S05PacketSpawnPosition packetIn);
项目:Resilience-Client-Source    文件:INetHandlerPlayClient.java   
void handleSpawnPosition(S05PacketSpawnPosition var1);
项目:Cauldron    文件:INetHandlerPlayClient.java   
void handleSpawnPosition(S05PacketSpawnPosition p_147271_1_);
项目:Cauldron    文件:INetHandlerPlayClient.java   
void handleSpawnPosition(S05PacketSpawnPosition p_147271_1_);