Skip to content

Data Pack support

Sky James edited this page May 5, 2023 · 10 revisions

Introduction

Extra Golems for 1.16.5+ allows users to add golems using data packs and resource packs. Each golem is defined by two JSON files. By simply adding these files, you can customize your Extra Golems experience!

Removing golems

To remove a golem, you can create a data pack with empty JSON files for each of the golems you would like to remove. The JSON file should be saved as data/<pack_id>/golems/golem_stats/<material>.json where <material> is the ID of the golem to remove. See Data file for more details. The contents of the file should be empty curly braces:

{}

In some versions of Extra Golems, the attributes field is required:

{
  "attributes": {}
}

Return to top

Data file

The first file required for a golem is the JSON that defines its attributes and behavior (health, attack damage, building blocks, multitexture settings, AI, etc.). This information is sent from the server to the client when using multiplayer. These files are stored in a data pack.

This file is stored as data/<pack_id>/golems/golem_stats/<material>.json. <pack_id> is a unique namespace for the golem. <material> is a block or material, but can be anything so long as the name is unique.

Return to top

Data format

Here is a list of all accepted values in the data file.

  • attributes (Required): The attributes of the golem. See Attributes
  • swim_ability (Optional): How the golem interacts with water. Values are "sink" (the golem sinks in water), "float" (the golem floats in water), or "swim" (the golem swims in water). Defaults to "sink".
  • glow (Optional): Maximum light level provided by the golem. Values are 0-15. Defaults to 0.
  • power (Optional): Maximum power level provided by the golem. Values are 0-15. Defaults to 0.
  • hidden (Optional): Whether to omit the golem from the Extra Golems Guide Book. Defaults to false.
  • sound (Optional): The sound played when the golem moves or attacks. Values are a sound resource location. Defaults to "minecraft:block.stone.step".
  • blocks (Required if not multitexture): The blocks or block tags that are used to build the golem. Accepts a list (or single entry) of resource locations. Block IDs are in the form "mod:block_name" and block tags are in the form "#mod:tag_name"
  • heal_items (Optional): A map of items or item tags that can heal the golem, along with the percentage of health restored by each one. Accepts resource location and number pairs. Block IDs are in the form "mod:block_name" and block tags are in the form "#mod:tag_name"
  • multitexture (Optional): The multiple textures settings of the golem. See Multitexture data
  • behavior (Optional): The list of the golem's behaviors. See Behavior

Return to top

Attributes

The attributes of the golem. Contains the following values:

  • health (Optional): The maximum health of the golem. Defaults to 100.0.
  • attack (Optional): The attack damage dealt by the golem. Defaults to 15.0.
  • attack_knockback (Optional): The knockback strength of the golem. Defaults to 0.0.
  • speed (Optional): The movement speed of the golem. Defaults to 0.25.
  • knockback_resistance (Optional): The knockback resistance of the golem. Defaults to 0.4.
  • armor (Optional): The armor stat of the golem. Defaults to 0.0
  • immune_to_fire (Optional): Whether the golem is immune to fire damage. Defaults to false.
  • immune_to_explosions (Optional): Whether the golem is immune to blast damage. Defaults to false.
  • hurt_by_fall (Optional): Whether the golem takes damage when falling. Defaults to false.
  • hurt_by_water (Optional): Whether the golem takes damage when in water or rain. Defaults to false.
  • hurt_by_heat (Optional): Whether the golem takes damage when in warm biomes. Defaults to false.

Return to top

Multitexture data

When the multitexture value is added to a data file, the golem is able to change textures. This makes it easier to create golems that have identical stats and behavior but have different textures. Here are the values that are used:

  • texture_count (Required): The number of textures
  • cycle (Optional): Whether the golem changes to the next texture when clicked on by the player. Defaults to false.
  • textures (Required): A map of texture IDs, along with various settings associated with each one. Each value is in the form "<texture_id>": <entry>. See Multitexture data entry

Return to top

Multitexture data entry

