Search in sources :

Example 1 with EntityInsentientHandle

use of com.bergerkiller.generated.net.minecraft.world.entity.EntityInsentientHandle 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.getBukkitEntity();
        }
    }
    return null;
}
Also used : EntityHandle(com.bergerkiller.generated.net.minecraft.world.entity.EntityHandle) EntityInsentientHandle(com.bergerkiller.generated.net.minecraft.world.entity.EntityInsentientHandle)

Aggregations

EntityHandle (com.bergerkiller.generated.net.minecraft.world.entity.EntityHandle)1 EntityInsentientHandle (com.bergerkiller.generated.net.minecraft.world.entity.EntityInsentientHandle)1