mojira.dev
MCPE-188723

Add-on Loot Tables match tool condition drops items when bare hand used

When coding add-on loot tables using the condition match tool players can use their hands instead of the designated tool to obtain the loot.

 

Steps to Reproduce:

  1. Code a loot table file for either an entity or block.

  2. Include in the loot table file the following match tool condition code:

    1. {
      "condition": "match_tool",
      "item": "minecraft:gold_sword"
      }

  3. Use your empty hand instead of the Gold Sword to make the entity drop the item

 

Observed Results:

Item will drop when using empty hand slot

Expected Results:

Item does not drop when using empty hand

Attachments

Comments 4

Could you attach an example add-on to this report?

Hello.
I've attached an example

[media]

that replaces the cow's loot table with one that uses the "match_tool" condition.

The cow should drop an apple when killed with a wooden sword.
This does work when tested, but if the cow is killed with your bare hand, it still drops an apple.

Here is the cow.json loot table included in the Example Pack.

{
    "pools": [
        {
            "conditions": [
                {
                    "condition": "killed_by_player"
                },
                {
                    "condition": "match_tool",
                    "item": "minecraft:wooden_sword"
                }
            ],
            "rolls": 1,
            "entries": [
                {
                    "type": "item",
                    "name": "minecraft:apple",
                    "weight": 1
                }
            ]
        }
    ]
}

Hello.
I've attached an example

[media]

that replaces the cow's loot table with one that uses the "match_tool" condition.

The cow should drop an apple when killed with a wooden sword.
This does work when tested, but if the cow is killed with your bare hand, it still drops an apple.

Here is the cow.json loot table included in the Example Pack.

{
    "pools": [
        {
            "conditions": [
                {
                    "condition": "killed_by_player"
                },
                {
                    "condition": "match_tool",
                    "item": "minecraft:wooden_sword"
                }
            ],
            "rolls": 1,
            "entries": [
                {
                    "type": "item",
                    "name": "minecraft:apple",
                    "weight": 1
                }
            ]
        }
    ]
}

GodRosen

(Unassigned)

Unconfirmed

Windows

Windows 10

1.21.44 Hotfix

Retrieved