Spawner Loot_table not working properly, any ideas?

Help | Java 1.17

I was looking up different data packs that allows for spawners to be silk ouch mineable however they all seemed unreasonably over the top for what was trying to be accomplished. I started messing around with loot tables and thought I came up with something good but it doesn't work, or at least needs a touch up. I'll post the code and explain my thinking right after.

{
    "type": "minecraft:block",
    "pools": [
      {
        "rolls": 1,
        "entries": [
          {
            "type": "minecraft:item",
            "name": "minecraft:spawner",
            "functions": [
              {
                "function": "minecraft:set_nbt",
                "tag": "{Item:{id:\"minecraft:spawner\",Count:1b,tag:{BlockEntityTag:{SpawnData:{entity:{id:\"minecraft:skeleton\"}},SpawnPotentials:[{weight:1,data:{entity:{id:\"minecraft:skeleton\"}}}]}}}}",
                "conditions": [
                  {
                    "condition": "minecraft:location_check",
                    "offsetX": 0,
                    "offsetY": 0,
                    "offsetZ": 0,
                    "predicate": {
                      "block": {
                        "nbt": "{SpawnData:{entity:{id:\"minecraft:skeleton\"}}}"
                      }
                    }
                  }
                ]
              }
            ]
          },
          {
            "type": "minecraft:item",
            "name": "minecraft:spawner",
            "functions": [
              {
                "function": "minecraft:set_nbt",
                "tag": "{Item:{id:\"minecraft:spawner\",Count:1b,tag:{BlockEntityTag:{SpawnData:{entity:{id:\"minecraft:zombie\"}},SpawnPotentials:[{weight:1,data:{entity:{id:\"minecraft:zombie\"}}}]}}}}"
              }
            ],
            "conditions": [
              {
                "condition": "minecraft:location_check",
                "offsetX": 0,
                "offsetY": 0,
                "offsetZ": 0,
                "predicate": {
                  "block": {
                    "tag": "minecraft:spawner",
                    "nbt": "{SpawnData:{entity:{id:\"minecraft:zombie\"}}}"
                  }
                }
              }
            ]
          }
        ]
      }
    ]
  }
  

So it will drop a spawner if a condition is met which in this case is a location check, the theory behind it is it will check if the block that was just mined is a zombie spawner, if it passes it will drop a spawner then run the copy_nbt function, to supposedly copy the nbt data from the block to the item. However the condition always fails, and it doesn't copy the nbt data even without the condition. What can be done is setting a name for the item when it drops using set_name. I am horribly confused as to why BOTH the condition and function don't work.

Posted May 4, 2022, 1:56 AM UTC · edited

11
Loading comments…