Search in sources :

Example 11 with EntityHandle

use of com.bergerkiller.generated.net.minecraft.server.EntityHandle in project BKCommonLib by bergerhealer.

the class ExtendedEntity method getLeashHolder.

/**
     * Gets the Entity that is holding this Entity by a leash. If this Entity
     * does not support leashing, or the Entity is not on a leash, null is
     * returned instead.
     *
     * @return Leash holder
     */
public org.bukkit.entity.Entity getLeashHolder() {
    if (handle.isInstanceOf(EntityInsentientHandle.T)) {
        EntityInsentientHandle insHandle = EntityInsentientHandle.createHandle(handle.getRaw());
        EntityHandle holder = insHandle.getLeashHolder();
        if (holder != null) {
            return holder.toBukkit();
        }
    }
    return null;
}
Also used : EntityHandle(com.bergerkiller.generated.net.minecraft.server.EntityHandle) EntityInsentientHandle(com.bergerkiller.generated.net.minecraft.server.EntityInsentientHandle)

Example 12 with EntityHandle

use of com.bergerkiller.generated.net.minecraft.server.EntityHandle in project BKCommonLib by bergerhealer.

the class WorldUtil method removeEntity.

/**
     * Removes a single entity from the world
     *
     * @param entity to remove
     */
public static void removeEntity(org.bukkit.entity.Entity entity) {
    EntityHandle e = CommonNMS.getHandle(entity);
    e.getWorld().removeEntity(e);
    e.getWorldServer().getEntityTracker().stopTracking(entity);
}
Also used : EntityHandle(com.bergerkiller.generated.net.minecraft.server.EntityHandle)

Aggregations

EntityHandle (com.bergerkiller.generated.net.minecraft.server.EntityHandle)12 CraftEntityHandle (com.bergerkiller.generated.org.bukkit.craftbukkit.entity.CraftEntityHandle)4 ArrayList (java.util.ArrayList)3 EntityTracker (com.bergerkiller.bukkit.common.wrappers.EntityTracker)2 AxisAlignedBBHandle (com.bergerkiller.generated.net.minecraft.server.AxisAlignedBBHandle)2 WorldHandle (com.bergerkiller.generated.net.minecraft.server.WorldHandle)2 NMSEntityTracker (com.bergerkiller.reflection.net.minecraft.server.NMSEntityTracker)2 ExtendedEntity (com.bergerkiller.bukkit.common.bases.ExtendedEntity)1 IntVector3 (com.bergerkiller.bukkit.common.bases.IntVector3)1 CommonLivingEntity (com.bergerkiller.bukkit.common.entity.type.CommonLivingEntity)1 CommonPlayer (com.bergerkiller.bukkit.common.entity.type.CommonPlayer)1 CommonPacket (com.bergerkiller.bukkit.common.protocol.CommonPacket)1 BlockData (com.bergerkiller.bukkit.common.wrappers.BlockData)1 BlockHandle (com.bergerkiller.generated.net.minecraft.server.BlockHandle)1 CrashReportHandle (com.bergerkiller.generated.net.minecraft.server.CrashReportHandle)1 CrashReportSystemDetailsHandle (com.bergerkiller.generated.net.minecraft.server.CrashReportSystemDetailsHandle)1 EntityInsentientHandle (com.bergerkiller.generated.net.minecraft.server.EntityInsentientHandle)1 EntityTrackerEntryHandle (com.bergerkiller.generated.net.minecraft.server.EntityTrackerEntryHandle)1 IInventoryHandle (com.bergerkiller.generated.net.minecraft.server.IInventoryHandle)1 WorldServerHandle (com.bergerkiller.generated.net.minecraft.server.WorldServerHandle)1