# Events

## Setup

{% tabs %}
{% tab title="Gradle" %}

```gradle
repositories {
    mavenCentral()
}

dependencies {
    modImplementation 'dev.creoii.creoapi:creo-events:<VERSION>'
}
```

{% endtab %}

{% tab title="Kotlin" %}

```gradle
repositories {
    mavenCentral()
}

dependencies {
    modImplementation("dev.creoii.creoapi:creo-events:<VERSION>")
}
```

{% endtab %}
{% endtabs %}

## Block Events

**BlockEvents.PLACE:** Fired when a block is placed.\
**BlockEvents.BREAK:** Fired when a block is broken.\
**BlockEvents.CHANGE:** Fired when a block changes at a position.

**CropEvents.GROW:** Fired when a crop grows naturally or when bone-mealed.

## Entity Events

**AnimalEntityEvents.PRE\_BREED:** Fired when two Animals breed, before the baby is born.\
**AnimalEntityEvents.POST\_BREED:** Fired when two Animals breed, after the baby is born.\
**AnimalEntityEvents.EAT:** Fired when an animal is fed food.\
**AnimalEntityEvents.GROW\_UP:** Fired when a baby animal grows up.\
**AnimalEntityEvents.LOVE:** Fired when two animals have entered 'love' mode to begin breeding.

**EntityEvents.SPAWN:** Fired when an Entity spawns in the world.\
**EntityEvents.WITHIN\_STRUCTURE:** Fired when an Entity is within a structure.\
**EntityEvents.DATA\_TRACK:** Fired when an Entity's tracked data is set. (Removed in 0.4.0)\
**EntityEvents.WRITE\_NBT:** Fired when an Entity's NBT is written. (Removed in 0.4.0)\
**EntityEvents.STRUCK\_BY\_LIGHTNING:** Fired when an entity is struck by a lightning bolt.\
**EntityEvents.CHANGE\_DIMENSION:** Fired when an entity moves to another dimension. This is not called for players.

**LivingEntityEvents.DROP\_LOOT:** Fired when a living entity drops loot on death.\
**LivingEntityEvents.EQUIP\_STACK:** Fired when a living entity equips an equipment item.\
**LivingEntityEvents.EAT\_FOOD:** Fired when a living entity eats food.

**MobEntityEvents.INITIALIZE:** Fired when a mob is initialized into the world.\
**MobEntityEvents.INIT\_GOALS:** Fired when a mob has its goalSelector and targetSelector initialized.

**PlayerEntityEvents.LEVEL\_UP:** Fired when a player levels up.\
**PlayerEntityEvents.RESPAWN:** Fired when a player respawns.

**ProjectileEntityEvents.FIRE:** Fired when a projectile is fired.\
**ProjectileEntityEvents.IMPACT:** Fired when a projectile impacts something.

## Item Events

**ItemEvents.CRAFT:** Fired when an item is crafted.\
**ItemEvents.ENCHANT:** Fired when an item is enchanted.\
**ItemEvents.PICK\_UP:** Fires when an item is picked up by a player or mob.

## World Events

**WorldEvents.EXPLODE:** Fired when an explosion occurs in the world.

## Misc Events

**FishingEvents.CAST:** Fired when a Fishing Rod is cast.\
**FishingEvents.REEL\_IN:** Fired when a Fishing Rod has its Fishing Bobber reeled in.

**SleepEvents.EXPLODE:** Fired when a Bed explodes.\
**SleepEvents.SLEEP:** Fired when an entity attempts to sleep in a Bed.\
**SleepEvents.WAKE\_UP:** Fired when an entity wakes up from a Bed.

**LanguageEvents.LOAD\_TRANSLATION:** Fired when each translation key for a locale is translated and stored.

**RecipeEvents.RECIPE\_LOAD:** Fired when a recipe is deserialized, before being loaded into the game.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.creoii.dev/creo-api/packages/events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