Each multitexture entry specifies the following:

  • blocks (Optional): The blocks or block tags that are associated with this texture. Accepts a list (or single entry) of resource locations. Block IDs are in the form "mod:block_name" and block tags are in the form "#mod:tag_name"
  • loot_table (Optional): The loot table resource location to use when the golem with this texture is killed. If unspecified, the golem's main loot table is used. See (Loot table)[#loot-table].
  • light (Optional): The light provided by the golem when it has this texture. Can only be used if glow was defined earlier to specify a maximum light level. Defaults to 0.

Return to top

Multitexture data example

"multitexture": {
  "texture_count": 2,
  "textures": {
    "0": {
      "blocks": [
        "minecraft:mushroom_stem",
        "minecraft:brown_mushroom_block"
      ],
      "loot_table": "golems:mushroom/brown"
    },
    "1": {
      "blocks": "minecraft:red_mushroom_block",
      "loot_table": "golems:mushroom/red"
    }
  }
}

Return to top

Behavior

This list is used to add special behavior to the golem such as shooting arrows, passive potion effects, lighting enemies on fire, freezing water, and more. Multiple behaviors of the same type can be added, but some behaviors will only use the first entry (for example, the crafting menu behavior).

Return to top

Behavior entry

  • type (Required): Determines which behavior is added to the golem and what other information will be needed. Accepts a resource location ID of a behavior. Acceptable values are listed below.
    • golems:aoe_dry: Allows the golem to remove water/waterlogged blocks
    • golems:aoe_freeze: Allows the golem to freeze water and lava
    • golems:aoe_grow: Allows the golem to grow nearby crops
    • golems:burn_in_sun: Causes the golem to burn in sunlight and seek shelter during the day
    • golems:change_texture: Causes a multitexture golem to change its texture based on conditions such as being wet/dry, fueled/empty, or randomly each tick
    • golems:crafting_menu: Allows a player to open a crafting menu when clicking on the golem
    • golems:explode: Causes the golem to create explosions when killed and sometimes when attacking or hurt
    • golems:follow: Causes the golem to detect and follow a specific type of entity
    • golems:hurt: Allows the golem to react when hurt, such as fire, potion effects, or summoning an entity
    • golems:attack: Allows the golem to use a special attack, such as fire, potion effects, or summoning an entity
    • golems:place_blocks: Allows the golem to passively place specific blocks
    • golems:passive_effect: Gives the golem a potion effect chosen from a list
    • golems:shoot_arrows: Allows the golem to pick up, store, and shoot arrows
    • golems:split_on_death: Causes the golem to spawn mini-golems upon death
    • golems:teleport: Causes the golem to teleport randomly when hurt, attacking, or idle
    • golems:tempt: Causes the golem to follow players who are holding specific items
    • golems:use_fuel: Causes the golem to require fuel to move and attack

Return to top

AOE Dry

Allows the golem to remove water/waterlogged blocks.

  • type: "golems:aoe_dry"
  • range: The radius of affected blocks. Defaults to 0.
  • interval: The (average) number of ticks between water-absorbing cycles. Defaults to 0.
  • sphere: true to affect a spherical area around the golem, false to affect a disk-shaped area below the golem. Defaults to false.

Used in the Sponge Golem.

Return to behavior entry

AOE Freeze

Allows the golem to change lava to obsidian/cobblestone and water to ice/packed ice.

  • type: "golems:aoe_freeze"
  • range: The radius of affected blocks. Defaults to 0.
  • interval: The (average) number of ticks between liquid-freezing cycles. Defaults to 0.
  • sphere: true to affect a spherical area around the golem, false to affect a disk-shaped area below the golem. Defaults to false.
  • frosted: true to replace water with frosted (temporary) ice. Defaults to false.

Used in the Ice Golem.

Return to behavior entry

AOE Grow

Allows the golem to grow nearby crops.

  • type: "golems:aoe_grow"
  • range: The radius of affected blocks. Defaults to 0.
  • interval: The (average) number of ticks between crop-growing cycles. Defaults to 0.
  • chance: The percent chance [0.0 - 1.0] for each nearby crop to grow

Used in the Hay Golem.

Return to behavior entry

Burn In Sun

