Search in sources :

Example 11 with PacketPlayOutAnimation

use of net.minecraft.server.v1_13_R1.PacketPlayOutAnimation in project Citizens2 by CitizensDev.

the class PlayerAnimationImpl method playDefaultAnimation.

protected static void playDefaultAnimation(EntityPlayer player, int radius, int code) {
    PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, code);
    sendPacketNearby(packet, player, radius);
}
Also used : PacketPlayOutAnimation(net.minecraft.server.v1_11_R1.PacketPlayOutAnimation)

Example 12 with PacketPlayOutAnimation

use of net.minecraft.server.v1_13_R1.PacketPlayOutAnimation in project Citizens2 by CitizensDev.

the class PlayerAnimationImpl method playDefaultAnimation.

protected static void playDefaultAnimation(EntityPlayer player, int radius, int code) {
    PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, code);
    sendPacketNearby(packet, player, radius);
}
Also used : PacketPlayOutAnimation(net.minecraft.server.v1_8_R3.PacketPlayOutAnimation)

Example 13 with PacketPlayOutAnimation

use of net.minecraft.server.v1_13_R1.PacketPlayOutAnimation in project solinia3-core by mixxit.

the class EntityUtils method PSetHPChange.

public static void PSetHPChange(LivingEntity targetToDamage, Double hpchange, LivingEntity sourceEntityOfChange, boolean playHurtSound) {
    if (targetToDamage instanceof ArmorStand || sourceEntityOfChange instanceof ArmorStand)
        return;
    if (hpchange == 0)
        return;
    // This will check both their invulnerability from minecraft and godmode from essentials
    if (hpchange < 0 && EntityUtils.IsInvulnerable(targetToDamage))
        return;
    float cur_hp = ((EntityLiving) ((CraftLivingEntity) targetToDamage).getHandle()).getHealth();
    float max_hp = ((EntityLiving) ((CraftLivingEntity) targetToDamage).getHandle()).getMaxHealth();
    float hp = cur_hp + hpchange.floatValue();
    if (hp >= max_hp)
        cur_hp = max_hp;
    else
        cur_hp = hp;
    ((EntityLiving) ((CraftLivingEntity) targetToDamage).getHandle()).setHealth(cur_hp);
    float soundVolume = 1.0F;
    if (hpchange < 0) {
        DamageSource damagesource = net.minecraft.server.v1_15_R1.DamageSource.mobAttack(((EntityLiving) ((CraftLivingEntity) sourceEntityOfChange).getHandle()));
        DamageCause damagecause = DamageCause.ENTITY_ATTACK;
        EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(sourceEntityOfChange, targetToDamage, damagecause, hpchange);
        ((CraftLivingEntity) targetToDamage).setLastDamage(hpchange.doubleValue());
        ((CraftLivingEntity) targetToDamage).setLastDamageCause(event);
        ((CraftLivingEntity) targetToDamage).setNoDamageTicks(20);
        ((EntityLiving) ((CraftLivingEntity) targetToDamage).getHandle()).hurtDuration = 10;
        ((EntityLiving) ((CraftLivingEntity) targetToDamage).getHandle()).hurtTicks = ((EntityLiving) ((CraftLivingEntity) targetToDamage).getHandle()).hurtDuration;
        ((EntityLiving) ((CraftLivingEntity) targetToDamage).getHandle()).getCombatTracker().trackDamage(damagesource, cur_hp, hpchange.floatValue());
        if (((EntityLiving) ((CraftLivingEntity) targetToDamage).getHandle()).getHealth() <= 0.0F) {
            targetToDamage.getWorld().playSound(targetToDamage.getLocation(), Sound.ENTITY_GENERIC_DEATH, soundVolume, GetSoundPitch(((EntityLiving) ((CraftLivingEntity) targetToDamage).getHandle())));
            ((EntityLiving) ((CraftLivingEntity) targetToDamage).getHandle()).die(damagesource);
        } else {
            if (targetToDamage instanceof Player) {
                PacketPlayOutAnimation packet = new PacketPlayOutAnimation(((CraftPlayer) targetToDamage).getHandle(), 1);
                ((CraftPlayer) targetToDamage).getHandle().playerConnection.sendPacket(packet);
            }
            if (playHurtSound)
                targetToDamage.getWorld().playSound(targetToDamage.getLocation(), Sound.ENTITY_GENERIC_HURT, soundVolume, GetSoundPitch(((EntityLiving) ((CraftLivingEntity) targetToDamage).getHandle())));
        }
    }
}
Also used : Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer) EntityPlayer(net.minecraft.server.v1_15_R1.EntityPlayer) ArmorStand(org.bukkit.entity.ArmorStand) EntityLiving(net.minecraft.server.v1_15_R1.EntityLiving) DamageSource(net.minecraft.server.v1_15_R1.DamageSource) EntityDamageByEntityEvent(org.bukkit.event.entity.EntityDamageByEntityEvent) CraftLivingEntity(org.bukkit.craftbukkit.v1_15_R1.entity.CraftLivingEntity) CraftPlayer(org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer) DamageCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause) PacketPlayOutAnimation(net.minecraft.server.v1_15_R1.PacketPlayOutAnimation)

