Repository navigation
Developer API
The api lets your plugin spawn, change and listen to Hyperion models, play effects and work with custom armor. It holds interfaces and small data types only; the Hyperion plugin implements them.
Important
The api is not published to a Maven repository yet. Until it is, build Hyperion and depend on
modules/api/build/libs/api-<version>.jar. Once published, it will be
compileOnly("dev.vertcode.hyperion:hyperion-api:VERSION").
Depend on Hyperion so it loads before your plugin.
paper-plugin.yml:
dependencies:
server:
Hyperion:
load: BEFORE
required: true
join-classpath: trueplugin.yml:
depend: [Hyperion]Everything starts at the Hyperion class:
| Call | What it gives |
|---|---|
Hyperion.models() |
Model blueprints: find, register, reload |
Hyperion.tracker() |
Live models: by entity, by id, near a location |
Hyperion.effects() |
Effects: find, register, play |
Hyperion.armor() |
Armor sets, items and what a player wears |
Hyperion.behaviors() |
Bone behaviors, and registering your own |
Hyperion.formats() |
Model file formats |
ModelBlueprint dragon = Hyperion.models().find(Key.key("hyperion", "bosses/dragon")).orElseThrow();
// On an entity: the model follows it.
Model boss = dragon.attach(zombie, options -> options.scale(2.5f).viewDistance(64));
// On its own, at a location.
Model statue = dragon.spawn(location, options -> options.glowing(true));SpawnOptions also sets the tint, glow color, brightness, a starting animation, who can see the
model, and whether the automatic idle and walk animations run.
Models are not saved. To keep one over a restart, spawn it again yourself, for models on entities
in EntitiesLoadEvent.
boss.scale(3f);
boss.bone("head").ifPresent(head -> head.tint(Color.RED).glowing(true));
boss.teleport(location); // for a model on its own
boss.remove();Find live models with the tracker:
List<Model> onZombie = Hyperion.tracker().of(zombie);
List<Model> nearby = Hyperion.tracker().near(location, 16);AnimationHandle roar = boss.animator().play("roar");
boss.animator().play("walk", options -> options
.speed(1.5f)
.loop(LoopMode.LOOP)
.fadeIn(5)
.fadeOut(5));
roar.onEnd(() -> boss.animator().play("idle"));
boss.animator().stop("walk");LoopMode is ONCE, LOOP or HOLD (stay on the last frame).
A player's view of a model has its own animator and look. What you set there, only that player sees, on top of what everyone sees.
PlayerView view = boss.view(player);
view.animator().play("wave");
view.reset(); // back to what everyone seesWho sees a model at all:
boss.viewers().policy(ViewerPolicy.permission("myplugin.see.boss"));
boss.viewers().hide(player);for (SeatBehavior seat : boss.seats()) {
seat.mount(player);
seat.locked(true); // sneaking no longer gets them off
}
boss.behaviors(HeadBehavior.class).forEach(head -> head.target(player.getLocation()));Hyperion.effects().play(Key.key("hyperion", "level_up"), EffectAnchor.on(boss));
Hyperion.effects().play(Key.key("hyperion", "aura"), EffectAnchor.on(player), options -> options
.parameter("color", "#FF5555")
.viewers(EffectViewers.nearby(32)));An anchor is a location (EffectAnchor.at), an entity or model (on), or a bone or locator of a
model (bone, locator).
Ship effects with your plugin by registering a folder of effect files in your own namespace:
Hyperion.effects().registerFolder(this, "myplugin", getDataPath().resolve("effects"));Register models from your plugin's jar or its data folder. They get your namespace:
Hyperion.models()
.register(this, Key.key("myplugin", "golem"), ModelSource.resource(this, "models/golem.bbmodel"))
.thenAccept(blueprint -> getLogger().info("Loaded " + blueprint.key()));Loading runs off the server thread, so register returns a future. Hyperion rebuilds the resource
pack for you.
ArmorSet frost = Hyperion.armor().find(Key.key("hyperion", "frost")).orElseThrow();
// Items
frost.piece(ArmorSlot.HEAD).ifPresent(helmet -> player.getInventory().addItem(helmet.item()));
// What a player wears
WornArmor worn = Hyperion.armor().worn(player);
if (worn.hasFullSet(frost)) {
// ...
}
// Is this item custom armor?
Hyperion.armor().pieceOf(item).ifPresent(piece -> { /* piece.set(), piece.slot(), piece.stats() */ });
// Values from the set's .yml "data" section
String element = frost.data().getString("element", "none");A set bonus is a few lines with the armor events:
@EventHandler
public void onFullSet(ArmorSetCompleteEvent event) {
if (event.set().key().asString().equals("hyperion:frost")) {
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, -1, 0));
}
}
@EventHandler
public void onSetBroken(ArmorSetBreakEvent event) {
if (event.set().key().asString().equals("hyperion:frost")) {
event.getPlayer().removePotionEffect(PotionEffectType.SPEED);
}
}See API Events for every event.
Hyperion runs on Folia and Canvas, so the rules are the same on every platform:
-
spawn,attach,teleportandremovemust run on the thread that owns the location or entity. On Folia, use that entity's or region's scheduler. On Paper, that is the main thread. - Getters and appearance setters (scale, tint, glow, animations) are safe from any thread and take effect on the model's next frame.
- Events fire on the thread that owns the model or player, except the two load events, which are async.
Every package is @NullMarked with JSpecify: nothing is null unless it is
marked @Nullable. IntelliJ and Kotlin read these annotations.
Feature says what the running server has, so you do not compare version numbers:
if (Feature.EQUIPPABLE.available()) {
// 1.21.2 and later
}Hyperion is open source under the MIT License. Found a mistake on this page? Open an issue.
Getting started
Features
Reference
Developers