Search in sources :

Example 1 with EntityInsentientHandle

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

Aggregations

EntityHandle (com.bergerkiller.generated.net.minecraft.server.EntityHandle)1 EntityInsentientHandle (com.bergerkiller.generated.net.minecraft.server.EntityInsentientHandle)1