Java 类net.minecraft.server.EntityLiving 实例源码

项目:CraftBukkit    文件:CraftEventFactory.java   
public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim, List<org.bukkit.inventory.ItemStack> drops) {
    CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
    EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward());
    CraftWorld world = (CraftWorld) entity.getWorld();
    Bukkit.getServer().getPluginManager().callEvent(event);

    victim.expToDrop = event.getDroppedExp();

    for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
        if (stack == null || stack.getType() == Material.AIR || stack.getAmount() == 0) continue;

        world.dropItemNaturally(entity.getLocation(), stack);
    }

    return event;
}
项目:Almura-Server    文件:CraftEventFactory.java   
public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim, List<org.bukkit.inventory.ItemStack> drops) {
    CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
    EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward());
    org.bukkit.World world = entity.getWorld();
    Bukkit.getServer().getPluginManager().callEvent(event);

    victim.expToDrop = event.getDroppedExp();

    for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
        if (stack == null || stack.getType() == Material.AIR) continue;

        world.dropItemNaturally(entity.getLocation(), stack);
    }

    return event;
}
项目:Tweakkit-Server    文件:CraftEventFactory.java   
public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim, List<org.bukkit.inventory.ItemStack> drops) {
    CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
    EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward());
    CraftWorld world = (CraftWorld) entity.getWorld();
    Bukkit.getServer().getPluginManager().callEvent(event);

    victim.expToDrop = event.getDroppedExp();

    for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
        if (stack == null || stack.getType() == Material.AIR || stack.getAmount() == 0) continue;

        world.dropItemNaturally(entity.getLocation(), stack);
    }

    return event;
}
项目:Craft-city    文件:CraftEventFactory.java   
public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim, List<org.bukkit.inventory.ItemStack> drops) {
    CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
    EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward());
    org.bukkit.World world = entity.getWorld();
    Bukkit.getServer().getPluginManager().callEvent(event);

    victim.expToDrop = event.getDroppedExp();

    for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
        if (stack == null || stack.getType() == Material.AIR) continue;

        world.dropItemNaturally(entity.getLocation(), stack);
    }

    return event;
}
项目:ProjectAres    文件:NMSHacks.java   
public static void playDeathAnimation(Player player) {
    EntityPlayer handle = ((CraftPlayer) player).getHandle();
    PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), false);

    // Add/replace health to zero
    boolean replaced = false;
    DataWatcher.Item<Float> zeroHealth = new DataWatcher.Item<>(EntityPlayer.class, EntityLiving.HEALTH, 0f);

    if(packet.b != null) {
        for(int i = 0; i < packet.b.size(); i++) {
            DataWatcher.Item<?> item = packet.b.get(i);
            if(EntityLiving.HEALTH.equals(item.a())) {
                packet.b.set(i, zeroHealth);
                replaced = true;
            }
        }
    }

    if(!replaced) {
        if(packet.b == null) {
            packet.b = Collections.singletonList(zeroHealth);
        } else {
            packet.b.add(zeroHealth);
        }
    }

    sendPacketToViewers(player, packet);
}
项目:CraftBukkit    文件:CraftProjectile.java   
public void setShooter(ProjectileSource shooter) {
    if (shooter instanceof CraftLivingEntity) {
        getHandle().shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
        if (shooter instanceof CraftHumanEntity) {
            getHandle().shooterName = ((CraftHumanEntity) shooter).getName();
        }
    } else {
        getHandle().shooter = null;
        getHandle().shooterName = null;
    }
    getHandle().projectileSource = shooter;
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
    super(server, entity);

    if (entity instanceof EntityInsentient) {
        equipment = new CraftEntityEquipment(this);
    }
}
项目:CraftBukkit    文件:CraftTNTPrimed.java   
public Entity getSource() {
    EntityLiving source = getHandle().getSource();

    if (source != null) {
        Entity bukkitEntity = source.getBukkitEntity();

        if (bukkitEntity.isValid()) {
            return bukkitEntity;
        }
    }

    return null;
}
项目:CraftBukkit    文件:CraftEventFactory.java   
/**
 * EntityShootBowEvent
 */
