Search in sources :

Example 46 with org.bukkit.craftbukkit.v1_18_R2.entity

use of org.bukkit.craftbukkit.v1_18_R2.entity in project Citizens2 by CitizensDev.

the class NMSImpl method look.

@Override
public void look(org.bukkit.entity.Entity entity, float yaw, float pitch) {
    Entity handle = NMSImpl.getHandle(entity);
    if (handle == null)
        return;
    yaw = Util.clampYaw(yaw);
    handle.yaw = yaw;
    setHeadYaw(entity, yaw);
    handle.pitch = pitch;
}
Also used : PathEntity(net.minecraft.server.v1_12_R1.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) CraftEntity(org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity) Entity(net.minecraft.server.v1_12_R1.Entity)

Example 47 with org.bukkit.craftbukkit.v1_18_R2.entity

use of org.bukkit.craftbukkit.v1_18_R2.entity in project Citizens2 by CitizensDev.

the class PlayerlistTrackerEntry method updateLastPlayer.

public void updateLastPlayer() {
    if (lastUpdatedPlayer == null)
        return;
    final Entity tracker = getTracker(this);
    final EntityPlayer entityplayer = lastUpdatedPlayer;
    NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
    lastUpdatedPlayer = null;
    if (!Setting.DISABLE_TABLIST.asBoolean())
        return;
    Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {

        @Override
        public void run() {
            NMS.sendTabListRemove(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
        }
    }, Setting.TABLIST_REMOVE_PACKET_DELAY.asInt());
}
Also used : Entity(net.minecraft.server.v1_12_R1.Entity) EntityPlayer(net.minecraft.server.v1_12_R1.EntityPlayer) Player(org.bukkit.entity.Player) EntityPlayer(net.minecraft.server.v1_12_R1.EntityPlayer)

Example 48 with org.bukkit.craftbukkit.v1_18_R2.entity

use of org.bukkit.craftbukkit.v1_18_R2.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();
    ((WorldServer) nmsEntity.world).removeEntity(nmsEntity);
}
Also used : Entity(net.minecraft.server.v1_16_R3.Entity) LivingEntity(org.bukkit.entity.LivingEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) CraftEntity(org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity) PathEntity(net.minecraft.server.v1_16_R3.PathEntity) CraftEntity(org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity) WorldServer(net.minecraft.server.v1_16_R3.WorldServer)

Example 49 with org.bukkit.craftbukkit.v1_18_R2.entity

use of org.bukkit.craftbukkit.v1_18_R2.entity in project Citizens2 by CitizensDev.

the class NMSImpl method registerEntityClass.

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

Example 50 with org.bukkit.craftbukkit.v1_18_R2.entity

use of org.bukkit.craftbukkit.v1_18_R2.entity in project Citizens2 by CitizensDev.

the class NMSImpl method removeHookIfNecessary.

@Override
public void removeHookIfNecessary(NPCRegistry npcRegistry, FishHook entity) {
    if (FISHING_HOOK_HOOKED == null)
        return;
    EntityFishingHook hook = (EntityFishingHook) NMSImpl.getHandle(entity);
    Entity hooked = null;
    try {
        hooked = (Entity) FISHING_HOOK_HOOKED.invoke(hook);
    } catch (Throwable e) {
        e.printStackTrace();
    }
    if (hooked == null)
        return;
    NPC npc = npcRegistry.getNPC(hooked.getBukkitEntity());
    if (npc == null)
        return;
    if (npc.isProtected()) {
        try {
            FISHING_HOOK_HOOKED_SETTER.invoke(hook, null);
        } catch (Throwable e) {
            e.printStackTrace();
        }
        hook.die();
    }
}
Also used : NPC(net.citizensnpcs.api.npc.NPC) EntityHumanNPC(net.citizensnpcs.nms.v1_16_R3.entity.EntityHumanNPC) Entity(net.minecraft.server.v1_16_R3.Entity) LivingEntity(org.bukkit.entity.LivingEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) CraftEntity(org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity) PathEntity(net.minecraft.server.v1_16_R3.PathEntity) EntityFishingHook(net.minecraft.server.v1_16_R3.EntityFishingHook)

Aggregations

LivingEntity (org.bukkit.entity.LivingEntity)114 Entity (org.hypertrace.entity.data.service.v1.Entity)110 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)102 Test (org.junit.jupiter.api.Test)95 CraftEntity (org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity)53 Entity (net.minecraft.world.entity.Entity)42 Location (org.bukkit.Location)41 ArrayList (java.util.ArrayList)39 Entity (com.google.datastore.v1.Entity)33 net.minecraft.world.entity (net.minecraft.world.entity)33 org.bukkit.entity (org.bukkit.entity)32 EnrichedEntity (org.hypertrace.entity.data.service.v1.EnrichedEntity)32 Player (org.bukkit.entity.Player)29 ServerPlayer (net.minecraft.server.level.ServerPlayer)28 LivingEntity (net.minecraft.world.entity.LivingEntity)28 CraftWorld (org.bukkit.craftbukkit.v1_18_R2.CraftWorld)28 CraftPlayer (org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer)27 Event (org.hypertrace.core.datamodel.Event)27 Mob (net.minecraft.world.entity.Mob)25 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)23