Causes the golem to burn in sunlight and seek shelter during the day.

  • type: "golems:burn_in_sun"
  • priority: The goal priority, usually 1
  • chance: The percent chance [0.0 - 1.0] for the golem to light on fire each tick that it is in direct sunlight

Used in the Bone Golem.

Return to behavior entry

Change Texture

Causes a multitexture golem to change its texture based on conditions such as being wet/dry, fueled/empty, or randomly each tick.

  • type: "golems:change_texture"
  • tick: Causes the golem to try to change its texture each tick.
    • chance: The percent chance [0.0 - 1.0] for the golem to change its texture
    • textures: A map of texture IDs. The key is the current texture and the value is the desired texture if the random chance passed. If a key-value pair is not specified for a texture ID, then the texture will not change.
  • wet: Causes the golem to try to change its texture each tick that it is wet. When present, the dry map must also be specified.
    • chance: Same as above
    • textures: Same as above
  • dry: Causes the golem to try to change its texture each tick that it is not wet. When present, the wet map must also be specified.
    • chance: Same as above
    • textures: Same as above
  • fuel: Causes the golem to try to change its texture each tick that it is has fuel. When present, the fuel_empty map must also be specified.
    • chance: Same as above
    • textures: Same as above
  • fuel_empty: Causes the golem to try to change its texture each tick that it does not have fuel. When present, the fuel map must also be specified.
    • chance: Same as above
    • textures: Same as above

Used in the Coral Golem, Furnace Golem, and Copper Golem.

Return to behavior entry

Crafting Menu

Allows a player to open a crafting menu when clicking on the golem.

  • type: "golems:crafting_menu" There are no other parameters.

Used in the Crafting Golem.

Return to behavior entry

Explode

Causes the golem to create explosions when killed and sometimes when attacking or hurt.

  • type: "golems:explode"
  • range: The radial size of the explosion. Defaults to 0.0
  • fuse: The minimum time to wait after being ignited before causing an explosion. Defaults to 0
  • chance_on_hurt: The percent chance [0.0 - 1.0] for the golem to light its fuse when hurt
  • chance_on_attack: The percent chance [0.0 - 1.0] for the golem to light its fuse when attacking

Used in the TNT Golem.

Return to behavior entry

Follow

Causes the golem to detect and follow a specific type of entity.

  • type: "golems:follow"
  • priority: The goal priority, usually 3
  • entity: The "modid:entity_name" of the entity to follow

Used in the Emerald Golem.

Return to behavior entry

Hurt

Allows the golem to react when hurt, such as fire, potion effects, or summoning an entity

  • type: "golems:hurt"
  • fire: If present, allows the golem to set fire to either itself or its enemy
    • target: Can be "self" to apply fire to the golem, or "enemy" to apply fire to its attack target
    • chance: The percent chance [0.0 - 1.0] for the golem to apply fire
    • time: The amount of time (in seconds) that the entity will be on fire
  • effect: If present, allows the golem to apply a potion effect to itself or its enemy
    • target: Can be "self" to apply the effect to the golem, or "enemy" to apply the effect to its attack target
    • chance: The percent chance [0.0 - 1.0] for the golem to apply the effect
    • effects: The possible potion effects. One will be chosen at random from the list.
      • Potion: The "modid:potion_name" of the effect
      • Amplifier: The effect amplifier
      • Duration: The duration of the effect in ticks
  • summon: If present, allows the golem to summon an entity
    • target: Can be "enemy" to make the summoned entity angry at the golem's enemy
    • summon_pos: Can be "self" to summon the entity on the golem or "enemy" to summon the entity on its attack target
    • chance: The percent chance [0.0 - 1.0] for the golem to summon the entity
    • bonus_chance_in_rain: The additional percent chance [0.0 - 1.0] for the golem to summon the entity while it is raining
    • entity: A Compound NBT Tag containing the entity id and other data, if any

Used in the Magma Golem, Honeycomb Golem, Lapis Golem, and others.

Return to behavior entry

Attack

