Interface MobBehaviour


public interface MobBehaviour
The plugin-side half of a mob: one instance per mob, free to hold that mob's state.
Since:
0.1.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Builds the behaviour bound to one mob.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Called when the mob runs out of health, before the death animation plays.
    default void
    onHurt(DamageSource source, float amount)
    Called after the mob actually lost health.
    default boolean
    Called when a player right-clicks the mob.
    default void
    Called when the mob leaves the world, whether it died or was simply unloaded.
    default void
    Called once, right after the mob was created and before its first tick.
    default void
    onTick(long currentTick)
    Called every tick while the mob is alive, after its goals ran.
  • Method Details

    • onSpawn

      default void onSpawn()
      Called once, right after the mob was created and before its first tick.
      Since:
      0.1.0
    • onTick

      default void onTick(long currentTick)
      Called every tick while the mob is alive, after its goals ran.
      Parameters:
      currentTick - the current server tick
      Since:
      0.1.0
    • onHurt

      default void onHurt(DamageSource source, float amount)
      Called after the mob actually lost health.
      Parameters:
      source - the origin of the hit
      amount - the damage that got through armor and absorption
      Since:
      0.1.0
    • onDeath

      default void onDeath()
      Called when the mob runs out of health, before the death animation plays.
      Since:
      0.1.0
    • onRemove

      default void onRemove()
      Called when the mob leaves the world, whether it died or was simply unloaded.
      Since:
      0.1.0
    • onInteract

      default boolean onInteract(Player player, EquipmentSlotGroup hand)
      Called when a player right-clicks the mob.
      Parameters:
      player - the player interacting
      hand - the hand used
      Returns:
      true to consume the interaction and stop the built-in handling
      Since:
      0.1.0