Skip to content

New Loot Functions

DaFuqs edited this page Oct 21, 2024 · 4 revisions

Spectrum adds new loot functions that can be used in loot tables to add data to the generated items.

spectrum:dye_randomly

Colors a dyeable item, like leather armor, in a specific or random color.

Data

Entry Type Default Description
colors (optional) list of ints OR list of hex-strings A random color will be chosen from the list and used as coloring for the item. If not set a random color will be generated.

Example: Gives a random piece of leather armor, colored in one of 16 colors

{
  "rolls": 1,
  "entries": [
    {
      "type": "minecraft:item",
      "name": "minecraft:leather_boots"
    },
    {
      "type": "minecraft:item",
      "name": "minecraft:leather_chestplate"
    },
    {
      "type": "minecraft:item",
      "name": "minecraft:leather_helmet"
    },
    {
      "type": "minecraft:item",
      "name": "minecraft:leather_leggings"
    }
  ],
  "functions": [
    {
      "function": "spectrum:dye_randomly",
      "colors": [
        "#5cffed",
        "#eb40f0",
        "#eded17",
        "#0a0a0a",
        "#edf2fa",
        "#e76100",
        "#3b0338",
        "#ffc7de",
        "#d91a0a",
        "#b0c7ff",
        "#526b0f",
        "#3d4fc2",
        "#802bc4",
        "#70400d",
        "#adadad",
        "#424242"
      ]
    }
  ]
}

spectrum:ferment_randomly

For fermentable items, like Infused Beverages, applies fermentation to it, simulating it having aged a set of minecraft-days.

Data

Entry Type Description
days_fermented float provider The duration used for the fermentation calculation in minecraft days
thickness float provider the thickness used for the fermentation calculation
downfall float provider the downfall used for the fermentation calculation
fermentation_recipe_id identifier of a titration recipe the identifier of a valid Titration Recipe to pull titration data from (so you don't have to duplicate the values)
fermentation_data fermentation data Fermentation Data

Example

{
  "type": "minecraft:item",
  "name": "spectrum:infused_beverage",
  "functions": [
    {
      "function": "minecraft:set_nbt",
      "tag": "{Variant: \"gin\", Color: 16437201 }"
    },
    {
      "function": "spectrum:ferment_randomly",
      "fermentation_recipe_id": "spectrum:titration_barrel/infused_beverages/gin",
      "days_fermented": {
        "min": 6000,
        "max": 8000
      },
      "thickness": 1.0,
      "downfall": 1.0
    }
  ]
}

spectrum:merge_nbt_randomly

Similar to minecraft:set_nbt, but instead setting it to a fixed value, pulls a random nbt tag from a list.

Data

Entry Type Description
tags list of strings one of these entries will be chosen at random and added as nbt for the item

Example: Generates 1 Dirt using one of 3 names, selected randomly.

{
  "rolls": 1,
  "entries": [
    {
      "type": "minecraft:item",
      "name": "minecraft:dirt"
    }
  ],
  "functions": [
    {
      "function": "spectrum:merge_nbt_randomly",
      "tags": [
        "{display:{Name:'{\"translate\":\"named_item.spectrum.dirt_of_shame\"}'}}",
        "{display:{Name:'{\"translate\":\"named_item.spectrum.dirt_of_fame\"}'}}",
        "{display:{Name:'{\"translate\":\"named_item.spectrum.dirt_of_lame\"}'}}",
      ]
    },
  ]
}

spectrum:fill_potion_fillable

Used to set the effects for an item that can be filled with potion effects in the Potion Workshop.

Data

Entry Type Description
status_effect status effect id OR list of status effect ids The status effect that the item get's filled with. When using a list, a random one will get chosen.
amplifier int provider the effects amplifier (level 1 ^= potency 0)
duration int provider the effects duration
color ink color id (default: the effects color) the color for the effect
ambient boolean (default: false) if less intrusive particle effects should spawn
show_particles boolean (default: false) if no particle effects should spawn
ink_color one of the 16 minecraft colors OR list of the 16 minecraft colors the ink color required to pay for granting the effect
ink_cost int provider the amount of ink required to pay for granting the effect

Example: Gives a Lesser Potion Pendant with one of 3 status effects, requiring one of 3 colors of ink for providing its effect.

{
  "type": "minecraft:item",
  "name": "spectrum:lesser_potion_pendant",
  "functions": [
    {
      "function": "spectrum:fill_potion_fillable",
      "ambient": true,
      "show_particles": false,
      "duration": 3600,
      "status_effect": [
        "minecraft:strength",
        "minecraft:speed",
        "minecraft:haste"
      ],
      "color": -1,
      "amplifier": 2,
      "ink_color": [
        "spectrum:red",
        "spectrum:green",
        "spectrum:blue"
      ],
      "ink_cost": 4
    }
  ]
}
Clone this wiki locally