Allows the golem to use a special attack, such as fire, potion effects, or summoning an entity

  • type: "golems:attack"
  • fire: Same as above.
  • effect: Same as above.
  • summon: Same as above.

Used in the Magma Golem, Honeycomb Golem, Lapis Golem, and others.

Return to behavior entry

Place Blocks

Allows the golem to passively place specific blocks.

  • type: "golems:place_blocks"
  • interval: The average number of ticks between placing a block
  • blocks: A list of blocks. One is chosen randomly to attempt to place. Block IDs are in the form "mod:block_name" and block tags are in the form "#mod:tag_name"

Used in the Melon Golem, Stem Golem, Moss Golem, Mushroom Golem.

Return to behavior entry

Passive Effect

Gives the golem a potion effect chosen from a list.

  • type: "golems:passive_effect"
  • effect: Allows the golem to apply a potion effect to itself or its enemy only if the target has no active potion effects
    • target: Can be "self" to apply the effect to the golem, or "enemy" to apply the effect to its attack target
    • chance: The percent chance [0.0 - 1.0] for the golem to apply the effect
    • effects: The possible potion effects. One will be chosen at random from the list.
      • Potion: The "modid:potion_name" of the effect
      • Amplifier: The effect amplifier
      • Duration: The duration of the effect in ticks

Used in the Leaves Golem and Bookshelf Golem.

Return to behavior entry

Shoot Arrows

Allows the golem to pick up, store, and shoot arrows.

  • type: "golems:shoot_arrows"
  • damage: The amount of damage dealt by arrows. Defaults to 0.0.

Used in the Dispenser Golem.

Return to behavior entry

Split on Death

Causes the golem to spawn mini-golems upon death.

  • type: "golems:split_on_death"
  • children: The number of mini golems to spawn. Defaults to 0

Used in the Slime Golem, Magma Golem, and Honey Golem.

Return to behavior entry

Teleport

Causes the golem to teleport randomly when hurt, attacking, or idle.

  • type: "golems:teleport"
  • chance_on_idle: The percent chance [0.0 - 1.0] for the golem to teleport randomly each tick when not fighting. Defaults to 0.0
  • chance_on_hurt: The percent chance [0.0 - 1.0] for the golem to teleport randomly each time it is hurt. Defaults to 0.0
  • chance_on_target: The percent chance [0.0 - 1.0] for the golem to teleport to its enemy each tick that it is attacking. Defaults to 0.0

Used in the Endstone Golem and Purpur Golem.

Return to behavior entry

Tempt

Causes the golem to follow players who are holding specific items.

  • type: "golems:tempt"
  • item: The item that the player must be holding to tempt the golem. Item IDs are in the form "mod:item_name" and item tags are in the form "#mod:tag_name"

Used in the Furnace Golem.

Return to behavior entry

Use Fuel

Causes the golem to require fuel to move and attack. Hostile creatures do not attack golems that run out of fuel.

  • type: "golems:use_fuel"
  • max_fuel: The maximum amount of fuel that can be stored. Defaults to 0
  • burn_interval: The number of ticks until one unit of fuel is consumed. Defaults to 0

Used in the Furnace Golem.

Return to behavior entry

Behavior example

Here is an example of a golem with 5 behaviors.

  1. golems:hurt: The golem has a 90% chance to light enemies on fire for 4 seconds when the golem is hurt.
  2. golems:split_on_death: The golem spawns 2 mini-golems when it is killed.
  3. golems:place_blocks: Once every 1100 ticks (on average), the golem chooses a sapling, tall flower, or warped fungus at random. If the golem is standing on a block that can support the sapling/flower/fungus, then it places the chosen block.
  4. golems:attack: The golem has a 40% chance to apply the "Levitation" effect to its enemy when the golem attacks.
  5. golems:change_texture: The golem has a 0.01% chance to change its texture every tick from t0->t1, t1->t2, t2->t3, and t3->t3 (because "3" is left unspecified). This behavior will not trigger if the golem does not have multitexture settings.
