Interface Mob

All Superinterfaces:
Attributable, Audience, CommandSender, Damageable, Entity, Frictional, HoverEventSource<HoverEvent.ShowEntity>, Leashable, LivingEntity, Lootable, Metadatable, Nameable, Permissible, PersistentDataHolder, PersistentDataViewHolder, Pointered, ProjectileSource, ServerOperator, Sound.Emitter
All Known Subinterfaces:
AbstractHorse, AbstractSkeleton, AbstractVillager, Ageable, Allay, Ambient, Animals, Armadillo, Axolotl, Bat, Bee, Blaze, Bogged, Breedable, Breeze, Camel, Cat, CaveSpider, ChestedHorse, Chicken, Cod, Cow, Creaking, CreakingTransient, Creature, Creeper, Dolphin, Donkey, Drowned, ElderGuardian, EnderDragon, Enderman, Endermite, Evoker, Fish, Flying, Fox, Frog, Ghast, Giant, GlowSquid, Goat, Golem, Guardian, Hoglin, Horse, Husk, Illager, Illusioner, IronGolem, Llama, MagmaCube, Monster, Mule, MushroomCow, NPC, Ocelot, 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, 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 Mob extends LivingEntity, Lootable, Leashable
Represents a Mob. Mobs are living entities with simple AI.
  • Method Details Link icon

    • getEquipment Link icon

      @NotNull EntityEquipment getEquipment()
      Description copied from interface: LivingEntity
      Gets the inventory with the equipment worn by the living entity.
      Specified by:
      getEquipment in interface LivingEntity
      Returns:
      the living entity's inventory
    • getPathfinder Link icon

      @NotNull Pathfinder getPathfinder()
      Enables access to control the pathing of an Entity
      Returns:
      Pathfinding Manager for this entity
    • isInDaylight Link icon

      boolean isInDaylight()
      Check if this mob is exposed to daylight
      Returns:
      True if mob is exposed to daylight
    • lookAt Link icon

      void lookAt(@NotNull Location location)
      Instruct this Mob to look at a specific Location

      Useful when implementing custom mob goals

      Parameters:
      location - location to look at
    • lookAt Link icon

      void lookAt(@NotNull Location location, float headRotationSpeed, float maxHeadPitch)
      Instruct this Mob to look at a specific Location

      Useful when implementing custom mob goals

      Parameters:
      location - location to look at
      headRotationSpeed - head rotation speed
      maxHeadPitch - max head pitch rotation
    • lookAt Link icon

      void lookAt(@NotNull @NotNull Entity entity)
      Instruct this Mob to look at a specific Entity

      If a LivingEntity, look at eye location

      Useful when implementing custom mob goals

      Parameters:
      entity - entity to look at
    • lookAt Link icon

      void lookAt(@NotNull @NotNull Entity entity, float headRotationSpeed, float maxHeadPitch)
      Instruct this Mob to look at a specific Entity

      If a LivingEntity, look at eye location

      Useful when implementing custom mob goals

      Parameters:
      entity - entity to look at
      headRotationSpeed - head rotation speed
      maxHeadPitch - max head pitch rotation
    • lookAt Link icon

      void lookAt(double x, double y, double z)
      Instruct this Mob to look at a specific position

      Useful when implementing custom mob goals

      Parameters:
      x - x coordinate
      y - y coordinate
      z - z coordinate
    • lookAt Link icon

      void lookAt(double x, double y, double z, float headRotationSpeed, float maxHeadPitch)
      Instruct this Mob to look at a specific position

      Useful when implementing custom mob goals

      Parameters:
      x - x coordinate
      y - y coordinate
      z - z coordinate
      headRotationSpeed - head rotation speed
      maxHeadPitch - max head pitch rotation
    • getHeadRotationSpeed Link icon

      int getHeadRotationSpeed()
      Gets the head rotation speed
      Returns:
      the head rotation speed
    • getMaxHeadPitch Link icon

      int getMaxHeadPitch()
      Gets the max head pitch rotation
      Returns:
      the max head pitch rotation
    • setTarget Link icon

      void setTarget(@Nullable @Nullable LivingEntity target)
      Instructs this Mob to set the specified LivingEntity as its target.

      Hostile creatures may attack their target, and friendly creatures may follow their target.

      Parameters:
      target - New LivingEntity to target, or null to clear the target
    • getTarget Link icon

      Gets the current target of this Mob
      Returns:
      Current target of this creature, or null if none exists
    • setAware Link icon

      void setAware(boolean aware)
      Sets whether this mob is aware of its surroundings. Unaware mobs will still move if pushed, attacked, etc. but will not move or perform any actions on their own. Unaware mobs may also have other unspecified behaviours disabled, such as drowning.
      Parameters:
      aware - whether the mob is aware
    • isAware Link icon

      boolean isAware()
      Gets whether this mob is aware of its surroundings. Unaware mobs will still move if pushed, attacked, etc. but will not move or perform any actions on their own. Unaware mobs may also have other unspecified behaviours disabled, such as drowning.
      Returns:
      whether the mob is aware
    • getAmbientSound Link icon

      @Nullable @Nullable Sound getAmbientSound()
      Get the Sound this mob makes while ambiently existing. This sound may change depending on the current state of the entity, and may also return null under specific conditions. This sound is not constant. For instance, villagers will make different passive noises depending on whether or not they are actively trading with a player, or make no ambient noise while sleeping.
      Returns:
      the ambient sound, or null if this entity is ambiently quiet
    • setLootTable Link icon

      default void setLootTable(@Nullable LootTable table, long seed)
      Description copied from interface: Lootable
      Set the loot table and seed for a container or entity at the same time.
      Specified by:
      setLootTable in interface Lootable
      Parameters:
      table - the Loot Table this Container or Mob will have.
      seed - the seed to used to generate loot. Default is 0.
    • isAggressive Link icon

      boolean isAggressive()
      Some mobs will raise their arm(s) when aggressive:

      Note: This doesn't always show the actual aggressive state as set by setAggressive(boolean). Panda's are always aggressive if their combined Panda.Gene is Panda.Gene.AGGRESSIVE.

      Returns:
      wether the mob is aggressive or not
    • setAggressive Link icon

      void setAggressive(boolean aggressive)
      Some mobs will raise their arm(s) when aggressive, see isAggressive() for full list.
      Parameters:
      aggressive - wether the mob should be aggressive or not
      See Also:
    • isLeftHanded Link icon

      boolean isLeftHanded()
      Check if Mob is left-handed
      Returns:
      True if left-handed
    • setLeftHanded Link icon

      void setLeftHanded(boolean leftHanded)
      Set if Mob is left-handed
      Parameters:
      leftHanded - True if left-handed
    • getPossibleExperienceReward Link icon

      int getPossibleExperienceReward()
      Gets the amount of experience the mob will possibly drop. This value is randomized and it can give different results
      Returns:
      the amount of experience the mob will possibly drop