2

I have a loot table that makes it so logs only drop when mined with an axe; That part was easy. But I noticed it did not drop to creeper explosions/tnt due to failing the match tool check, which obviously I would like to fix if possible.

I am now having difficulties making it also drop from explosions and the below should work but does not seem to be.

  "type": "minecraft:block",
  "pools": [
    {
      "rolls": 1,
      "bonus_rolls": 0,
      "entries": [
        {
          "type": "minecraft:alternatives",
          "children": [
            {
              "type": "minecraft:item",
              "name": "minecraft:acacia_log",
              "conditions": [
                {
                  "condition": "minecraft:match_tool",
                  "predicate": {
                    "items": [
                      "minecraft:wooden_axe",
                      "minecraft:stone_axe",
                      "minecraft:iron_axe",
                      "minecraft:golden_axe",
                      "minecraft:diamond_axe",
                      "minecraft:netherite_axe"
                    ]
                  }
                }
              ]
            },
            {
              "type": "minecraft:item",
              "name": "minecraft:acacia_log",
              "conditions": [
                {
                  "condition": "minecraft:survives_explosion"
                },
                {
                  "condition": "minecraft:inverted",
                  "term": {
                    "condition": "minecraft:entity_properties",
                    "entity": "this",
                    "predicate": {
                      "type": "minecraft:player"
                    }
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

What am I doing wrong? Why is it not dropping from tnt? Is that somehow passing the not-player check? I tried it with creepers too since maybe tnt lit by players still counts, and same thing.

5
  • From a JSON perspective, I would think you should be specifying all of the conditions within the first conditions array rather than as new objects because you already specified minecraft:acacia_log in the children array. But, I don't know what Minecraft expects.
    – Timmy Jim
    Commented Aug 23, 2022 at 14:17
  • To my undertsanding, "alternatives" causes minecraft to iterate through until it finds one that it matches, then it exits and does not continue, the behavior that I need. That is why each drop has conditions individually.
    – Aceplante
    Commented Aug 23, 2022 at 16:10
  • @Aceplante right, but it's worth trying, no?
    – Corsaka
    Commented Aug 24, 2022 at 10:35
  • Do you want the block to drop upon any explosion, regardless of the power or radius? You have programmed the minecraft:survives_explosion condition, which is programmed to fail if the explosion is too large or too close, which will stop the item from dropping at all.
    – One 2 Many
    Commented Aug 28, 2022 at 6:16
  • I guess if thats the only way, but Id prefer if regular explosion mechanics applied. Like I said, I want wood to only be mineable (by the player) with an axe, but tnt should still work
    – Aceplante
    Commented Aug 28, 2022 at 19:59

1 Answer 1

2

For some reason, removing the "survives explosion" check on the second part allows it to drop, and it now works as intended

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .