Search in sources :

Example 16 with EntityHuman

use of net.minecraft.server.v1_15_R1.EntityHuman in project Citizens2 by CitizensDev.

the class NMSImpl method addOrRemoveFromPlayerList.

@Override
public void addOrRemoveFromPlayerList(org.bukkit.entity.Entity entity, boolean remove) {
    if (entity == null)
        return;
    EntityHuman handle = (EntityHuman) getHandle(entity);
    if (handle.world == null)
        return;
    if (remove) {
        handle.world.players.remove(handle);
    } else if (!handle.world.players.contains(handle)) {
        handle.world.players.add(handle);
    }
    PlayerUpdateTask.addOrRemove(entity, remove);
}
Also used : EntityHuman(net.minecraft.server.v1_13_R2.EntityHuman)

Example 17 with EntityHuman

use of net.minecraft.server.v1_15_R1.EntityHuman 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_12_R1.EntityHuman) EntityLiving(net.minecraft.server.v1_12_R1.EntityLiving)

Example 18 with EntityHuman

use of net.minecraft.server.v1_15_R1.EntityHuman in project Citizens2 by CitizensDev.

the class NMSImpl method openHorseScreen.

@Override
public void openHorseScreen(Tameable horse, Player equipper) {
    EntityLiving handle = NMSImpl.getHandle(horse);
    EntityHuman equipperHandle = (EntityHuman) NMSImpl.getHandle(equipper);
    if (handle == null || equipperHandle == null)
        return;
    boolean wasTamed = horse.isTamed();
    horse.setTamed(true);
    ((EntityHorseAbstract) handle).f(equipperHandle);
    horse.setTamed(wasTamed);
}
Also used : EntityHuman(net.minecraft.server.v1_16_R3.EntityHuman) EntityLiving(net.minecraft.server.v1_16_R3.EntityLiving) EntityHorseAbstract(net.minecraft.server.v1_16_R3.EntityHorseAbstract)

Example 19 with EntityHuman

use of net.minecraft.server.v1_15_R1.EntityHuman in project Citizens2 by CitizensDev.

the class NMSImpl method addOrRemoveFromPlayerList.

@Override
public void addOrRemoveFromPlayerList(org.bukkit.entity.Entity entity, boolean remove) {
    if (entity == null)
        return;
    EntityHuman handle = (EntityHuman) getHandle(entity);
    if (handle.world == null)
        return;
    if (remove) {
        handle.world.players.remove(handle);
    } else if (!handle.world.players.contains(handle)) {
        handle.world.players.add(handle);
    }
    PlayerUpdateTask.addOrRemove(entity, remove);
}
Also used : EntityHuman(net.minecraft.server.v1_11_R1.EntityHuman)

Example 20 with EntityHuman

use of net.minecraft.server.v1_15_R1.EntityHuman in project Citizens2 by CitizensDev.

the class NMSImpl method tick.

@Override
public boolean tick(org.bukkit.entity.Entity next) {
    Entity entity = NMSImpl.getHandle(next);
    Entity entity1 = entity.bB();
    if (entity1 != null) {
        if ((entity1.dead) || (!entity1.w(entity))) {
            entity.stopRiding();
        }
    } else {
        if (!entity.dead) {
            try {
                entity.world.entityJoinedWorld(entity, true);
            } 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_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) EntityHuman(net.minecraft.server.v1_11_R1.EntityHuman) CrashReportSystemDetails(net.minecraft.server.v1_11_R1.CrashReportSystemDetails) CrashReport(net.minecraft.server.v1_11_R1.CrashReport) NPCHolder(net.citizensnpcs.npc.ai.NPCHolder) ReportedException(net.minecraft.server.v1_11_R1.ReportedException)

Aggregations

LivingEntity (org.bukkit.entity.LivingEntity)15 EntityHuman (net.minecraft.server.v1_11_R1.EntityHuman)7 EntityHuman (net.minecraft.server.v1_12_R1.EntityHuman)6 EntityHuman (net.minecraft.server.v1_8_R3.EntityHuman)6 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)5 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)5 EntityHuman (net.minecraft.server.v1_15_R1.EntityHuman)5 EntityHuman (net.minecraft.server.v1_10_R1.EntityHuman)4 EntityHuman (net.minecraft.server.v1_13_R2.EntityHuman)4 Entity (net.minecraft.server.v1_11_R1.Entity)3 EntityLiving (net.minecraft.server.v1_11_R1.EntityLiving)3 EntityLiving (net.minecraft.server.v1_12_R1.EntityLiving)3 EntityHuman (net.minecraft.server.v1_16_R3.EntityHuman)3 CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)2 SoliniaItemException (com.solinia.solinia.Exceptions.SoliniaItemException)2 ISoliniaLivingEntity (com.solinia.solinia.Interfaces.ISoliniaLivingEntity)2 ISoliniaPlayer (com.solinia.solinia.Interfaces.ISoliniaPlayer)2 Entity (net.minecraft.server.v1_12_R1.Entity)2 EntityLiving (net.minecraft.server.v1_15_R1.EntityLiving)2 Entity (net.minecraft.server.v1_9_R1.Entity)2