接口 Leashable

所有已知子接口:
AbstractCow, AbstractHorse, AbstractNautilus, AbstractSkeleton, AbstractVillager, AcaciaBoat, AcaciaChestBoat, Ageable, Allay, Ambient, Animals, Armadillo, ArmorStand, Axolotl, BambooChestRaft, BambooRaft, Bat, Bee, BirchBoat, BirchChestBoat, Blaze, Boat, Bogged, Breedable, Breeze, Camel, CamelHusk, 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, Nautilus, NPC, OakBoat, OakChestBoat, Ocelot, PaleOakBoat, PaleOakChestBoat, Panda, Parched, 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, ZombieNautilus, ZombieVillager

public interface Leashable
代表可被拴住的实体.
  • 方法详细资料

    • isLeashed

      boolean isLeashed()
      返回实体当前是否被拴住.

      原文: Returns whether the entity is currently leashed.

      返回:
      实体是否被拴住
    • getLeashHolder

      获取当前牵引此实体的实体.

      原文: Gets the entity that is currently leading this entity.

      返回:
      握持拴绳的实体
      抛出:
      IllegalStateException - 如果当前实体没被拴住则抛出异常
    • setLeashHolder

      boolean setLeashHolder(@Nullable @Nullable Entity holder)
      设置握持拴绳的实体.

      此方法对末影龙,凋零,玩家或蝙蝠无效。除拴绳外的非生物实体将不会像握持拴绳者一样持续存在.

      原文: Sets the leash on this entity to be held by the supplied entity.

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

      参数:
      holder - 握持拴绳的实体
      返回:
      操作是否成功