Addons and mob faces
Addon API · for developers · Krylix
There are two ways to extend Krylix. A mob face is a JSON file in a resource pack and needs no code. Everything else goes through a Java API.
Mob faces
The kill feed, the mob panel and the death recap draw a small face for every mob. The mod ships 43 of them:
Blaze, Bogged, Breeze, Cave Spider, Creaking, Creeper, Drowned, Elder Guardian, Ender Dragon, Enderman, Endermite, Evoker, Ghast, Guardian, Hoglin, Husk, Illusioner, Iron Golem, Magma Cube, Parched, Phantom, Piglin, Piglin Brute, Pillager, Ravager, Shulker, Silverfish, Skeleton, Slime, Snow Golem, Spider, Stray, Sulfur Cube, Vex, Vindicator, Warden, Witch, Wither, Wither Skeleton, Zoglin, Zombie, Zombie Villager, Zombified Piglin.
Any other mob, a modded one included, is a grey tile until someone gives it a face.
A face is one file per entity type: assets/<namespace>/krylix/heads/<path>.json for the entity <namespace>:<path>.
{
"layers": [
{ "texture": "mymod:textures/entity/goblin.png", "u": 8, "v": 8, "width": 8, "height": 8,
"texture_width": 64, "texture_height": 64 }
]
}uandvare the top-left pixel of the face in the texture.widthandheightare the size of that region, 8 if left out.texture_widthandtexture_heightare the size of the whole texture, 64 if left out.
The region is scaled into a square. Layers are drawn in order, so glowing eyes go into a second layer, the way the Enderman's do.
The built-in faces are in assets/minecraft/krylix/heads/ and point at the game's own entity textures, so a resource pack can replace any of them. Faces are reloaded together with resource packs.
The API
This part is for mod authors. The API is the package com.eliasnvx.krylix.api, version 1.0.0, numbered separately from the mod. Its classes are inside the Krylix jar, so players install nothing extra.
The shortest setup is to compile against the mod jar from Modrinth's Maven. On NeoForge the artifact ends in -neoforge.
repositories {
maven { url 'https://api.modrinth.com/maven' }
}
dependencies {
compileOnly 'maven.modrinth:krylix:1.4.0+26.3-fabric'
runtimeOnly 'maven.modrinth:krylix:1.4.0+26.3-fabric'
}An addon is a class that implements KrylixAddon. NeoForge finds it by the @RegisterKrylixAddon annotation. On Fabric you list it under the krylix entrypoint in fabric.mod.json.
@RegisterKrylixAddon
public final class MyAddon implements KrylixAddon {
@Override
public void onInitialize(KrylixApi api) {
// A kill in my minigame arena: no feed row, not counted
api.events().addListener(KillEvent.class, event -> {
if (Arena.contains(event.victim())) {
event.setBroadcast(false);
event.setRecordStats(false);
}
});
}
}What an addon can reach:
KillCreditEvent, on the server: change who gets the kill, or set the killer to nobody.KillEvent, on the server:setBroadcast(false)keeps the kill out of the feed,setRecordStats(false)keeps it out of the statistics,setWeaponandflags()change the icon and the badge. Cancel the event and Krylix ignores the death, recap included.StatRecordedEvent, on the server: fires after a kill, a death or a mob kill is counted, with the new total.FeedEntryEvent, on the client: cancel it to hide one row on that client.api.stats(server): read anyone's saved numbers.registerMobHeadandhealthProviders(), on the client: a face from code, and health numbers for entities that keep their health somewhere else.
A face from a resource pack wins over one registered in code. The API has no way to add a tab or a column to the leaderboard.
The full guide is in the repository, next to an example addon for both loaders. The example makes teammates' kills count for nobody, keeps players with a practice tag out of the feed and the statistics, and adds absorption to the health plate. It isn't published anywhere, you build it from source.