Search in sources :

Example 1 with MCEntity

use of com.laytonsmith.abstraction.MCEntity in project CommandHelper by EngineHub.

the class BukkitEntityListener method onTargetLiving.

@EventIdentifier(event = Driver.TARGET_ENTITY, className = "org.bukkit.event.entity.EntityTargetEvent")
public void onTargetLiving(Event event) {
    BukkitMCTargetEvent ete = new BukkitMCTargetEvent(event);
    MCEntity target = ete.getTarget();
    if (target == null || !(target instanceof MCPlayer)) {
        return;
    }
    EventUtils.TriggerListener(Driver.TARGET_ENTITY, "target_player", ete);
}
Also used : MCEntity(com.laytonsmith.abstraction.MCEntity) MCPlayer(com.laytonsmith.abstraction.MCPlayer) EventIdentifier(com.laytonsmith.annotations.EventIdentifier)

Example 2 with MCEntity

use of com.laytonsmith.abstraction.MCEntity in project CommandHelper by EngineHub.

the class BukkitMCEntity method getNearbyEntities.

@Override
public List<MCEntity> getNearbyEntities(double x, double y, double z) {
    List<Entity> lst = e.getNearbyEntities(x, y, z);
    List<MCEntity> retn = new ArrayList<>();
    for (Entity e : lst) {
        retn.add(BukkitConvertor.BukkitGetCorrectEntity(e));
    }
    return retn;
}
Also used : MCLivingEntity(com.laytonsmith.abstraction.MCLivingEntity) Entity(org.bukkit.entity.Entity) LivingEntity(org.bukkit.entity.LivingEntity) MCEntity(com.laytonsmith.abstraction.MCEntity) MCEntity(com.laytonsmith.abstraction.MCEntity) ArrayList(java.util.ArrayList)

Example 3 with MCEntity

use of com.laytonsmith.abstraction.MCEntity in project CommandHelper by EngineHub.

the class BukkitMCBlockProjectileSource method launchProjectile.

@Override
public MCProjectile launchProjectile(MCProjectileType projectile, Vector3D init) {
    EntityType et = EntityType.valueOf(projectile.name());
    Class<? extends Entity> c = et.getEntityClass();
    Vector vector = new Vector(init.X(), init.Y(), init.Z());
    Projectile proj = bps.launchProjectile(c.asSubclass(Projectile.class), vector);
    MCEntity e = BukkitConvertor.BukkitGetCorrectEntity(proj);
    if (e instanceof MCProjectile) {
        return (MCProjectile) e;
    } else {
        return null;
    }
}
Also used : EntityType(org.bukkit.entity.EntityType) MCEntity(com.laytonsmith.abstraction.MCEntity) Vector(org.bukkit.util.Vector) Projectile(org.bukkit.entity.Projectile) MCProjectile(com.laytonsmith.abstraction.MCProjectile) MCProjectile(com.laytonsmith.abstraction.MCProjectile)

Example 4 with MCEntity

use of com.laytonsmith.abstraction.MCEntity in project CommandHelper by EngineHub.

the class BukkitMCEntityProjectileSource method launchProjectile.

@Override
public MCProjectile launchProjectile(MCProjectileType projectile, Vector3D init) {
    EntityType et = EntityType.valueOf(projectile.name());
    Class<? extends Entity> c = et.getEntityClass();
    Vector vector = new Vector(init.X(), init.Y(), init.Z());
    Projectile proj = eps.launchProjectile(c.asSubclass(Projectile.class), vector);
    MCEntity mcproj = BukkitConvertor.BukkitGetCorrectEntity(proj);
    if (mcproj instanceof MCProjectile) {
        return (MCProjectile) mcproj;
    } else {
        return null;
    }
}
Also used : EntityType(org.bukkit.entity.EntityType) MCEntity(com.laytonsmith.abstraction.MCEntity) Vector(org.bukkit.util.Vector) Projectile(org.bukkit.entity.Projectile) MCProjectile(com.laytonsmith.abstraction.MCProjectile) MCProjectile(com.laytonsmith.abstraction.MCProjectile)

Example 5 with MCEntity

use of com.laytonsmith.abstraction.MCEntity in project CommandHelper by EngineHub.

the class BukkitMCEntityProjectileSource method launchProjectile.

@Override
public MCProjectile launchProjectile(MCProjectileType projectile) {
    EntityType et = EntityType.valueOf(projectile.name());
    Class<? extends Entity> c = et.getEntityClass();
    Projectile proj = eps.launchProjectile(c.asSubclass(Projectile.class));
    MCEntity mcproj = BukkitConvertor.BukkitGetCorrectEntity(proj);
    if (mcproj instanceof MCProjectile) {
        return (MCProjectile) mcproj;
    } else {
        return null;
    }
}
Also used : EntityType(org.bukkit.entity.EntityType) MCEntity(com.laytonsmith.abstraction.MCEntity) Projectile(org.bukkit.entity.Projectile) MCProjectile(com.laytonsmith.abstraction.MCProjectile) MCProjectile(com.laytonsmith.abstraction.MCProjectile)

Aggregations

MCEntity (com.laytonsmith.abstraction.MCEntity)10 MCProjectile (com.laytonsmith.abstraction.MCProjectile)5 EntityType (org.bukkit.entity.EntityType)4 Projectile (org.bukkit.entity.Projectile)4 Entity (org.bukkit.entity.Entity)3 MCLocation (com.laytonsmith.abstraction.MCLocation)2 MCPlayer (com.laytonsmith.abstraction.MCPlayer)2 BukkitMCEntity (com.laytonsmith.abstraction.bukkit.entities.BukkitMCEntity)2 ArrayList (java.util.ArrayList)2 LivingEntity (org.bukkit.entity.LivingEntity)2 Vector (org.bukkit.util.Vector)2 MCInventory (com.laytonsmith.abstraction.MCInventory)1 MCLivingEntity (com.laytonsmith.abstraction.MCLivingEntity)1 MCProjectileSource (com.laytonsmith.abstraction.MCProjectileSource)1 MCBlockProjectileSource (com.laytonsmith.abstraction.blocks.MCBlockProjectileSource)1 BukkitMCComplexLivingEntity (com.laytonsmith.abstraction.bukkit.entities.BukkitMCComplexLivingEntity)1 BukkitMCHumanEntity (com.laytonsmith.abstraction.bukkit.entities.BukkitMCHumanEntity)1 BukkitMCLivingEntity (com.laytonsmith.abstraction.bukkit.entities.BukkitMCLivingEntity)1 MCEntityDamageByEntityEvent (com.laytonsmith.abstraction.events.MCEntityDamageByEntityEvent)1 EventIdentifier (com.laytonsmith.annotations.EventIdentifier)1