Skip to main content
This guide shows you how to load a model, spawn it on an entity, and play an animation.

Prerequisites

  • BetterModel plugin installed on your server
  • A .bbmodel file placed in plugins/BetterModel/models/
  • Basic Java/Kotlin knowledge
For this tutorial, we’ll assume you have a model file named demon_knight.bbmodel with an animation called attack.

Step 1: Get a Model

1

Load the Model

Use BetterModel.model() to retrieve a model renderer by name. The name corresponds to the .bbmodel file without the extension.
Use BetterModel.modelOrNull() if you prefer null checks over Optional.
2

Understanding Model Types

BetterModel supports two types of models:
  • General models (BetterModel.model()) - Located in BetterModel/models/, used for entities
  • Player limb models (BetterModel.limb()) - Located in BetterModel/players/, used for player cosmetics

Step 2: Spawn the Model

You can spawn models on entities or at specific locations.

Attach to an Entity

Attach a model to a living entity (e.g., zombie, armor stand):
BukkitAdapter.java
BukkitAdapter.adapt() converts Bukkit entities to BetterModel’s platform-agnostic entity wrapper.

Spawn at a Location (Dummy)

Create a standalone model at a specific location:

Get or Create Pattern

Use getOrCreate() to reuse existing trackers or create a new one:

Step 3: Play an Animation

Once spawned, animate the model using the tracker:

Advanced Animation Control

Control animation speed, looping, and transitions:

Stop an Animation

Step 4: Customize Display Properties

Update the model’s appearance using TrackerUpdateAction:

Apply Updates Before Spawn

You can apply updates before the model is sent to players:

Complete Example

Here’s a full working example that ties everything together:
CompleteExample.java

Common Patterns

Check if Entity Already Has Model

Remove Model from Entity

Listen for Animation Events

Troubleshooting

  • Verify the .bbmodel file is in plugins/BetterModel/models/
  • Check the filename matches (case-sensitive)
  • Look for errors in plugins/BetterModel/logs/ or server console
  • Ensure the model was loaded on server start
  • Confirm the animation name matches exactly (case-sensitive)
  • Check the animation exists in the .bbmodel file
  • Verify the tracker is not closed or removed
  • Ensure players are within render distance
  • Check that the entity is in a loaded chunk
  • Verify sight tracing settings in TrackerModifier
  • Ensure the model has valid textures
  • Try adjusting view range with TrackerUpdateAction.viewRange()

Next Steps

API Reference

Explore all available methods and classes

Animation System

Deep dive into animation control

Player Models

Learn about 12-limb player animations

Examples

See real-world usage examples