Interface Leashable

All Known Subinterfaces:
AbstractCow, AbstractHorse, AbstractSkeleton, AbstractVillager, AcaciaBoat, AcaciaChestBoat, Ageable, Allay, Ambient, Animals, Armadillo, ArmorStand, Axolotl, BambooChestRaft, BambooRaft, Bat, Bee, BirchBoat, BirchChestBoat, Blaze, Boat, Bogged, Breedable, Breeze, Camel, Cat, CaveSpider, CherryBoat, CherryChestBoat, ChestBoat, ChestedHorse, Chicken, Cod, ComplexLivingEntity, CopperGolem, Cow, Creaking, Creature, Creeper, DarkOakBoat, DarkOakChestBoat, Dolphin, Donkey, Drowned, ElderGuardian, EnderDragon, Enderman, Endermite, Enemy, Evoker, Fish, Flying, Fox, Frog, Ghast, Giant, GlowSquid, Goat, Golem, Guardian, HappyGhast, Hoglin, Horse, HumanEntity, Husk, Illager, Illusioner, IronGolem, JungleBoat, JungleChestBoat, LivingEntity, Llama, MagmaCube, MangroveBoat, MangroveChestBoat, Mannequin, Mob, Monster, Mule, MushroomCow, NPC, OakBoat, OakChestBoat, Ocelot, PaleOakBoat, PaleOakChestBoat, Panda, Parrot, Phantom, Pig, Piglin, PiglinAbstract, PiglinBrute, PigZombie, Pillager, Player, PolarBear, PufferFish, Rabbit, Raider, Ravager, Salmon, Sheep, Shulker, Silverfish, Skeleton, SkeletonHorse, Slime, Sniffer, Snowman, Spellcaster, Spider, SpruceBoat, SpruceChestBoat, Squid, Steerable, Stray, Strider, Tadpole, Tameable, TraderLlama, TropicalFish, Turtle, Vex, Villager, Vindicator, WanderingTrader, Warden, WaterMob, Witch, Wither, WitherSkeleton, Wolf, Zoglin, Zombie, ZombieHorse, ZombieVillager

public interface Leashable
Represents an entity which can be leashed.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the entity that is currently leading this entity.
    boolean
    Returns whether the entity is currently leashed.
    boolean
    Sets the leash on this entity to be held by the supplied entity.
  • Method Details

    • isLeashed

      boolean isLeashed()
      Returns whether the entity is currently leashed.
      Returns:
      whether the entity is leashed
    • getLeashHolder

      @NotNull Entity getLeashHolder() throws IllegalStateException
      Gets the entity that is currently leading this entity.
      Returns:
      the entity holding the leash
      Throws:
      IllegalStateException - if not currently leashed
    • setLeashHolder

      boolean setLeashHolder(@Nullable Entity holder)
      Sets the leash on this entity to be held by the supplied entity.

      This method has no effect on EnderDragons, Players, or ArmorStands. Non-living entities excluding leashes will not persist as leash holders.

      Parameters:
      holder - the entity to leash this entity to, or null to unleash
      Returns:
      whether the operation was successful