Search in sources :

Example 71 with Entity

use of net.minecraft.server.v1_11_R1.Entity in project Citizens2 by CitizensDev.

the class EggController method createEntity.

@Override
protected Entity createEntity(Location at, NPC npc) {
    WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
    final EntityEggNPC handle = new EntityEggNPC(ws, npc, at.getX(), at.getY(), at.getZ());
    return handle.getBukkitEntity();
}
Also used : WorldServer(net.minecraft.server.v1_11_R1.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Example 72 with Entity

use of net.minecraft.server.v1_11_R1.Entity in project Citizens2 by CitizensDev.

the class NMSImpl method getVehicle.

@Override
public org.bukkit.entity.Entity getVehicle(org.bukkit.entity.Entity entity) {
    Entity handle = NMSImpl.getHandle(entity);
    if (handle == null) {
        return null;
    }
    Entity e = handle.vehicle;
    return (e == handle || e == null) ? null : e.getBukkitEntity();
}
Also used : PathEntity(net.minecraft.server.v1_8_R3.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) Entity(net.minecraft.server.v1_8_R3.Entity) CraftEntity(org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity)

Example 73 with Entity

use of net.minecraft.server.v1_11_R1.Entity in project Citizens2 by CitizensDev.

the class NMSImpl method updateNavigationWorld.

@Override
public void updateNavigationWorld(org.bukkit.entity.Entity entity, World world) {
    if (NAVIGATION_WORLD_FIELD == null)
        return;
    Entity en = NMSImpl.getHandle(entity);
    if (en == null || !(en instanceof EntityInsentient))
        return;
    EntityInsentient handle = (EntityInsentient) en;
    WorldServer worldHandle = ((CraftWorld) world).getHandle();
    try {
        NAVIGATION_WORLD_FIELD.set(handle.getNavigation(), worldHandle);
    } catch (Exception e) {
        Messaging.logTr(Messages.ERROR_UPDATING_NAVIGATION_WORLD, e.getMessage());
    }
}
Also used : PathEntity(net.minecraft.server.v1_8_R3.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) Entity(net.minecraft.server.v1_8_R3.Entity) CraftEntity(org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) EntityInsentient(net.minecraft.server.v1_8_R3.EntityInsentient) WorldServer(net.minecraft.server.v1_8_R3.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) ReportedException(net.minecraft.server.v1_8_R3.ReportedException) CommandException(net.citizensnpcs.api.command.exception.CommandException)

Example 74 with Entity

use of net.minecraft.server.v1_11_R1.Entity in project Citizens2 by CitizensDev.

the class NMSImpl method registerEntityClass.

@Override
public void registerEntityClass(Class<?> clazz) {
    if (ENTITY_CLASS_TO_INT == null || ENTITY_CLASS_TO_INT.containsKey(clazz))
        return;
    Class<?> search = clazz;
    while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
        if (!ENTITY_CLASS_TO_INT.containsKey(search))
            continue;
        int code = ENTITY_CLASS_TO_INT.get(search);
        ENTITY_CLASS_TO_INT.put(clazz, code);
        ENTITY_CLASS_TO_NAME.put(clazz, ENTITY_CLASS_TO_NAME.get(search));
        return;
    }
    throw new IllegalArgumentException("unable to find valid entity superclass for class " + clazz.toString());
}
Also used : PathEntity(net.minecraft.server.v1_8_R3.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) Entity(net.minecraft.server.v1_8_R3.Entity) CraftEntity(org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Example 75 with Entity

use of net.minecraft.server.v1_11_R1.Entity in project Citizens2 by CitizensDev.

the class NMSImpl method removeFromWorld.

@Override
public void removeFromWorld(org.bukkit.entity.Entity entity) {
    Preconditions.checkNotNull(entity);
    Entity nmsEntity = ((CraftEntity) entity).getHandle();
    nmsEntity.world.removeEntity(nmsEntity);
}
Also used : PathEntity(net.minecraft.server.v1_8_R3.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) Entity(net.minecraft.server.v1_8_R3.Entity) CraftEntity(org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) CraftEntity(org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity)

Aggregations

SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)41 LivingEntity (org.bukkit.entity.LivingEntity)41 CraftEntity (org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity)17 net.minecraft.world.entity (net.minecraft.world.entity)16 org.bukkit.entity (org.bukkit.entity)16 Entity (net.minecraft.server.v1_12_R1.Entity)13 Entity (com.google.datastore.v1.Entity)12 Entity (net.minecraft.server.v1_11_R1.Entity)12 Entity (net.minecraft.server.v1_8_R3.Entity)11 PathEntity (net.minecraft.server.v1_11_R1.PathEntity)10 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)9 PathEntity (net.minecraft.server.v1_8_R3.PathEntity)9 CraftEntity (org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity)9 Entity (net.minecraft.server.v1_10_R1.Entity)8 PathEntity (net.minecraft.server.v1_12_R1.PathEntity)8 Mob (net.minecraft.world.entity.Mob)8 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)8 CraftEntity (org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity)8 Test (org.junit.Test)8 Key (com.google.datastore.v1.Key)7