# Java API

An extensive API is available, exposing all the big, and little details of models and mechanics.&#x20;

Currently, AdvancedModels must be added as a .jar file to dependencies, we are working on gradle and maven integrations.

## To access the API

API can be found using `net.advancedplugins.models.Core.getAPI()` method.

From there, you will get access to the AdvancedModelsAPI class.&#x20;

<pre class="language-java" data-title="AdvancedModelsAPI class" data-line-numbers data-full-width="true"><code class="lang-java"><strong>public interface AdvancedModelsAPI {
</strong><strong>    boolean isModel(String model);
</strong>    String getModelFromItem(ItemStack item);
    SpawnedModel getModelFromBlock(Block block);
    SpawnedModel getModelFromLocation(Location loc);
    ]
</code></pre>

You are able to do way more from `SpawnedModel` class:

{% code title="SpawnedModel class" lineNumbers="true" fullWidth="true" %}

```java
public interface SpawnedModel {
    Model getModel();
    
    SpawnedModel matchFromLocation(Location location);
    SpawnedModel matchFromHitbox(Interaction hitbox);

    void despawn();
    void rightClick(Player player);
}
```

{% endcode %}

And with `Model` class:

{% code fullWidth="true" %}

```java
public interface Model {
    public String getId();
    public String getName();
    public String getAuthor();
    public String getVersion();
    public String getDescription();
    public ModelProperties getProperties(); // entity collision, block collision and model placeable item material
    public ModelPartProperties getPartProperties(); // get part material, interaction, value & more
    public ModelParameters getParameters(); // get args for colors 
    public SpawnedModel spawn(Location location, BlockFace rotation, PassedParameters params);
    public SpawnedModel spawn(Location location, BlockFace rotation);
    public SpawnedModel spawn(Location location, PassedParameters params);
    public SpawnedModel spawn(Location location);
    public String getGroup();
}
```

{% endcode %}


---

# 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://models.advancedplugins.net/developers/java-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.
