Skip to content

[Version 4.0] Mobs

Insane96 edited this page Sep 24, 2023 · 5 revisions

After installing the mod you'll be able to create a folder called mobs_properties_randomness in a data pack and add stuff there.
This folder can contain two folders presets and mobs. So the data pack structure should look something like <namespace>/mobs_properties_randomness/presets and <namespace>/mobs_properties_randomness/mobs.

Create a new .json file in the mobs folder with whatever name you want (names starting with an _underscore and .comma will be ignored), and add the main key: the mob_id key, used to determine which mob will be affected by this JSON file. You can even use entity type tags with entity_tag to target multiple mobs.
As value you must put a valid resource location (modid:mob_id) value. E.g. minecraft:creeper or minecraft:raiders.

This should be the resulting json. This will target all creepers.

{
    "mob_id": "minecraft:creeper"
}

Or you can use Entity Type Tags

{
    "entity_tag": "minecraft:raiders"
}

These are the available properties for each mob file:

  • mob_id: id of the mob. Either this or entity_tag must be present
  • entity_tag: entity type tag. Either this or mob_id must be present
  • conditions: Conditions
  • potion_effects: Potion Effects
  • attributes: Attributes
  • equipment: Equipment
  • events: Events
  • mob specific properties: Creeper, Ghast, Phantom
  • loot_table: A string containing the loot table to apply to the mob. Useful for presets
  • silent: Modifiable Value Object percentage chance (between 0 and 1) for mob to be silent on spawn
  • experience_multiplier: Modifiable Value Object multiplier for experience dropped by the mob
  • custom_name:
    • chance: Modifiable Value Object percentage chance (between 0 and 1) for mob to get a name from the list on spawn
    • overrides: a string list of custom names to apply to the mob.
    • prefixes: a string list of prefixes to prepend to the mob's name. Works with override.
    • suffixes: a string list of suffixes to append to the mob's name. Works with override.
  • set_nbt: A List of Nbt Objects.
  • set_raw_nbt: A string representing the nbt of the mob. Will be applied to the mob on spawn
  • scale_pehkui: An array containing a list of ScalePehkui objects
    • A single ScalePehkui object
      • scale: Range Object for the scale amount
      • scale_types: A string list of resource locations containing the scale types to change. All the scale types in the list will have the same scale
  • priority: An integer value representing the order at which Mobs are applied. Higher priorities are applied first.
  • presets: Check here for more about presets
    • mode: How will the preset behave with the other properties in the file.
      "exclusive": when the preset is chosen the other properties will not apply. This is the default behaviour
      "before": the preset properties are applied before the mob properties. Note that equipment from mob properties will only apply with "override" set to true
      "after": the preset properties are applied after the mob properties. Note that equipment from the preset will only apply with "override" set to true
    • chance: Modifiable Value Object percentage chance (between 0 and 1) for mob to get a preset applied
    • apply_all: If true, all the presets are applied, not just a random one chosen via weight
    • list: a Weighted Presets list

Reload JSONs

Just reload data packs with /reload

Logs and errors

If the json seems to not work then check the MobsPropertiesRandomness.log file in the logs folder for any error. The errors are printed each time you /reload

What's a JSON file

Brief explanation:
JSON is a language-independent data format. Used both from humans for it's readability and machines for easy parsing. A JSON file consists of multiple key:value pairs wrote as "key":"value". Values can be either a string, a number, an object, an array or a boolean.

A sample JSON file should be structred like this

{
    "key": "value",
    "object": {
         "key_in_object": "value"
    },
    "array": [
         12.5,
         69.6
    ],
    "object_array": [
        {
            "key_in_object_in_array": true
        },
        {
            "key_in_object_in_array": false
        }
    ]
}
Clone this wiki locally