Download Attribute Loot Condition — Minecraft Mods — MetaMods

Attribute Loot Condition

Active

Downloads

0

Last update

5 months ago

Versions

1.20.1 — 1.21.5
Server
Fabric
Forge
Neoforge
Game mechanics
Utils

Attribute Loot Condition

🪄 About the Modification

This mod introduces a new type of condition for loot tables (so-called predicates), allowing to configure dropped loot based on entity characteristics.

Works well with modifications that implement mob attribute scaling, such as RpgDifficulty and L2 Hostility.

⚙️ Parameter Configuration

The default configuration file looks as follows:

(config/attribute_loot_condition.json)

{
  "attributeWeights": [
    {
      "attribute": "minecraft:generic.max_health",
      "weight": 1.0
    },
    {
      "attribute": "minecraft:generic.armor",
      "weight": 1.0
    },
    {
      "attribute": "minecraft:generic.armor_toughness",
      "weight": 1.0
    },
    {
      "attribute": "minecraft:generic.attack_damage",
      "weight": 1.0
    }
  ]
}

The elements in this array determine weight coefficients for various characteristics.

You can configure additional attributes, not limited to only these four.

📜 Usage Example

In JSON format, comments are not allowed, but in this case they are added for clarification.

Datapack:

data/minecraft/loot_tables/entities/zombie.json

{
    "pools": [
        {
            "rolls": 1,
            "entries": [
                {
                    "type": "item",
                    "name": "minecraft:apple"
                }
            ],
            "conditions": [
                {
                    "condition": "attribute_loot_condition:attribute_weighted_sum",
                    "entity": "this",
                    "min": 20,
                    "max": 0  // Value not greater than 0 cancels this check
                }
            ]
        }
    ]
}

After loading this datapack, when a player kills a zombie, the game calculates the weighted sum of the zombie's maximum health, armor, armor toughness, and damage. If this sum is at least 20, then the condition is considered fulfilled.

Project members
Karashok-Leo

Karashok-Leo

Developer

Karashok_Leo

Karashok_Leo

Created: 26 Aug 2024

ID: 51057