LootItem

Inherits: Resource

Resource representing a single item entry in a loot table with weight and amount ranges.

Description

The LootItem resource represents an individual entry in a Loot table. It defines which item can be generated, its probability weight relative to other items in the same loot table, the range of amounts that can be generated, and optional property ranges for randomizing item properties.

Higher weight values make the item more likely to be selected during random generation. The min_amount and max_amount define the range for random quantity generation when this item is selected.

Property ranges allow you to specify randomized values for item properties when the item is generated. This enables Minecraft-style loot generation where items can have randomized durability, damage, enchantments, or other properties within configurable ranges.

Properties

String

item_id

""

int

max_amount

1

int

min_amount

1

Dictionary

property_ranges

{}

float

weight

1.0


Property Descriptions

String item_id = "" 🔗

  • void set_item_id(value: String)

  • String get_item_id()

The ID of the item that this loot entry represents. This should correspond to an ItemDefinition ID in the InventoryDatabase.


int max_amount = 1 🔗

  • void set_max_amount(value: int)

  • int get_max_amount()

The maximum amount of this item that can be generated when this loot entry is selected. The actual amount will be randomly chosen between min_amount and this value (inclusive).


int min_amount = 1 🔗

  • void set_min_amount(value: int)

  • int get_min_amount()

The minimum amount of this item that will be generated when this loot entry is selected. The actual amount will be randomly chosen between this value and max_amount (inclusive).


Dictionary property_ranges = {} 🔗

  • void set_property_ranges(value: Dictionary)

  • Dictionary get_property_ranges()

Dictionary defining randomized value ranges for item properties. Keys are property names (String), values are dictionaries defining the range configuration.

For integer/float ranges: {"min": value, "max": value}

For boolean values: {"value": bool}

Example: {"durability": {"min": 30, "max": 50}, "enchanted": {"value": true}}

When the loot item is generated, these ranges will override the default property values from the ItemDefinition, providing randomized values within the specified ranges.


float weight = 1.0 🔗

  • void set_weight(value: float)

  • float get_weight()

The probability weight of this loot item relative to other items in the same Loot table. Higher values increase the chance of this item being selected. For example, an item with weight 10.0 is twice as likely to be selected as an item with weight 5.0.