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

项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
public void handleSetPassengers(SPacketSetPassengers packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity == null)
    {
        LOGGER.warn("Received passengers for unknown entity");
    }
    else
    {
        boolean flag = entity.isRidingOrBeingRiddenBy(this.gameController.player);
        entity.removePassengers();

        for (int i : packetIn.getPassengerIds())
        {
            Entity entity1 = this.clientWorldController.getEntityByID(i);

            if (entity1 != null)
            {
                entity1.startRiding(entity, true);

                if (entity1 == this.gameController.player && !flag)
                {
                    this.gameController.ingameGUI.setRecordPlaying(I18n.format("mount.onboard", new Object[] {GameSettings.getKeyDisplayString(this.gameController.gameSettings.keyBindSneak.getKeyCode())}), false);
                }
            }
        }
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
public void handleSetPassengers(SPacketSetPassengers packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity == null)
    {
        LOGGER.warn("Received passengers for unknown entity");
    }
    else
    {
        boolean flag = entity.isRidingOrBeingRiddenBy(this.gameController.player);
        entity.removePassengers();

        for (int i : packetIn.getPassengerIds())
        {
            Entity entity1 = this.clientWorldController.getEntityByID(i);

            if (entity1 != null)
            {
                entity1.startRiding(entity, true);

                if (entity1 == this.gameController.player && !flag)
                {
                    this.gameController.ingameGUI.setRecordPlaying(I18n.format("mount.onboard", new Object[] {GameSettings.getKeyDisplayString(this.gameController.gameSettings.keyBindSneak.getKeyCode())}), false);
                }
            }
        }
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
public void handleSetPassengers(SPacketSetPassengers packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity == null)
    {
        LOGGER.warn("Received passengers for unknown entity");
    }
    else
    {
        boolean flag = entity.isRidingOrBeingRiddenBy(this.gameController.thePlayer);
        entity.removePassengers();

        for (int i : packetIn.getPassengerIds())
        {
            Entity entity1 = this.clientWorldController.getEntityByID(i);

            if (entity1 == null)
            {
                LOGGER.warn("Received unknown passenger for {}", new Object[] {entity});
            }
            else
            {
                entity1.startRiding(entity, true);

                if (entity1 == this.gameController.thePlayer && !flag)
                {
                    this.gameController.ingameGUI.setRecordPlaying(I18n.format("mount.onboard", new Object[] {this.gameController.gameSettings.keyBindSneak.getDisplayName()}), false);
                }
            }
        }
    }
}
项目:CrystalMod    文件:TeleportUtil.java   
/**
 * This is the method that is responsible for actually sending the update to each client.
 * @param playerMP The Player.
 */
private void updateClient(EntityPlayerMP playerMP) {
    if (entity.isBeingRidden()) {
        playerMP.connection.sendPacket(new SPacketSetPassengers(entity));
    }
    for (PassengerTeleporter passenger : passengers) {
        passenger.updateClients();
    }
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
public void handleSetPassengers(SPacketSetPassengers packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity == null)
    {
        LOGGER.warn("Received passengers for unknown entity");
    }
    else
    {
        boolean flag = entity.isRidingOrBeingRiddenBy(this.gameController.thePlayer);
        entity.removePassengers();

        for (int i : packetIn.getPassengerIds())
        {
            Entity entity1 = this.clientWorldController.getEntityByID(i);

            if (entity1 == null)
            {
                LOGGER.warn("Received unknown passenger for {}", new Object[] {entity});
            }
            else
            {
                entity1.startRiding(entity, true);

                if (entity1 == this.gameController.thePlayer && !flag)
                {
                    this.gameController.ingameGUI.setRecordPlaying(I18n.format("mount.onboard", new Object[] {this.gameController.gameSettings.keyBindSneak.getDisplayName()}), false);
                }
            }
        }
    }
}
项目:Backmemed    文件:EntityTracker.java   
/**
 * Send packets to player for every tracked entity in this chunk that is either leashed to something or someone, or
 * has passengers
 */
public void sendLeashedEntitiesInChunk(EntityPlayerMP player, Chunk chunkIn)
{
    List<Entity> list = Lists.<Entity>newArrayList();
    List<Entity> list1 = Lists.<Entity>newArrayList();

    for (EntityTrackerEntry entitytrackerentry : this.trackedEntities)
    {
        Entity entity = entitytrackerentry.getTrackedEntity();

        if (entity != player && entity.chunkCoordX == chunkIn.xPosition && entity.chunkCoordZ == chunkIn.zPosition)
        {
            entitytrackerentry.updatePlayerEntity(player);

            if (entity instanceof EntityLiving && ((EntityLiving)entity).getLeashedToEntity() != null)
            {
                list.add(entity);
            }

            if (!entity.getPassengers().isEmpty())
            {
                list1.add(entity);
            }
        }
    }

    if (!list.isEmpty())
    {
        for (Entity entity1 : list)
        {
            player.connection.sendPacket(new SPacketEntityAttach(entity1, ((EntityLiving)entity1).getLeashedToEntity()));
        }
    }

    if (!list1.isEmpty())
    {
        for (Entity entity2 : list1)
        {
            player.connection.sendPacket(new SPacketSetPassengers(entity2));
        }
    }
}
项目:CustomWorldGen    文件:EntityTracker.java   
/**
 * Send packets to player for every tracked entity in this chunk that is either leashed to something or someone, or
 * has passengers
 */
public void sendLeashedEntitiesInChunk(EntityPlayerMP player, Chunk chunkIn)
{
    List<Entity> list = Lists.<Entity>newArrayList();
    List<Entity> list1 = Lists.<Entity>newArrayList();

    for (EntityTrackerEntry entitytrackerentry : this.trackedEntities)
    {
        Entity entity = entitytrackerentry.getTrackedEntity();

        if (entity != player && entity.chunkCoordX == chunkIn.xPosition && entity.chunkCoordZ == chunkIn.zPosition)
        {
            entitytrackerentry.updatePlayerEntity(player);

            if (entity instanceof EntityLiving && ((EntityLiving)entity).getLeashedToEntity() != null)
            {
                list.add(entity);
            }

            if (!entity.getPassengers().isEmpty())
            {
                list1.add(entity);
            }
        }
    }

    if (!list.isEmpty())
    {
        for (Entity entity1 : list)
        {
            player.connection.sendPacket(new SPacketEntityAttach(entity1, ((EntityLiving)entity1).getLeashedToEntity()));
        }
    }

    if (!list1.isEmpty())
    {
        for (Entity entity2 : list1)
        {
            player.connection.sendPacket(new SPacketSetPassengers(entity2));
        }
    }
}
项目:ExpandedRailsMod    文件:EntityTracker.java   
/**
 * Send packets to player for every tracked entity in this chunk that is either leashed to something or someone, or
 * has passengers
 */
public void sendLeashedEntitiesInChunk(EntityPlayerMP player, Chunk chunkIn)
{
    List<Entity> list = Lists.<Entity>newArrayList();
    List<Entity> list1 = Lists.<Entity>newArrayList();

    for (EntityTrackerEntry entitytrackerentry : this.trackedEntities)
    {
        Entity entity = entitytrackerentry.getTrackedEntity();

        if (entity != player && entity.chunkCoordX == chunkIn.xPosition && entity.chunkCoordZ == chunkIn.zPosition)
        {
            entitytrackerentry.updatePlayerEntity(player);

            if (entity instanceof EntityLiving && ((EntityLiving)entity).getLeashedToEntity() != null)
            {
                list.add(entity);
            }

            if (!entity.getPassengers().isEmpty())
            {
                list1.add(entity);
            }
        }
    }

    if (!list.isEmpty())
    {
        for (Entity entity1 : list)
        {
            player.connection.sendPacket(new SPacketEntityAttach(entity1, ((EntityLiving)entity1).getLeashedToEntity()));
        }
    }

    if (!list1.isEmpty())
    {
        for (Entity entity2 : list1)
        {
            player.connection.sendPacket(new SPacketSetPassengers(entity2));
        }
    }
}
项目:Backmemed    文件:INetHandlerPlayClient.java   
void handleSetPassengers(SPacketSetPassengers packetIn);
项目:CustomWorldGen    文件:INetHandlerPlayClient.java   
void handleSetPassengers(SPacketSetPassengers packetIn);