Minecraft Java Edition – Creating a Loot Table with Multiple Conditions for Advanced Gameplay

minecraft-commandsminecraft-java-edition

I was wondering about this: Is it possible to add multiple conditions to a function in Minecraft loot tables?

Best Answer

Yes. Here's an example loot table in which a stone sword's damage will only be set to 75% if the mob is killed by a player and a 50% random chance succeeds, otherwise it will drop an undamaged stone sword:

{
    "pools": [
        {
            "rolls": 1,
            "entries": [
                {
                    "type": "item",
                    "weight": 1,
                    "name": "minecraft:stone_sword",
                    "functions": [
                        {
                            "function": "set_damage",
                            "damage": 0.75,
                            "conditions": [
                                {
                                    "condition": "killed_by_player"
                                },
                                {
                                    "condition": "random_chance",
                                    "chance": 0.5
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}

Here's a loot table generator capable of adding multiple conditions:
https://jsfiddle.net/MrPingouin/125mx5r5/embedded/result/