public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, EntityArrow entityArrow, float force) {
    LivingEntity shooter = (LivingEntity) who.getBukkitEntity();
    CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
    Arrow arrow = (Arrow) entityArrow.getBukkitEntity();

    if (itemInHand != null && (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0)) {
        itemInHand = null;
    }

    EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, arrow, force);
    Bukkit.getPluginManager().callEvent(event);

    return event;
}
项目:CraftBukkit    文件:CraftEventFactory.java   
/**
 * CreatureSpawnEvent
 */
public static CreatureSpawnEvent callCreatureSpawnEvent(EntityLiving entityliving, SpawnReason spawnReason) {
    LivingEntity entity = (LivingEntity) entityliving.getBukkitEntity();
    CraftServer craftServer = (CraftServer) entity.getServer();

    CreatureSpawnEvent event = new CreatureSpawnEvent(entity, spawnReason);
    craftServer.getPluginManager().callEvent(event);
    return event;
}
项目:Craftbukkit    文件:CraftProjectile.java   
public void setShooter(ProjectileSource shooter) {
    if (shooter instanceof CraftLivingEntity) {
        getHandle().shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
        if (shooter instanceof CraftHumanEntity) {
            getHandle().shooterName = ((CraftHumanEntity) shooter).getName();
        }
    } else {
        getHandle().shooter = null;
        getHandle().shooterName = null;
    }
    getHandle().projectileSource = shooter;
}
项目:Craftbukkit    文件:CraftLivingEntity.java   
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
    super(server, entity);

    if (entity instanceof EntityInsentient || entity instanceof EntityArmorStand) {
        equipment = new CraftEntityEquipment(this);
    }
}
项目:Craftbukkit    文件:CraftTNTPrimed.java   
public Entity getSource() {
    EntityLiving source = getHandle().getSource();

    if (source != null) {
        Entity bukkitEntity = source.getBukkitEntity();

        if (bukkitEntity.isValid()) {
            return bukkitEntity;
        }
    }

    return null;
}
项目:Almura-Server    文件:CraftProjectile.java   
public void setShooter(LivingEntity shooter) {
    if (shooter instanceof CraftLivingEntity) {
        getHandle().shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
        if (shooter instanceof CraftHumanEntity) {
            getHandle().shooterName = ((CraftHumanEntity) shooter).getName();
        }
    }
}
项目:Almura-Server    文件:CraftLivingEntity.java   
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
    super(server, entity);

    if (entity instanceof EntityInsentient) {
        equipment = new CraftEntityEquipment(this);
    }
}
项目:Almura-Server    文件:CraftTNTPrimed.java   
public Entity getSource() {
    EntityLiving source = getHandle().getSource();

    if (source != null) {
        Entity bukkitEntity = source.getBukkitEntity();

        if (bukkitEntity.isValid()) {
            return bukkitEntity;
        }
    }

    return null;
}
项目:Almura-Server    文件:CraftEventFactory.java   
/**
 * EntityShootBowEvent
 */
public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, EntityArrow entityArrow, float force) {
    LivingEntity shooter = (LivingEntity) who.getBukkitEntity();
    CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
    Arrow arrow = (Arrow) entityArrow.getBukkitEntity();

    if (itemInHand != null && (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0)) {
        itemInHand = null;
    }

    EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, arrow, force);
    Bukkit.getPluginManager().callEvent(event);

    return event;
}
项目:Almura-Server    文件:CraftEventFactory.java   
/**
 * CreatureSpawnEvent
 */