"behavior": [ 
  {
    "type": "golems:hurt",
    "fire": {
      "target": "enemy",
      "chance": 0.9,
      "time": 4
    }
  },
  {
    "type": "golems:split_on_death",
    "children": 2
  },
  {
    "type": "golems:place_blocks",
    "interval": 1100,
    "blocks": [
      "#minecraft:saplings",
      "#minecraft:tall_flowers",
      "minecraft:warped_fungus"
    ]
  },
  {
    "type": "golems:attack",
    "effect": {
      "target": "enemy",
      "chance": 0.4,
      "effects": [
        {
          "Potion": "minecraft:levitation",
          "Amplifier": 0,
          "Duration": 90
        }
      ]
    }
  },
  {
    "type": "golems:change_texture",
    "tick": {
      "chance": 0.00010,
      "textures": {
        "0": 1,
        "1": 2,
        "2": 3
      }
    }
  }
]

Return to top

Data format example

Here is a complete example of a valid golem data JSON.

  1. attributes: The golem has 20 health, 9 attack, moves at normal speed, has 40% knockback resistance, no natural armor, is not immune to fire or explosions, and is hurt by fall damage and warm biomes.
  2. The golem floats on top of water, has a maximum light level of 15, does not provide redstone power, and is not hidden from the Golem Guide Book. The golem uses the "glass block step" sound and is constructed using redstone lamp blocks (although this entry is redundant because it has multitexture settings). The player can heal the golem using redstone lamp blocks or any item in the forge:dusts/glowstone item tag.
  3. multitexture: The golem has 2 textures. Clicking on the golem will cycle to the next texture. When using a redstone lamp to build the golem, it starts with texture 0 which has a light level of 15. If killed with texture 0, the golem drops items in the golems:redstone_lamp/lit loot table. Texture 1 has a light level of 0. If the golem is killed with texture 1 it drops items in the golems:redstone_lamp/unlit loot table.
  4. behavior: The golem has 2 behaviors:
  • golems:aoe_freeze: Every 4 ticks (on average), the golem changes water / lava into frosted ice / obsidian in a 3-block radius disk (6-block diameter) around it.
  • golems:change_texture: Every tick that the golem is wet, it has a 20% chance to change from texture 0 to texture 1. Nothing happens when the golem is not wet.
{
  "attributes": {
    "health": 20.0,
    "attack": 9.0,
    "speed": 0.25,
    "knockback_resistance": 0.4,
    "armor": 0,
    "knockback": 0.0,
    "immune_to_fire": false,
    "immune_to_explosions": false,
    "hurt_by_water": false,
    "hurt_by_fall": true,
    "hurt_by_heat": true
  },
  "swim_ability": "float",
  "glow": 15,
  "power": 0,
  "hidden": false,
  "sound": "minecraft:block.glass.step",
  "blocks": "minecraft:redstone_lamp",
  "heal_items": {
    "minecraft:redstone_lamp": 0.5,
    "#forge:dusts/glowstone": 0.15
  },
  "multitexture": {
    "texture_count": 2,
    "cycle": true,
    "textures": {
      "0": {
        "blocks": "minecraft:redstone_lamp",
        "light": 15,
        "loot_table": "golems:redstone_lamp/lit"
      },
      "1": {
        "light": 0,
        "loot_table": "golems:redstone_lamp/unlit"
      }
    }
  },
  "behavior": [
    {
      "type": "golems:aoe_freeze",
      "range": 3,
      "interval": 4,
      "sphere": false,
      "frosted": true
    },
    {
      "type": "golems:change_texture",
      "wet": {
        "chance": 0.2,
        "textures": {
          "0": 1,
          "1": 1
        }
      },
      "dry": {
        "chance": 0.0,
        "textures": { }
      }
    }
  ]
}

Return to top

Loot table

Loot tables are expected to be saved as data/<pack_id>/loot_tables/entities/<material>.json. <pack_id> is the namespace for the golem. <material> is the material of the golem.

For multitexture golems, the loot table can be specified per-texture. If no texture is specified, the above loot table will be expected.

Loot table explanations and tools:

Return to top

Resource file

The second file required for a golem is the JSON that defines how it is rendered in-game (texture, vines, eyes, color, etc.). This information is synced from the server to the client. These files are stored in a data pack.

