Skip to content

Class Files

Smileycorp edited this page Oct 1, 2025 · 15 revisions

Class files are located in the data/<identifier>/classes and are the main files for defining your classes.

Class files feature several properties, as seen in the example below from the dawncraft datapack:

dawncraft:roamer
{
	"index": 4,
	"attributes": {
		"generic.max_health": 17,
		"paraglider:max_stamina": 42
	},
	"starting_skills": [
		"epicfight:roll",
		"epicfight:emergency_escape"
	],
	"items": [
		{
			"id": "jet_and_elias_armors:highlander_set_chestplate",
			"slot": "chest"
		},
		{
			"id": "minecraft:bow"
		},
		{
			"id": "nyfsquiver:basic_quiver",
			"slot": "curios:quiver"
		},
		{
			"id": "minecraft:arrow",
			"count": 64
		},
		{
			"id": "minecraft:bread",
			"count": 10
		}
	],
	"animation": "epicfight:biped/combat/bow_shot_mid",
        "offset": [0, 0]
}

Index

The index property is a single integer that determines the sort order of classes in the class selection gui, starting with the lowest first.

Attributes

Attributes list a set of values that correspond to game attributes and take a registry name and a double value, you will be able to find the names by looking at entity NBT, or checking this list.

Skills (Epic Fight Support)

The skills property is defines a set of skills to give the player when they spawn in, they use the registry name of skills, as seen in a datapack that adds the skills as seen in the epic fight mod.

Items

Items contain a list of items given to the player with a set of properties that can be given to them.

example
{
	"index": 5,
	"attributes": {
		"generic.max_health": 16,
		"paraglider:max_stamina": 24
	},
	"starting_skills": [
		"epicfight:roll",
		"wom:ender_step"
	],
	"items": [
		{
			"id": "irons_spellbooks:wandering_magician_helmet",
			"slot": "head"
		},
		{
			"id": "irons_spellbooks:wandering_magician_chestplate",
			"slot": "chest"
		},
		{
			"id": "irons_spellbooks:iron_spell_book",
			"nbt": "{ISB_spellbook:{spells:[{slot:0,level:1,id:4},{slot:1,level:1,id:7},{slot:2,level:1,id:16}],activeSpellIndex:0,spellSlots:5}}"			
		},
		{
			"id": "minecraft:bread",
			"count": 6
		}
	],
	"animation": "wom:biped/skill/enderstep_forward",
	"offset": [0, -10]
}

id

The id is the registry name of an item (as used with the /give command).

count

Count determines how many of an item the player is given.

nbt

NBT determines the tag compound given to an item (in the same format as used in the /give command). Speech marks " must be escaped by putting a backslash \ before them to prevent the class file from failing to load. nbt is not required and will be blank by default.

slot

Slot determines the slot an item is given in, defaulting to mainhand.

Items given to mainhand will fill up empty slots in the inventory, starting with the hotbar, other slots will replace whatever item is currently in them.

Slots can also determine a curio slot if the mod is installed eg. curios:back curio slot items will default to mainhand if curios is not installed.

Here's a list of commonly used slots.

Commands

New to 1.1.5, classes can now run commands, these can be anything from giving a player a gamestage when they select the class, to leaving behind a trail of fire (or tnt) wherever they walk.

There are two methods of adding commands as shown in the below examples, you can either use a string value with just the command you want to run or a JSON object specifing the command and the "stage" that a command will run. When using just a string, if the stage property doesn't exist or has an invalid entry the property will default to pick_class.

When specifying commands @p will always be replaced with the player the command is currently firing for.

command stages

Below is a list of valid command stages.

Stage Additional Properties Description
pick_class N/A The command will run whenever a player is given the associated class perfect for granting gamestages or advancements
respawn N/A The command will run whenever a player is given the associated class, or respawns, perfect for giving things that reset on death like potion effects
attack N/A The command will run whenever a player with the class attacks an entity
hurt N/A The command will run whenever a player with the class is damaged
die N/A The command will run whenever a player with the class dies
kill N/A The command will run whenever a player with the class kills another entity
tick interval The command will run every X ticks where X is specified by the interval property, or if it doesn't exist, every tick
example1
{
	"index": 1,
	"attributes": {
		"generic.max_health": 20
	},
	"starting_skills": [],
	"items": [],
	"animation": "epicfight:biped/living/run",
	"offset": [0, 0],
	"commands": [
		"/gamestage add @p artificer true"
	]
}
example2
{
	"index": 11,
	"attributes": {
		"generic.max_health": 8,
		"paraglider:max_stamina": 26
	},
	"starting_skills": [],
	"items": [
		{
			"id": "minecraft:stone_sword",
			"slot": "mainhand"
		}
	],
	"animation": "epicfight:biped/living/run",
	"offset": [0, 0],
	"commands": [
		{
			"stage": "respawn",
			"command": "/effect give @p minecraft:fire_resistance 1000000 0 true"
		},
		{
			"stage": "tick",
			"interval": 5,
			"command": "/setblock ~ ~ ~ minecraft:fire keep"
		}
	]
}

Hidden

Hidden is an optional value, that is set false by default, but if set to true the class won't show up in the class selection GUI (but can still be accessed using the pickClass command)

example
{
	"index": 0,
	"attributes": {
		"generic.max_health": 100,
		"generic.attack_damage": 100,
		"generic.armor": 100,
		"generic.movement_speed": 0.2
	},
	"starting_skills": [],
	"items": [
		{
			"id": "minecraft:enchanted_golden_apple",
			"count": 64,
			"slot": "mainhand"
		}
	],
	"hidden": true,
	"animation": "epicfight:biped/combat/sword_auto1"
}

Animation (Epic Fight)

Animation determines the pose a player is rendered in if epic fight is installed as shown here.

Note: Animations currently do not work in the 1.20.1 version, due to massive changes in how epic fight handles it's rendering in recent versions.

Offset (Epic Fight)

Offset determines the placement of the epic fight player model when epic fight is installed. It accepts decimal and negative values.

The first value corresponds to the x position, how far right the model is shifted.

The second value corresponds to the y position, how far down the model is shifted.

In the following example from the dawncraft datapack the model is shifted up by 10 units.

example
{
	"index": 5,
	"attributes": {
		"generic.max_health": 16,
		"paraglider:max_stamina": 24
	},
	"starting_skills": [
		"epicfight:roll",
		"wom:ender_step"
	],
	"items": [
		{
			"id": "irons_spellbooks:wandering_magician_helmet",
			"slot": "head"
		},
		{
			"id": "irons_spellbooks:wandering_magician_chestplate",
			"slot": "chest"
		},
		{
			"id": "irons_spellbooks:iron_spell_book",
			"nbt": "{ISB_spellbook:{spells:[{slot:0,level:1,id:4},{slot:1,level:1,id:7},{slot:2,level:1,id:16}],activeSpellIndex:0,spellSlots:5}}"			
		},
		{
			"id": "minecraft:bread",
			"count": 6
		}
	],
	"animation": "wom:biped/skill/enderstep_forward",
	"offset": [0, -10]
}

Clone this wiki locally