Custom Raid Starter - HungTeen/HTLib GitHub Wiki
Preparation
Data Pack Template
Custom raids are driven by data packs, so you’ll need to prepare a data pack template first. You can refer to this link。
JSON Editor
In addition to the data pack template, you'll need to be able to edit data packs and understand the JSON format. The simplest and most straightforward way to edit JSON is by using a text editor.
Custom Raid Path Structure
- mod_id: The namespace of your data pack.
- extra_models: Contains custom models used by the data pack.
- raid_item: Stores configurations for raid-related items.
- raid: Stores components for raids.
- wave: Stores components for each wave.
- spawn: Stores components related to monster spawning.
- position: Stores components for placement behavior.
- result: Stores result-related components.
.
├── assets
│ └── mod_id
│ └── extra_models
│ └── xxx.json
└── data
└── mod_id
└── htlib
├── raid_item
├── raid
├── wave
├── spawn
├── position
└── result
First Raid
To create your first raid, add the following JSON file named first_raid.json under the raid directory. This raid includes two waves of monsters and uses built-in presets from the mod.
{
"type": "htlib:common",
"setting": {
"bar_setting": {
"raid_bar_color": "blue"
},
"border_setting": {},
"sound_setting": {
"loss_sound": "htlib:loss",
"raid_start_sound": "htlib:prepare",
"victory_sound": "htlib:victory",
"wave_start_sound": "htlib:huge_wave"
},
"victory_results": [
"htlib:test"
]
},
"waves": [
"htlib:test_1",
"htlib:test_2"
]
}
To verify whether the raid was successfully added, you can use the following command in-game after joining a world (be sure to replace mod_id with your data pack’s namespace):
/htlib raid create htlib:default_raid mod_id:first_raid ~ ~ ~
First Raid Item
Using commands to summon raids can be inconvenient, so the mod also provides a way to summon raids using special items.
{
"dummy_entity_type": "htlib:default_raid",
"item_setting": {
"model": "mod_id:first_raid_item",
},
"raid": "mod_id:first_raid"
}
The above first_raid_item.json defines an item with a custom model that can summon a raid.
To ensure this model loads correctly, you also need to add the following first_raid_item.json to assets/mod_id/extra_models/:
{
"models": [
"mod_id:first_raid_item"
]
}
And the actual item model should be placed under assets/mod_id/models/item/first_raid_item.json, like this:
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "htlib:item/raid_envelope"
}
}
With this setup, the raid-summoning item will display correctly in-game.