public static CreatureSpawnEvent callCreatureSpawnEvent(EntityLiving entityliving, SpawnReason spawnReason) {
    LivingEntity entity = (LivingEntity) entityliving.getBukkitEntity();
    CraftServer craftServer = (CraftServer) entity.getServer();

    CreatureSpawnEvent event = new CreatureSpawnEvent(entity, spawnReason);
    craftServer.getPluginManager().callEvent(event);
    return event;
}
项目:Tweakkit-Server    文件:CraftProjectile.java   
public void setShooter(ProjectileSource shooter) {
    if (shooter instanceof CraftLivingEntity) {
        getHandle().shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
        if (shooter instanceof CraftHumanEntity) {
            getHandle().shooterName = ((CraftHumanEntity) shooter).getName();
        }
    } else {
        getHandle().shooter = null;
        getHandle().shooterName = null;
    }
    getHandle().projectileSource = shooter;
}
项目:Tweakkit-Server    文件:CraftLivingEntity.java   
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
    super(server, entity);

    if (entity instanceof EntityInsentient) {
        equipment = new CraftEntityEquipment(this);
    }
}
项目:Tweakkit-Server    文件:CraftTNTPrimed.java   
public Entity getSource() {
    EntityLiving source = getHandle().getSource();

    if (source != null) {
        Entity bukkitEntity = source.getBukkitEntity();

        if (bukkitEntity.isValid()) {
            return bukkitEntity;
        }
    }

    return null;
}
项目:Tweakkit-Server    文件:CraftEventFactory.java   
/**
 * EntityShootBowEvent
 */
public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, EntityArrow entityArrow, float force) {
    LivingEntity shooter = (LivingEntity) who.getBukkitEntity();
    CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
    Arrow arrow = (Arrow) entityArrow.getBukkitEntity();

    if (itemInHand != null && (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0)) {
        itemInHand = null;
    }

    EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, arrow, force);
    Bukkit.getPluginManager().callEvent(event);

    return event;
}
项目:Tweakkit-Server    文件:CraftEventFactory.java   
/**
 * CreatureSpawnEvent
 */
public static CreatureSpawnEvent callCreatureSpawnEvent(EntityLiving entityliving, SpawnReason spawnReason) {
    LivingEntity entity = (LivingEntity) entityliving.getBukkitEntity();
    CraftServer craftServer = (CraftServer) entity.getServer();

    CreatureSpawnEvent event = new CreatureSpawnEvent(entity, spawnReason);
    craftServer.getPluginManager().callEvent(event);
    return event;
}
项目:SpigotSource    文件:CraftProjectile.java   
public void setShooter(ProjectileSource shooter) {
    if (shooter instanceof CraftLivingEntity) {
        getHandle().shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
        if (shooter instanceof CraftHumanEntity) {
            getHandle().shooterName = ((CraftHumanEntity) shooter).getName();
        }
    } else {
        getHandle().shooter = null;
        getHandle().shooterName = null;
    }
    getHandle().projectileSource = shooter;
}
项目:SpigotSource    文件:CraftLivingEntity.java   
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
    super(server, entity);

    if (entity instanceof EntityInsentient || entity instanceof EntityArmorStand) {
        equipment = new CraftEntityEquipment(this);
    }
}
项目:SpigotSource    文件:CraftTNTPrimed.java   
public Entity getSource() {
    EntityLiving source = getHandle().getSource();

    if (source != null) {
        Entity bukkitEntity = source.getBukkitEntity();

        if (bukkitEntity.isValid()) {
            return bukkitEntity;
        }
    }

    return null;
}
项目:SpigotSource    文件:CraftAreaEffectCloud.java   
public void setSource(ProjectileSource shooter) {
    if (shooter instanceof CraftLivingEntity) {
        getHandle().setSource((EntityLiving) ((CraftLivingEntity) shooter).getHandle());
    } else {
        getHandle().setSource((EntityLiving) null);
    }
    getHandle().projectileSource = shooter;
}
项目:Craft-city    文件:CraftProjectile.java   
public void setShooter(LivingEntity shooter) {
    if (shooter instanceof CraftLivingEntity) {
        getHandle().shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
        if (shooter instanceof CraftHumanEntity) {
            getHandle().shooterName = ((CraftHumanEntity) shooter).getName();
        }
    }
}
项目:Craft-city    文件:CraftLivingEntity.java   
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
    super(server, entity);

    if (!(this instanceof HumanEntity)) {
        equipment = new CraftEntityEquipment(this);
    }
}
项目:Craft-city    文件:CraftTNTPrimed.java   
public Entity getSource() {
    EntityLiving source = getHandle().getSource();

    if (source != null) {
        Entity bukkitEntity = source.getBukkitEntity();

        if (bukkitEntity.isValid()) {
            return bukkitEntity;
        }
    }

    return null;
}
项目:Craft-city    文件:CraftEventFactory.java   
/**
 * EntityShootBowEvent
 */
