Skip to main content
The RPGMobs API allows other Hytale mods to react to RPG mob events, inspect mob state, and modify behavior at runtime. It ships as a separate RPGMobs-api artifact so your mod only depends on the lightweight API interfaces, not the full plugin.

Setup

Dependency

Add the API JAR as a compile-only dependency in your build.gradle:
Or if published to a Maven repository:
The -javadoc.jar and -sources.jar are available as additional downloads. Place all three in your libs/ folder for full IDE support (autocomplete, inline docs, click-to-source).

Mod Manifest

Declare RPGMobs as a dependency in your mod’s manifest.json so Hytale loads it before your mod:

Entry Point

All API access goes through the static RPGMobsAPI class:
If RPGMobs has not initialized yet, calling these methods throws RPGMobsNotInitializedException.

Event System

Implement IRPGMobsEventListener and override the events you care about. All handler methods have default no-op implementations, so you only need to override what you use.
Register it during your mod’s initialization:

Available Events

Base Event Fields

Every event extends RPGMobsEvent which provides:
  • getWorld() - the World in which the event occurred (since 1.1.0)
  • getEntityRef() - the RPG mob’s Ref<EntityStore>
  • getEntityUuid() - the entity’s UUID, or null if unavailable (since 1.1.0)
  • getTier() - zero-based tier index (0 = Tier 1, 4 = Tier 5)
  • getRoleName() - the NPC role identifier (e.g. "Skeleton_Frost_Knight")

Cancelling Events

Events that implement ICancellable can be cancelled to prevent the action:
Cancellable events: RPGMobsSpawnedEvent, RPGMobsDropsEvent, RPGMobsDamageDealtEvent, RPGMobsAbilityStartedEvent.

Query API

The Query API provides read-only access to any RPG mob’s current state. Access it via RPGMobsAPI.query().

Identity

Scaling

Progression

Combat

Summons

Query Examples

Check if an entity is an elite and read its tier

Read scaling values for a HUD or tooltip

Check combat state and current target

Read distance-based progression bonuses

Monitor summoned minions

Inspect combat state (since 1.2.0)

Filter minion deaths

Ability IDs

Abilities are identified by string IDs passed in ability events (RPGMobsAbilityStartedEvent, RPGMobsAbilityCompletedEvent, RPGMobsAbilityInterruptedEvent). The built-in ability IDs are:

Example: Full Integration

Spawn API (since 1.3.0)

The Spawn API lets other mods programmatically create RPGMobs elites. Access it via RPGMobsAPI.spawn().

Quick Reference

Parameters:

Weapon Categories

Pass one of these exact strings as weaponCategory to force the elite to spawn with that weapon type. Pass null to let RPGMobs pick based on the mob rule’s configured categories. Ranged weapon categories use vanilla Hytale AI instead of the CAE combat system.

Spawn a New Elite

Elite-ify an Existing NPC

If you already spawned an NPC via NPCPlugin and want to promote it:

Force a Weapon Category

Handle Failures

SpawnResult is a sealed interface. Check success or match on the failure reason:

Threading

All spawn methods must be called on the world’s thread. From other threads, wrap in world.execute():

Thread Safety

Event callbacks are dispatched from the server’s main tick thread. Do not perform blocking I/O or long-running computations inside event handlers. If you need async processing, queue work to a separate thread and return immediately. The Query API reads component data from the entity store and should only be called from contexts where the store is accessible (event handlers, tick systems, or world.execute() callbacks).