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

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

    if (entity instanceof EntityLiving)
    {
        if (entity1 != null)
        {
            ((EntityLiving)entity).setLeashedToEntity(entity1, false);
        }
        else
        {
            ((EntityLiving)entity).clearLeashed(false, false);
        }
    }
}
项目:Backmemed    文件:EntityLiving.java   
/**
 * Removes the leash from this entity
 */
public void clearLeashed(boolean sendPacket, boolean dropLead)
{
    if (this.isLeashed)
    {
        this.isLeashed = false;
        this.leashedToEntity = null;

        if (!this.world.isRemote && dropLead)
        {
            this.dropItem(Items.LEAD, 1);
        }

        if (!this.world.isRemote && sendPacket && this.world instanceof WorldServer)
        {
            ((WorldServer)this.world).getEntityTracker().sendToAllTrackingEntity(this, new SPacketEntityAttach(this, (Entity)null));
        }
    }
}
项目:Backmemed    文件:EntityLiving.java   
/**
 * Sets the entity to be leashed to.
 */
public void setLeashedToEntity(Entity entityIn, boolean sendAttachNotification)
{
    this.isLeashed = true;
    this.leashedToEntity = entityIn;

    if (!this.world.isRemote && sendAttachNotification && this.world instanceof WorldServer)
    {
        ((WorldServer)this.world).getEntityTracker().sendToAllTrackingEntity(this, new SPacketEntityAttach(this, this.leashedToEntity));
    }

    if (this.isRiding())
    {
        this.dismountRidingEntity();
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
public void handleEntityAttach(SPacketEntityAttach packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
    Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getVehicleEntityId());

    if (entity instanceof EntityLiving)
    {
        if (entity1 != null)
        {
            ((EntityLiving)entity).setLeashedToEntity(entity1, false);
        }
        else
        {
            ((EntityLiving)entity).clearLeashed(false, false);
        }
    }
}
项目:CustomWorldGen    文件:EntityLiving.java   
/**
 * Removes the leash from this entity
 */
public void clearLeashed(boolean sendPacket, boolean dropLead)
{
    if (this.isLeashed)
    {
        this.isLeashed = false;
        this.leashedToEntity = null;

        if (!this.worldObj.isRemote && dropLead)
        {
            this.dropItem(Items.LEAD, 1);
        }

        if (!this.worldObj.isRemote && sendPacket && this.worldObj instanceof WorldServer)
        {
            ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new SPacketEntityAttach(this, (Entity)null));
        }
    }
}
项目:CustomWorldGen    文件:EntityLiving.java   
/**
 * Sets the entity to be leashed to.
 */
public void setLeashedToEntity(Entity entityIn, boolean sendAttachNotification)
{
    this.isLeashed = true;
    this.leashedToEntity = entityIn;

    if (!this.worldObj.isRemote && sendAttachNotification && this.worldObj instanceof WorldServer)
    {
        ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new SPacketEntityAttach(this, this.leashedToEntity));
    }

    if (this.isRiding())
    {
        this.dismountRidingEntity();
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
public void handleEntityAttach(SPacketEntityAttach packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
    Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getVehicleEntityId());

    if (entity instanceof EntityLiving)
    {
        if (entity1 != null)
        {
            ((EntityLiving)entity).setLeashedToEntity(entity1, false);
        }
        else
        {
            ((EntityLiving)entity).clearLeashed(false, false);
        }
    }
}
项目:ExpandedRailsMod    文件:EntityLiving.java   
/**
 * Removes the leash from this entity
 */
public void clearLeashed(boolean sendPacket, boolean dropLead)
{
    if (this.isLeashed)
    {
        this.isLeashed = false;
        this.leashedToEntity = null;

        if (!this.worldObj.isRemote && dropLead)
        {
            this.dropItem(Items.LEAD, 1);
        }

        if (!this.worldObj.isRemote && sendPacket && this.worldObj instanceof WorldServer)
        {
            ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new SPacketEntityAttach(this, (Entity)null));
        }
    }
}
项目:ExpandedRailsMod    文件:EntityLiving.java   
/**
 * Sets the entity to be leashed to.
 */
public void setLeashedToEntity(Entity entityIn, boolean sendAttachNotification)
{
    this.isLeashed = true;
    this.leashedToEntity = entityIn;

    if (!this.worldObj.isRemote && sendAttachNotification && this.worldObj instanceof WorldServer)
    {
        ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new SPacketEntityAttach(this, this.leashedToEntity));
    }

    if (this.isRiding())
    {
        this.dismountRidingEntity();
    }
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
public void handleEntityAttach(SPacketEntityAttach packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
    Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getVehicleEntityId());

    if (entity instanceof EntityLiving)
    {
        if (entity1 != null)
        {
            ((EntityLiving)entity).setLeashedToEntity(entity1, false);
        }
        else
        {
            ((EntityLiving)entity).clearLeashed(false, 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 handleEntityAttach(SPacketEntityAttach packetIn);
项目:CustomWorldGen    文件:INetHandlerPlayClient.java   
void handleEntityAttach(SPacketEntityAttach packetIn);