public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, EntityArrow entityArrow, float force) {
    LivingEntity shooter = (LivingEntity) who.getBukkitEntity();
    CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
    Arrow arrow = (Arrow) entityArrow.getBukkitEntity();

    if (itemInHand != null && (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0)) {
        itemInHand = null;
    }

    EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, arrow, force);
    Bukkit.getPluginManager().callEvent(event);

    return event;
}
项目:Craft-city    文件:CraftEventFactory.java   
/**
 * CreatureSpawnEvent
 */
public static CreatureSpawnEvent callCreatureSpawnEvent(EntityLiving entityliving, SpawnReason spawnReason) {
    LivingEntity entity = (LivingEntity) entityliving.getBukkitEntity();
    CraftServer craftServer = (CraftServer) entity.getServer();

    CreatureSpawnEvent event = new CreatureSpawnEvent(entity, spawnReason);
    craftServer.getPluginManager().callEvent(event);
    return event;
}
项目:Craft-city    文件:CraftEventFactory.java   
/**
 * EntityTameEvent
 */
public static EntityTameEvent callEntityTameEvent(EntityLiving entity, EntityHuman tamer) {
    org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
    org.bukkit.entity.AnimalTamer bukkitTamer = (tamer != null ? tamer.getBukkitEntity() : null);
    CraftServer craftServer = (CraftServer) bukkitEntity.getServer();

    entity.persistent = true;

    EntityTameEvent event = new EntityTameEvent((LivingEntity) bukkitEntity, bukkitTamer);
    craftServer.getPluginManager().callEvent(event);
    return event;
}
项目:CraftBukkit    文件:CraftCreature.java   
public CraftLivingEntity getTarget() {
    if (getHandle().target == null) return null;
    if (!(getHandle().target instanceof EntityLiving)) return null;

    return (CraftLivingEntity) getHandle().target.getBukkitEntity();
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
@Override
public EntityLiving getHandle() {
    return (EntityLiving) entity;
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public void setHandle(final EntityLiving entity) {
    super.setHandle(entity);
}
项目:CraftBukkit    文件:CraftComplexLivingEntity.java   
public CraftComplexLivingEntity(CraftServer server, EntityLiving entity) {
    super(server, entity);
}
项目:CraftBukkit    文件:CraftComplexLivingEntity.java   
@Override
public EntityLiving getHandle() {
    return (EntityLiving) entity;
}
项目:CraftBukkit    文件:CraftEventFactory.java   
public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim) {
    return callEntityDeathEvent(victim, new ArrayList<org.bukkit.inventory.ItemStack>(0));
}
项目:CraftBukkit    文件:CraftEventFactory.java   
public static EntityTargetLivingEntityEvent callEntityTargetLivingEvent(Entity entity, EntityLiving target, EntityTargetEvent.TargetReason reason) {
    EntityTargetLivingEntityEvent event = new EntityTargetLivingEntityEvent(entity.getBukkitEntity(), (LivingEntity) target.getBukkitEntity(), reason);
    entity.getBukkitEntity().getServer().getPluginManager().callEvent(event);
    return event;
}