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

项目:CustomWorldGen    文件:EntityLivingBase.java   
public void swingArm(EnumHand hand)
{
    ItemStack stack = this.getHeldItem(hand);
    if (stack != null && stack.getItem() != null)
    {
        if (stack.getItem().onEntitySwing(this, stack)) return;
    }
    if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0)
    {
        this.swingProgressInt = -1;
        this.isSwingInProgress = true;
        this.swingingHand = hand;

        if (this.worldObj instanceof WorldServer)
        {
            ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new SPacketAnimation(this, hand == EnumHand.MAIN_HAND ? 0 : 3));
        }
    }
}
项目:ExpandedRailsMod    文件:EntityLivingBase.java   
public void swingArm(EnumHand hand)
{
    ItemStack stack = this.getHeldItem(hand);
    if (stack != null && stack.getItem() != null)
    {
        if (stack.getItem().onEntitySwing(this, stack)) return;
    }
    if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0)
    {
        this.swingProgressInt = -1;
        this.isSwingInProgress = true;
        this.swingingHand = hand;

        if (this.worldObj instanceof WorldServer)
        {
            ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new SPacketAnimation(this, hand == EnumHand.MAIN_HAND ? 0 : 3));
        }
    }
}
项目:Zombe-Modpack    文件:EntityPlayerMP.java   
/**
 * Wake up the player if they're sleeping.
 */
public void wakeUpPlayer(boolean immediately, boolean updateWorldFlag, boolean setSpawn)
{
    if (this.isPlayerSleeping())
    {
        this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(this, 2));
    }

    super.wakeUpPlayer(immediately, updateWorldFlag, setSpawn);

    if (this.connection != null)
    {
        this.connection.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
/**
 * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt
 * or receiving a critical hit by normal or magical means
 */
public void handleAnimation(SPacketAnimation packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());

    if (entity != null)
    {
        if (packetIn.getAnimationType() == 0)
        {
            EntityLivingBase entitylivingbase = (EntityLivingBase)entity;
            entitylivingbase.swingArm(EnumHand.MAIN_HAND);
        }
        else if (packetIn.getAnimationType() == 3)
        {
            EntityLivingBase entitylivingbase1 = (EntityLivingBase)entity;
            entitylivingbase1.swingArm(EnumHand.OFF_HAND);
        }
        else if (packetIn.getAnimationType() == 1)
        {
            entity.performHurtAnimation();
        }
        else if (packetIn.getAnimationType() == 2)
        {
            EntityPlayer entityplayer = (EntityPlayer)entity;
            entityplayer.wakeUpPlayer(false, false, false);
        }
        else if (packetIn.getAnimationType() == 4)
        {
            this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT);
        }
        else if (packetIn.getAnimationType() == 5)
        {
            this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT_MAGIC);
        }
    }
}
项目:Backmemed    文件:EntityLivingBase.java   
public void swingArm(EnumHand hand)
{
    if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0)
    {
        this.swingProgressInt = -1;
        this.isSwingInProgress = true;
        this.swingingHand = hand;

        if (this.world instanceof WorldServer)
        {
            ((WorldServer)this.world).getEntityTracker().sendToAllTrackingEntity(this, new SPacketAnimation(this, hand == EnumHand.MAIN_HAND ? 0 : 3));
        }
    }
}
项目:Backmemed    文件:EntityPlayerMP.java   
/**
 * Wake up the player if they're sleeping.
 */
public void wakeUpPlayer(boolean immediately, boolean updateWorldFlag, boolean setSpawn)
{
    if (this.isPlayerSleeping())
    {
        this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(this, 2));
    }

    super.wakeUpPlayer(immediately, updateWorldFlag, setSpawn);

    if (this.connection != null)
    {
        this.connection.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt
 * or receiving a critical hit by normal or magical means
 */
public void handleAnimation(SPacketAnimation packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());

    if (entity != null)
    {
        if (packetIn.getAnimationType() == 0)
        {
            EntityLivingBase entitylivingbase = (EntityLivingBase)entity;
            entitylivingbase.swingArm(EnumHand.MAIN_HAND);
        }
        else if (packetIn.getAnimationType() == 3)
        {
            EntityLivingBase entitylivingbase1 = (EntityLivingBase)entity;
            entitylivingbase1.swingArm(EnumHand.OFF_HAND);
        }
        else if (packetIn.getAnimationType() == 1)
        {
            entity.performHurtAnimation();
        }
        else if (packetIn.getAnimationType() == 2)
        {
            EntityPlayer entityplayer = (EntityPlayer)entity;
            entityplayer.wakeUpPlayer(false, false, false);
        }
        else if (packetIn.getAnimationType() == 4)
        {
            this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT);
        }
        else if (packetIn.getAnimationType() == 5)
        {
            this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT_MAGIC);
        }
    }
}
项目:CustomWorldGen    文件:EntityPlayerMP.java   
/**
 * Wake up the player if they're sleeping.
 */
