# 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 %}
