Search in sources :

Example 71 with Entity

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

the class ItemFrameController method createEntity.

@Override
protected Entity createEntity(Location at, NPC npc) {
    Entity e = super.createEntity(at, npc);
    EntityItemFrame item = (EntityItemFrame) ((CraftEntity) e).getHandle();
    item.setDirection(EnumDirection.EAST);
    item.blockPosition = new BlockPosition(at.getX(), at.getY(), at.getZ());
    return e;
}
Also used : Entity(org.bukkit.entity.Entity) CraftEntity(org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity) EntityItemFrame(net.minecraft.server.v1_10_R1.EntityItemFrame) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition)

Example 72 with Entity

use of net.minecraft.server.v1_10_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_10_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_10_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_10_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)39 CraftEntity (org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity)17 Entity (net.minecraft.server.v1_12_R1.Entity)13 Entity (net.minecraft.server.v1_11_R1.Entity)12 Entity (net.minecraft.server.v1_8_R3.Entity)11 Entity (net.minecraft.server.v1_10_R1.Entity)10 PathEntity (net.minecraft.server.v1_12_R1.PathEntity)10 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)9 PathEntity (net.minecraft.server.v1_10_R1.PathEntity)9 PathEntity (net.minecraft.server.v1_11_R1.PathEntity)9 PathEntity (net.minecraft.server.v1_8_R3.PathEntity)9 CraftEntity (org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity)9 CraftEntity (org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity)9 Entity (com.google.datastore.v1.Entity)8 CraftEntity (org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity)8 DeleteEntity (org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.DeleteEntity)6 CommandException (net.citizensnpcs.api.command.exception.CommandException)5 CraftWorld (org.bukkit.craftbukkit.v1_10_R1.CraftWorld)5 Player (org.bukkit.entity.Player)5