Search in sources :

Example 21 with EntityPlayer

use of net.minecraft.server.v1_12_R1.EntityPlayer in project Citizens2 by CitizensDev.

the class PlayerlistTrackerEntry method updatePlayer.

@Override
public void updatePlayer(final EntityPlayer entityplayer) {
    // prevent updates to NPC "viewers"
    if (entityplayer instanceof EntityHumanNPC)
        return;
    Entity tracker = getTracker(this);
    if (entityplayer != tracker && c(entityplayer)) {
        if (!this.trackedPlayers.contains(entityplayer) && ((entityplayer.u().getPlayerChunkMap().a(entityplayer, tracker.ae, tracker.ag)) || (tracker.attachedToPlayer))) {
            if ((tracker instanceof SkinnableEntity)) {
                SkinnableEntity skinnable = (SkinnableEntity) tracker;
                Player player = skinnable.getBukkitEntity();
                if (!entityplayer.getBukkitEntity().canSee(player))
                    return;
                skinnable.getSkinTracker().updateViewer(entityplayer.getBukkitEntity());
            }
        }
    }
    super.updatePlayer(entityplayer);
}
Also used : SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) Entity(net.minecraft.server.v1_8_R3.Entity) Player(org.bukkit.entity.Player) EntityPlayer(net.minecraft.server.v1_8_R3.EntityPlayer) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) EntityHumanNPC(net.citizensnpcs.nms.v1_8_R3.entity.EntityHumanNPC)

Example 22 with EntityPlayer

use of net.minecraft.server.v1_12_R1.EntityPlayer in project Citizens2 by CitizensDev.

the class NMSImpl method attack.

@Override
public void attack(LivingEntity attacker, LivingEntity btarget) {
    EntityLiving handle = getHandle(attacker);
    EntityLiving target = getHandle(btarget);
    if (handle instanceof EntityPlayer) {
        EntityPlayer humanHandle = (EntityPlayer) handle;
        humanHandle.attack(target);
        PlayerAnimation.ARM_SWING.play(humanHandle.getBukkitEntity());
        return;
    }
    AttributeInstance attackDamage = handle.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE);
    float f = (float) (attackDamage == null ? 1 : attackDamage.getValue());
    int i = 0;
    if (target instanceof EntityLiving) {
        f += EnchantmentManager.a(handle.getItemInMainHand(), target.getMonsterType());
        i += EnchantmentManager.a(Enchantments.KNOCKBACK, handle);
    }
    boolean flag = target.damageEntity(DamageSource.mobAttack(handle), f);
    if (!flag)
        return;
    if (i > 0) {
        target.f(-Math.sin(handle.yaw * Math.PI / 180.0F) * i * 0.5F, 0.1D, Math.cos(handle.yaw * Math.PI / 180.0F) * i * 0.5F);
        handle.motX *= 0.6D;
        handle.motZ *= 0.6D;
    }
    int fireAspectLevel = EnchantmentManager.getFireAspectEnchantmentLevel(handle);
    if (fireAspectLevel > 0) {
        target.setOnFire(fireAspectLevel * 4);
    }
}
Also used : EntityLiving(net.minecraft.server.v1_11_R1.EntityLiving) AttributeInstance(net.minecraft.server.v1_11_R1.AttributeInstance) EntityPlayer(net.minecraft.server.v1_11_R1.EntityPlayer) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Example 23 with EntityPlayer

use of net.minecraft.server.v1_12_R1.EntityPlayer in project Citizens2 by CitizensDev.

the class NMSImpl method sendTabListAdd.

@Override
public void sendTabListAdd(Player recipient, Player listPlayer) {
    Preconditions.checkNotNull(recipient);
    Preconditions.checkNotNull(listPlayer);
    EntityPlayer entity = ((CraftPlayer) listPlayer).getHandle();
    NMSImpl.sendPacket(recipient, new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, entity));
}
Also used : EntityPlayer(net.minecraft.server.v1_11_R1.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer) PacketPlayOutPlayerInfo(net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo)

Example 24 with EntityPlayer

use of net.minecraft.server.v1_12_R1.EntityPlayer in project Citizens2 by CitizensDev.

the class NMSImpl method sendTabListRemove.

@Override
public void sendTabListRemove(Player recipient, Player listPlayer) {
    Preconditions.checkNotNull(recipient);
    Preconditions.checkNotNull(listPlayer);
    EntityPlayer entity = ((CraftPlayer) listPlayer).getHandle();
    NMSImpl.sendPacket(recipient, new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, entity));
}
Also used : EntityPlayer(net.minecraft.server.v1_11_R1.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer) PacketPlayOutPlayerInfo(net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo)

Example 25 with EntityPlayer

use of net.minecraft.server.v1_12_R1.EntityPlayer in project Citizens2 by CitizensDev.

the class NMSImpl method removeFromServerPlayerList.

@Override
public void removeFromServerPlayerList(Player player) {
    EntityPlayer handle = (EntityPlayer) NMSImpl.getHandle(player);
    ((CraftServer) Bukkit.getServer()).getHandle().players.remove(handle);
}
Also used : EntityPlayer(net.minecraft.server.v1_11_R1.EntityPlayer) CraftServer(org.bukkit.craftbukkit.v1_11_R1.CraftServer)

Aggregations

Player (org.bukkit.entity.Player)25 MyPet (de.Keyle.MyPet.api.entity.MyPet)16 EntityPlayer (net.minecraft.server.v1_8_R3.EntityPlayer)16 EntityPlayer (net.minecraft.server.v1_12_R1.EntityPlayer)13 EntityPlayer (net.minecraft.server.v1_10_R1.EntityPlayer)12 EntityPlayer (net.minecraft.server.v1_11_R1.EntityPlayer)12 Behavior (de.Keyle.MyPet.api.skill.skills.Behavior)11 CraftPlayer (org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer)9 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)9 NPC (net.citizensnpcs.api.npc.NPC)8 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)8 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)8 Behavior (de.Keyle.MyPet.skill.skills.Behavior)6 EntityPlayer (net.minecraft.server.v1_9_R2.EntityPlayer)6 CraftPlayer (org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer)6 CraftPlayer (org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer)6 CraftPlayer (org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer)6 CraftPlayer (org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer)5 UUID (java.util.UUID)4 PacketPlayOutPlayerInfo (net.minecraft.server.v1_10_R1.PacketPlayOutPlayerInfo)4