Search in sources :

Example 76 with Entity

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

the class NMSImpl method tick.

@Override
public boolean tick(org.bukkit.entity.Entity next) {
    Entity entity = NMSImpl.getHandle(next);
    if (!entity.dead) {
        try {
            entity.world.g(entity);
        } catch (Throwable throwable) {
            CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
            CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
            entity.appendEntityCrashDetails(crashreportsystemdetails);
            throw new ReportedException(crashreport);
        }
    }
    boolean removeFromPlayerList = ((NPCHolder) entity).getNPC().data().get("removefromplayerlist", Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
    if (entity.dead) {
        entity.world.removeEntity(entity);
        return true;
    } else if (!removeFromPlayerList) {
        if (!entity.world.players.contains(entity)) {
            entity.world.players.add((EntityHuman) entity);
        }
        return true;
    } else {
        entity.world.players.remove(entity);
    }
    return false;
}
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) EntityHuman(net.minecraft.server.v1_8_R3.EntityHuman) CrashReportSystemDetails(net.minecraft.server.v1_8_R3.CrashReportSystemDetails) CrashReport(net.minecraft.server.v1_8_R3.CrashReport) NPCHolder(net.citizensnpcs.npc.ai.NPCHolder) ReportedException(net.minecraft.server.v1_8_R3.ReportedException)

Example 77 with Entity

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

the class NMSImpl method updateAI.

public static void updateAI(EntityLiving entity) {
    if (entity instanceof EntityInsentient) {
        EntityInsentient handle = (EntityInsentient) entity;
        handle.getEntitySenses().a();
        NMSImpl.updateNavigation(handle.getNavigation());
        handle.getControllerMove().c();
        handle.getControllerLook().a();
        handle.getControllerJump().b();
    } else if (entity instanceof EntityHumanNPC) {
        ((EntityHumanNPC) entity).updateAI();
    }
}
Also used : EntityInsentient(net.minecraft.server.v1_11_R1.EntityInsentient) EntityHumanNPC(net.citizensnpcs.nms.v1_11_R1.entity.EntityHumanNPC)

Example 78 with Entity

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

the class NMSImpl method setHeadYaw.

@Override
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
    if (!(entity instanceof LivingEntity))
        return;
    EntityLiving handle = (EntityLiving) getHandle(entity);
    yaw = Util.clampYaw(yaw);
    handle.aO = yaw;
    if (!(handle instanceof EntityHuman)) {
        handle.aN = yaw;
    }
    handle.aP = yaw;
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) EntityHuman(net.minecraft.server.v1_11_R1.EntityHuman) EntityLiving(net.minecraft.server.v1_11_R1.EntityLiving)

Example 79 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_11_R1.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) CraftEntity(org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) Entity(net.minecraft.server.v1_11_R1.Entity) CraftEntity(org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity)

Example 80 with Entity

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

the class NMSImpl method setSize.

public static void setSize(Entity entity, float f, float f1, boolean justCreated) {
    if ((f != entity.width) || (f1 != entity.length)) {
        float f2 = entity.width;
        entity.width = f;
        entity.length = f1;
        entity.a(new AxisAlignedBB(entity.getBoundingBox().a, entity.getBoundingBox().b, entity.getBoundingBox().c, entity.getBoundingBox().a + entity.width, entity.getBoundingBox().b + entity.length, entity.getBoundingBox().c + entity.width));
        if ((entity.width > f2) && (!justCreated) && (!entity.world.isClientSide))
            entity.move(EnumMoveType.SELF, (f2 - entity.width) / 2, 0.0D, (f2 - entity.width) / 2);
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_11_R1.AxisAlignedBB)

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