1

Since tall flowers are considered two blocks, both halves trigger a loot table when broken. In vanilla, the game gets around this by having the loot tables check (and only drop the flower) if it is a bottom half, meaning if you break a glitched floating top half of a flower it would drop nothing, and you could break a glitched bottom half only (with no top) and it would still drop.

Anyways, I seem to be running into this issue trying to assign custom conditional drops. As you can see in the loot table attached below, I would like the flower to drop it's respective dye instead of itself when broken with a sword. Except, if I do it normal way, the half directly broken passes the check and drops dye, but the other half fails the check (as it was not directly broken with a sword) and drops another tall flower meaning it can be cycled for infinite die XD

This was as close as I could get. It drops the flower as expected if I break either half with my fist, it drops only dye (like i want) when I break the bottom half with a sword, but when i break the top half with a sword it also drops the flower again. If I remove the lower half check and drop at the end, then wouldn't it not drop when broken by hand?

What am I doing wrong?

{
  "type": "minecraft:block",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:alternatives",
          "children": [
            {
              "type": "minecraft:item",
              "name": "minecraft:red_dye",
              "functions": [
                {
                  "function": "minecraft:set_count",
                  "count": 2
                }
              ],
              "conditions": [
                {
                  "condition": "minecraft:block_state_property",
                  "block": "minecraft:rose_bush",
                  "properties": {
                    "half": "lower"
                  }
                },
                {
                  "condition": "minecraft:match_tool",
                  "predicate": {
                    "items": [
                      "minecraft:wooden_sword",
                      "minecraft:stone_sword",
                      "minecraft:iron_sword",
                      "minecraft:golden_sword",
                      "minecraft:diamond_sword",
                      "minecraft:netherite_sword"
                    ]
                  }
                }
              ]
            },
            {
              "type": "minecraft:alternatives",
              "children": [
                {
                  "type": "minecraft:item",
                  "name": "minecraft:red_dye",
                  "functions": [
                    {
                      "function": "minecraft:set_count",
                      "count": 2
                    }
                  ],
                  "conditions": [
                    {
                      "condition": "minecraft:block_state_property",
                      "block": "minecraft:rose_bush",
                      "properties": {
                        "half": "upper"
                      }
                    },
                    {
                      "condition": "minecraft:match_tool",
                      "predicate": {
                        "items": [
                          "minecraft:wooden_sword",
                          "minecraft:stone_sword",
                          "minecraft:iron_sword",
                          "minecraft:golden_sword",
                          "minecraft:diamond_sword",
                          "minecraft:netherite_sword"
                        ]
                      }
                    }
                  ]
                },
                {
                  "type": "minecraft:item",
                  "name": "minecraft:rose_bush",
                  "conditions": [
                    {
                      "condition": "minecraft:inverted",
                      "term": {
                        "condition": "minecraft:match_tool",
                        "predicate": {
                          "items": [
                            "minecraft:wooden_sword",
                            "minecraft:stone_sword",
                            "minecraft:iron_sword",
                            "minecraft:golden_sword",
                            "minecraft:diamond_sword",
                            "minecraft:netherite_sword"
                          ]
                        }
                      }
                    },
                    {
                      "condition": "minecraft:block_state_property",
                      "block": "minecraft:rose_bush",
                      "properties": {
                        "half": "lower"
                      }
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "conditions": [
        {
          "condition": "minecraft:survives_explosion"
        }
      ]
    }
  ]
}
1
  • I think you understand the problem quiet well, but there is no way around it using only loottables. Maybe try to use scoreboards with mined:rose_bush/... and every time the value is greater than 0, check if the player holds a sword and give the items based on this. Not really a clean solution sadly :(
    – IceFreez3r
    Mar 3 at 12:18

1 Answer 1

1

I GOT IT WORKING! So all I had to do was add a "broken by player" check so the other half doesnt drop. The side that is directly broken drops either: dye if broken with a sword, and a rose if not broken with a sword. Both of the other side's checks fail so it drops nothing.

{
  "type": "minecraft:block",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:alternatives",
          "children": [
            {
              "type": "minecraft:item",
              "name": "minecraft:red_dye",
              "functions": [
                {
                  "function": "minecraft:set_count",
                  "count": 2
                }
              ],
              "conditions": [
                {
                  "condition": "minecraft:block_state_property",
                  "block": "minecraft:rose_bush",
                  "properties": {
                    "half": "lower"
                  }
                },
                {
                  "condition": "minecraft:match_tool",
                  "predicate": {
                    "items": [
                      "minecraft:wooden_sword",
                      "minecraft:stone_sword",
                      "minecraft:iron_sword",
                      "minecraft:golden_sword",
                      "minecraft:diamond_sword",
                      "minecraft:netherite_sword"
                    ]
                  }
                }
              ]
            },
            {
              "type": "minecraft:item",
              "name": "minecraft:red_dye",
              "functions": [
                {
                  "function": "minecraft:set_count",
                  "count": 2
                }
              ],
              "conditions": [
                {
                  "condition": "minecraft:block_state_property",
                  "block": "minecraft:rose_bush",
                  "properties": {
                    "half": "upper"
                  }
                },
                {
                  "condition": "minecraft:match_tool",
                  "predicate": {
                    "items": [
                      "minecraft:wooden_sword",
                      "minecraft:stone_sword",
                      "minecraft:iron_sword",
                      "minecraft:golden_sword",
                      "minecraft:diamond_sword",
                      "minecraft:netherite_sword"
                    ]
                  }
                }
              ]
            }
          ]
        }
      ],
      "conditions": [
        {
          "condition": "minecraft:survives_explosion"
        }
      ]
    },
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:alternatives",
          "children": [
            {
              "type": "minecraft:item",
              "name": "minecraft:rose_bush",
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "type": "minecraft:player"
                  }
                },
                {
                  "condition": "minecraft:block_state_property",
                  "block": "minecraft:rose_bush",
                  "properties": {
                    "half": "lower"
                  }
                },
                {
                  "condition": "minecraft:inverted",
                  "term": {
                    "condition": "minecraft:match_tool",
                    "predicate": {
                      "items": [
                        "minecraft:wooden_sword",
                        "minecraft:stone_sword",
                        "minecraft:iron_sword",
                        "minecraft:golden_sword",
                        "minecraft:diamond_sword",
                        "minecraft:netherite_sword"
                      ]
                    }
                  }
                }
              ]
            },
            {
              "type": "minecraft:item",
              "name": "minecraft:rose_bush",
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "type": "minecraft:player"
                  }
                },
                {
                  "condition": "minecraft:block_state_property",
                  "block": "minecraft:rose_bush",
                  "properties": {
                    "half": "upper"
                  }
                },
                {
                  "condition": "minecraft:inverted",
                  "term": {
                    "condition": "minecraft:match_tool",
                    "predicate": {
                      "items": [
                        "minecraft:wooden_sword",
                        "minecraft:stone_sword",
                        "minecraft:iron_sword",
                        "minecraft:golden_sword",
                        "minecraft:diamond_sword",
                        "minecraft:netherite_sword"
                      ]
                    }
                  }
                }
              ]
            }
          ]
        }
      ],
      "conditions": [
        {
          "condition": "minecraft:survives_explosion"
        }
      ]
    }
  ]
}

You must log in to answer this question.

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