Search in sources :

Example 21 with EntityHandle

use of com.bergerkiller.generated.net.minecraft.world.entity.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.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)21 AxisAlignedBBHandle (com.bergerkiller.generated.net.minecraft.world.phys.AxisAlignedBBHandle)6 ArrayList (java.util.ArrayList)6 EntityTracker (com.bergerkiller.bukkit.common.wrappers.EntityTracker)4 EntityTrackerEntryHandle (com.bergerkiller.generated.net.minecraft.server.level.EntityTrackerEntryHandle)4 WorldServerHandle (com.bergerkiller.generated.net.minecraft.server.level.WorldServerHandle)4 EntityTrackerEntryStateHandle (com.bergerkiller.generated.net.minecraft.server.level.EntityTrackerEntryStateHandle)2 IntHashMapHandle (com.bergerkiller.generated.net.minecraft.util.IntHashMapHandle)2 WorldHandle (com.bergerkiller.generated.net.minecraft.world.level.WorldHandle)2 VoxelShapeHandle (com.bergerkiller.generated.net.minecraft.world.phys.shapes.VoxelShapeHandle)2 CraftEntityHandle (com.bergerkiller.generated.org.bukkit.craftbukkit.entity.CraftEntityHandle)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 Map (java.util.Map)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 EntityTrackerHook (com.bergerkiller.bukkit.common.internal.hooks.EntityTrackerHook)1 CommonPacket (com.bergerkiller.bukkit.common.protocol.CommonPacket)1