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 ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilds the behaviour bound to one mob. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidonDeath()Called when the mob runs out of health, before the death animation plays.default voidonHurt(DamageSource source, float amount) Called after the mob actually lost health.default booleanonInteract(Player player, EquipmentSlotGroup hand) Called when a player right-clicks the mob.default voidonRemove()Called when the mob leaves the world, whether it died or was simply unloaded.default voidonSpawn()Called once, right after the mob was created and before its first tick.default voidonTick(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
Called after the mob actually lost health.- Parameters:
source- the origin of the hitamount- 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
Called when a player right-clicks the mob.- Parameters:
player- the player interactinghand- the hand used- Returns:
trueto consume the interaction and stop the built-in handling- Since:
- 0.1.0
-