Interface Leashable

All Superinterfaces:
Audience, CommandSender, Entity, HoverEventSource<HoverEvent.ShowEntity>, Metadatable, Nameable, Permissible, PersistentDataHolder, PersistentDataViewHolder, Pointered, ServerOperator, Sound.Emitter
All Known Subinterfaces:
AbstractHorse, AbstractSkeleton, AbstractVillager, AcaciaBoat, AcaciaChestBoat, Ageable, Allay, Ambient, Animals, Armadillo, Axolotl, BambooChestRaft, BambooRaft, Bat, Bee, BirchBoat, BirchChestBoat, Blaze, Boat, Bogged, Breedable, Breeze, Camel, Cat, CaveSpider, CherryBoat, CherryChestBoat, ChestBoat, ChestedHorse, Chicken, Cod, Cow, Creaking, Creature, Creeper, DarkOakBoat, DarkOakChestBoat, Dolphin, Donkey, Drowned, ElderGuardian, EnderDragon, Enderman, Endermite, Evoker, Fish, Flying, Fox, Frog, Ghast, Giant, GlowSquid, Goat, Golem, Guardian, Hoglin, Horse, Husk, Illager, Illusioner, IronGolem, JungleBoat, JungleChestBoat, Llama, MagmaCube, MangroveBoat, MangroveChestBoat, Mob, Monster, Mule, MushroomCow, NPC, OakBoat, OakChestBoat, Ocelot, PaleOakBoat, PaleOakChestBoat, Panda, Parrot, Phantom, Pig, Piglin, PiglinAbstract, PiglinBrute, PigZombie, Pillager, PolarBear, PufferFish, Rabbit, Raider, RangedEntity, Ravager, Salmon, SchoolableFish, 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

@NullMarked public interface Leashable extends Entity
Represents an entity that can be leashed.
  • Method Details

    • isLeashed

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

      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 players.

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