This file is stored as data/<pack_id>/golems/golem_models/<material>.json. <pack_id> is a unique namespace for the golem and must match the pack_idfrom the data file. <material> is a block or material and must match the material from the data file.

Return to top

Resource format

  • base (Required if not multitexture): The block texture or prefabricated entity texture to use for the golem. For example, the resource location minecraft:clay would create a texture using the image at assets/minecraft/textures/block/clay.png. The resource location #golems:dispenser would directly use the image at assets/golems/textures/entity/golem/dispenser.png. The # indicates a prefabricated entity texture.
  • base_template (Optional): Used to create golem textures that use more than one block texture (such as the Mushroom Golem and Wool Golem). Accepts a resource location without the # prefix. Defaults to "golems:template" which resolves to assets/golems/textures/entity/golem/template.png. Defaults to "golems:template".
  • base_color (Optional): Colorizes the texture. Accepts a decimal version of a hex color. Defaults to -1 which means "no color".
  • base_light (Optional): true to display the golem's texture without lighting (glows in the dark). Defaults to false to use ambient lighting.
  • use_biome_color (Optional): true to colorize based on the current biome foliage color. Defaults to false. Used in Leaves Golem.
  • translucent (Optional): true if the block or entity texture is translucent.
  • eyes (Optional): A simple layer for the golem eyes. Defaults to golems:layer/eyes/eyes.
  • vines (Required): A simple layer for the golem vines. Defaults to golems:layer/vines with color value 8626266.
  • layers (Required): A list of simple layers, such as vines, eyes, or decoration.

Return to top

Layer

  • texture (Required): The block texture or prefabricated entity texture to use for the golem. For example, #golems:layer/vines resolves to the image at assets/golems/textures/entity/golem/layer/vines.png.
  • template (Optional): Used to create golem textures that use more than one block texture (such as the Mushroom Golem and Wool Golem). Accepts a resource location without the # prefix. Defaults to "golems:template".
  • color (Optional): Colorizes the layer. Accepts a decimal version of a hex color. Defaults to -1 which means "no color"
  • light (Optional): true to display the layer without lighting (glows in the dark). Defaults to false to use ambient lighting.
  • translucent (Optional): true if the layer is translucent.

Common colors for the vines layer:

  • green = 8626266
  • blue = 23157
  • dark blue = 2070638
  • red = 11543845
  • aqua = 2070638
  • brown = 5127460
  • purple = 5121902

Return to top

Multitexture resource

When the multitexture value is added to a data file, it must also be added to the assets file to determine which texture ID uses which texture image. There is only one entry

  • base_map (Required): A map of texture IDs to the block or entity image associated with that texture ID. Uses the same format as Resource format base to accept either a block texture or a prefabricated entity texture.

Return to top

Resource format example

Here is a complete example of a valid golem resource JSON.

  1. The first entry (base) is ignored because multitexture defines a map of texture IDs to base block textures.
  2. The default template is used, with no color, no biome color, no forced lighting, and no transparency.
  3. Texture ID 0 uses the image at assets/minecraft/textures/block/copper_block.png, and so on for the other texture IDs.
  4. The golem has no vines. This is indicated by an empty layer {}
  5. The golem has normal eyes with no color and no forced lighting. This is the default setting when eyes is omitted.
  6. The golem has one additional layer:
  • #golems:layer/crying_obsidian: Uses the image at assets/golems/textures/entity/golem/layer/crying_obsidian.png with forced lighting (glows in the dark)
{
  "base": "minecraft:copper_block",
  "base_template": "golems:template",
  "base_color": -1,
  "use_biome_color": false,
  "base_light": false,
  "translucent": false,
  "multitexture": {
    "base_map": {
      "0": "minecraft:copper_block",
      "1": "minecraft:exposed_copper",
      "2": "minecraft:weathered_copper",
      "3": "minecraft:oxidized_copper"
    }
  },
  "vines": {},
  "layers": [
    {
      "texture": "#golems:layer/crying_obsidian",
      "light": true
    }
  ]
}

Return to top