public void wakeUpPlayer(boolean immediately, boolean updateWorldFlag, boolean setSpawn)
{
    if (this.isPlayerSleeping())
    {
        this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(this, 2));
    }

    super.wakeUpPlayer(immediately, updateWorldFlag, setSpawn);

    if (this.connection != null)
    {
        this.connection.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
/**
 * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt
 * or receiving a critical hit by normal or magical means
 */
public void handleAnimation(SPacketAnimation packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());

    if (entity != null)
    {
        if (packetIn.getAnimationType() == 0)
        {
            EntityLivingBase entitylivingbase = (EntityLivingBase)entity;
            entitylivingbase.swingArm(EnumHand.MAIN_HAND);
        }
        else if (packetIn.getAnimationType() == 3)
        {
            EntityLivingBase entitylivingbase1 = (EntityLivingBase)entity;
            entitylivingbase1.swingArm(EnumHand.OFF_HAND);
        }
        else if (packetIn.getAnimationType() == 1)
        {
            entity.performHurtAnimation();
        }
        else if (packetIn.getAnimationType() == 2)
        {
            EntityPlayer entityplayer = (EntityPlayer)entity;
            entityplayer.wakeUpPlayer(false, false, false);
        }
        else if (packetIn.getAnimationType() == 4)
        {
            this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT);
        }
        else if (packetIn.getAnimationType() == 5)
        {
            this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT_MAGIC);
        }
    }
}
项目:SettlerCraft    文件:EntitySettler.java   
public void onCriticalHit(Entity entityHit) {
    if(this.getWorld().isRemote) {
        Minecraft.getMinecraft().effectRenderer.emitParticleAtEntity(entityHit, EnumParticleTypes.CRIT);
    } else {
        WorldServer server = this.getServerWorld();
        if(server != null) {
            server.getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 4));
        }
    }
}
项目:SettlerCraft    文件:EntitySettler.java   
public void onEnchantmentCritical(Entity entityHit) {
    if(this.getWorld().isRemote) {
        Minecraft.getMinecraft().effectRenderer.emitParticleAtEntity(entityHit, EnumParticleTypes.CRIT_MAGIC);
    } else {
        WorldServer server = this.getServerWorld();
        if (server != null) {
            server.getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 5));
        }
    }
}
项目:ExpandedRailsMod    文件:EntityPlayerMP.java   
/**
 * Wake up the player if they're sleeping.
 */
public void wakeUpPlayer(boolean immediately, boolean updateWorldFlag, boolean setSpawn)
{
    if (this.isPlayerSleeping())
    {
        this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(this, 2));
    }

    super.wakeUpPlayer(immediately, updateWorldFlag, setSpawn);

    if (this.connection != null)
    {
        this.connection.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
    }
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
/**
 * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt
 * or receiving a critical hit by normal or magical means
 */
public void handleAnimation(SPacketAnimation packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());

    if (entity != null)
    {
        if (packetIn.getAnimationType() == 0)
        {
            EntityLivingBase entitylivingbase = (EntityLivingBase)entity;
            entitylivingbase.swingArm(EnumHand.MAIN_HAND);
        }
        else if (packetIn.getAnimationType() == 3)
        {
            EntityLivingBase entitylivingbase1 = (EntityLivingBase)entity;
            entitylivingbase1.swingArm(EnumHand.OFF_HAND);
        }
        else if (packetIn.getAnimationType() == 1)
        {
            entity.performHurtAnimation();
        }
        else if (packetIn.getAnimationType() == 2)
        {
            EntityPlayer entityplayer = (EntityPlayer)entity;
            entityplayer.wakeUpPlayer(false, false, false);
        }
        else if (packetIn.getAnimationType() == 4)
        {
            this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT);
        }
        else if (packetIn.getAnimationType() == 5)
        {
            this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT_MAGIC);
        }
    }
}
项目:dragon-mounts    文件:EntityTameableDragon.java   
@Override
public void swingArm(EnumHand hand) {
    // play eating sound
    playSound(getSoundManager().getAttackSound(), 1, 0.7f);

    // play attack animation
    if (worldObj instanceof WorldServer) {
        ((WorldServer) worldObj).getEntityTracker().sendToAllTrackingEntity(
                this, new SPacketAnimation(this, 0));
    }
}
项目:Zombe-Modpack    文件:EntityPlayerMP.java   
/**
 * Called when the entity is dealt a critical hit.
 */
public void onCriticalHit(Entity entityHit)
{
    this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 4));
}
项目:Zombe-Modpack    文件:EntityPlayerMP.java   
public void onEnchantmentCritical(Entity entityHit)
{
    this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 5));
}
项目:Backmemed    文件:EntityPlayerMP.java   
/**
 * Called when the entity is dealt a critical hit.
 */
public void onCriticalHit(Entity entityHit)
{
    this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 4));
}
项目:Backmemed    文件:EntityPlayerMP.java   
public void onEnchantmentCritical(Entity entityHit)
{
    this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 5));
}
项目:CustomWorldGen    文件:EntityPlayerMP.java   
/**
 * Called when the entity is dealt a critical hit.
 */
public void onCriticalHit(Entity entityHit)
{
    this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 4));
}
项目:CustomWorldGen    文件:EntityPlayerMP.java   
public void onEnchantmentCritical(Entity entityHit)
{
    this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 5));
}
项目:ExpandedRailsMod    文件:EntityPlayerMP.java   
/**
 * Called when the entity is dealt a critical hit.
 */
public void onCriticalHit(Entity entityHit)
{
    this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 4));
}
项目:ExpandedRailsMod    文件:EntityPlayerMP.java   
public void onEnchantmentCritical(Entity entityHit)
{
    this.getServerWorld().getEntityTracker().sendToTrackingAndSelf(this, new SPacketAnimation(entityHit, 5));
}
项目:Backmemed    文件:INetHandlerPlayClient.java   
/**
 * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt
 * or receiving a critical hit by normal or magical means
 */
void handleAnimation(SPacketAnimation packetIn);
项目:CustomWorldGen    文件:INetHandlerPlayClient.java   
/**
 * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt
 * or receiving a critical hit by normal or magical means
 */
void handleAnimation(SPacketAnimation packetIn);