Example 14 with PacketPlayOutAnimation

use of net.minecraft.server.v1_13_R1.PacketPlayOutAnimation in project Citizens2 by CitizensDev.

the class PlayerlistTrackerEntry method updateLastPlayer.

public void updateLastPlayer() {
    if (lastUpdatedPlayer == null)
        return;
    final Entity tracker = getTracker(this);
    final EntityPlayer entityplayer = lastUpdatedPlayer;
    NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
    lastUpdatedPlayer = null;
    if (!Setting.DISABLE_TABLIST.asBoolean())
        return;
    Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {

        @Override
        public void run() {
            NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new PacketPlayOutAnimation(tracker, 0));
            NMS.sendTabListRemove(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
        }
    }, Setting.TABLIST_REMOVE_PACKET_DELAY.asInt());
}
Also used : Entity(net.minecraft.server.v1_8_R3.Entity) Player(org.bukkit.entity.Player) EntityPlayer(net.minecraft.server.v1_8_R3.EntityPlayer) EntityPlayer(net.minecraft.server.v1_8_R3.EntityPlayer) PacketPlayOutAnimation(net.minecraft.server.v1_8_R3.PacketPlayOutAnimation)

Example 15 with PacketPlayOutAnimation

use of net.minecraft.server.v1_13_R1.PacketPlayOutAnimation in project Citizens2 by CitizensDev.

the class PlayerlistTracker method updateLastPlayer.

public void updateLastPlayer() {
    if (tracker.dead)
        return;
    final EntityPlayer entityplayer = lastUpdatedPlayer;
    if (entityplayer == null)
        return;
    NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
    if (!Setting.DISABLE_TABLIST.asBoolean())
        return;
    Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {

        @Override
        public void run() {
            NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new PacketPlayOutAnimation(tracker, 0));
            NMS.sendTabListRemove(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
        }
    }, Setting.TABLIST_REMOVE_PACKET_DELAY.asInt());
}
Also used : Player(org.bukkit.entity.Player) EntityPlayer(net.minecraft.server.v1_16_R3.EntityPlayer) EntityPlayer(net.minecraft.server.v1_16_R3.EntityPlayer) PacketPlayOutAnimation(net.minecraft.server.v1_16_R3.PacketPlayOutAnimation)

Aggregations

PacketPlayOutAnimation (net.minecraft.server.v1_8_R3.PacketPlayOutAnimation)9 CraftPlayer (org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer)7 PacketPlayOutAnimation (net.minecraft.server.v1_16_R3.PacketPlayOutAnimation)4 WarlordsPlayer (com.ebicep.warlords.player.WarlordsPlayer)3 GameRunnable (com.ebicep.warlords.util.warlords.GameRunnable)3 PacketPlayOutAnimation (net.minecraft.server.v1_15_R1.PacketPlayOutAnimation)3 Location (org.bukkit.Location)3 Player (org.bukkit.entity.Player)3 ItemStack (org.bukkit.inventory.ItemStack)3 PacketPlayOutAnimation (net.minecraft.server.v1_10_R1.PacketPlayOutAnimation)2 PacketPlayOutAnimation (net.minecraft.server.v1_11_R1.PacketPlayOutAnimation)2 PacketPlayOutAnimation (net.minecraft.server.v1_12_R1.PacketPlayOutAnimation)2 PacketPlayOutAnimation (net.minecraft.server.v1_13_R2.PacketPlayOutAnimation)2 PacketPlayOutAnimation (net.minecraft.server.v1_14_R1.PacketPlayOutAnimation)2 EntityPlayer (net.minecraft.server.v1_15_R1.EntityPlayer)2 EntityPlayer (net.minecraft.server.v1_16_R3.EntityPlayer)2 EntityPlayer (net.minecraft.server.v1_8_R3.EntityPlayer)2 CraftPlayer (org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer)2 ArmorStand (org.bukkit.entity.ArmorStand)2 CooldownFilter (com.ebicep.warlords.player.cooldowns.CooldownFilter)1