# 🛠️Developer API

Welcome to the **VortexStacker API**. This API allows developers to hook into the stacking system, listen for stacking events, and programmatically manage stacked entities, spawners, and loot.

{% hint style="info" %}
You can browse our available API versions and artifacts directly in your browser at our [repositiory](https://repo.vortexdevelopment.net/#browser).
{% endhint %}

### 📦 Dependency Management <a href="#user-content--dependency-management" id="user-content--dependency-management"></a>

To use the API, you need to add our Maven repository and the API dependency to your project.

#### **Maven** <a href="#user-content-maven" id="user-content-maven"></a>

Add the following to your `pom.xml`:

```xml
<repository>
    <id>vortex-repo</id>
    <url>https://repo.vortexdevelopment.net/repository</url>
</repository>

<dependency>
    <groupId>net.vortexdevelopment</groupId>
    <artifactId>VortexStacker-API</artifactId>
    <version>latest</version> <!-- Or use a specific version -->
    <scope>provided</scope>
</dependency>
```

#### **Gradle (Groovy)** <a href="#user-content-gradle-groovy" id="user-content-gradle-groovy"></a>

Add the following to your `build.gradle`:

```kotlin
repositories {
    maven {
        url = uri("https://repo.vortexdevelopment.net/repository")
    }
}

dependencies {
    compileOnly 'net.vortexdevelopment:VortexStacker-API:latest'
}
```

***

### 🚀 Getting Started <a href="#user-content--getting-started" id="user-content--getting-started"></a>

#### **Accessing the API** <a href="#user-content-accessing-the-api" id="user-content-accessing-the-api"></a>

The main entry point for the API is the `VortexStackerApi` class. Note that you should always check if the plugin is enabled before accessing it as well as each manager for modules can be null if they are disabled. All methods staticly accessible from the `VortexStackerApi` class for each module.

#### 💠 **API Modules** <a href="#user-content-api-modules" id="user-content-api-modules"></a>

```java
@Nullable VortexStackerApi.getBlockManager();
@Nullable VortexStackerApi.getEntityManager();
@Nullable VortexStackerApi.getItemManager();
@Nullable VortexStackerApi.getSpawnerManager();
```

The API is split into several modules to keep things organized:

* **`StackedEntityManager`**: Handle mob stacking logic, manually merge entities, and access stack data/amounts from living entities.
* **`StackedSpawnerManager`**: Programmatically manage stacked spawners at specific locations and update spawner holograms.
* **`StackedBlockManager`**: Interact with stacked blocks (like Iron/Emerald blocks) and manage their stack levels.
* **`StackedItemManager`**: Manage items stacked on the ground and customize how they merge or display.
* **`LootManager`**: Programmatically interact with the custom loot system, modify loot table definitions, and trigger loot generation.

***

### 🔔 Events <a href="#user-content--events" id="user-content--events"></a>

VortexStacker fires several custom events that you can listen to in your own plugins:

* **`VortexStackerLoadEvent`**: Fired when the plugin has fully initialized its DI container and is ready to be used.
* **`MobStackEvent`**: Fired when two mobs are about to merge.
* **`SpawnerStackEvent`**: Fired when two spawners are stacked together.
* **`LootGenerateEvent`**: Fired when the custom loot system is calculating drops for an entity.

***

#### 📄 **Plugin.yml** <a href="#user-content-pluginyml" id="user-content-pluginyml"></a>

If you are depending on VortexStacker, don't forget to add it to your&#x20;

plugin.yml to ensure proper load order:

```
depend: [VortexStacker] # OR
softdepend: [VortexStacker]
```


---

# 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://wiki.vortexdevelopment.net/projects/vortexstacker/developer-api.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.
