Skip to content

[Version 4.0] Presets

Alberto Del Villano edited this page Nov 12, 2023 · 4 revisions

A preset is a way to set some specific properties to a mob.

E.g. it lets you make a boss zombie that rarely spawns.

You can create a presets folder in the datapack within <namespace>/mobs_properties_randomness/presets, in here you want to add your presets. A preset is a Mob property file without the mob_id, entity_tag and presets keys.

Once you've created you preset you must add the preset to the mob with the presets key.

NOTE

Presets by default are exclusive to the mob (so other properties in the mob file will not be applied) unless the presets.mode is changed.

Weighted Preset

In the mob file under the presets.list key you'll have to add a Weighted preset. A weighted preset is a combination of a preset name (the preset file without the .json at end), a weight (chance to be chosen among all the presets) and a World Whitelist.

  • A weighted preset
    • id: The preset id (the preset file with the namespace and without the .json at end)
    • weight: The chance for the preset to be picked. Can be omitted and will default to 1
    • chance: Modifiable Value Object rapresenting the percentage chance (between 0 and 1) to apply the preset. If omitted the preset will always be applied.
    • world_whitelist: World Whitelist Object

Example

This examples shows how to make a "ghost" mob (an invisible silent zombie with glowing effect) that has 5% chance to spawn only above sea level.

In the <namespace>/mobs_properties_randomness/presets folder: ghost_zombie.json

{
    "potion_effects": [
        {
            "id": "minecraft:invisibility",
            "hide_particles": true
        },
        {
            "id": "minecraft:glowing",
            "hide_particles": true
        }
    ],
    "custom_name": {
        "overrides": [ "Ghost" ]
    },
    "silent": 1
}

In the mobs folder: zombie.json

{
    "mob_id": "minecraft:zombie",
    "presets": {
        "chance": 0.05,
        "list": [
            {
                "weight": 1,
                "id": "<namespace>:ghost_zombie",
                "world_whitelist": {
                    "deepness": {
                        "min": 64,
                        "max": 320
                    }
                }
            }
        ]
    }
}
Clone this wiki locally