Loot Table issue with leaves

Started by giz_Apex on

Topic category: Help with modding (Java Edition)

Last seen on 12:14, 10. Jan 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Loot Table issue with leaves

I'm facing an issue with my loot table. Here is it, this is supposed to work but when I'm in game it still drop vanilla loot for no reason. I tried with procedure and it worked when we break the leaves but whenever they decay, it doesn't work anymore...
I've search all over the forum and didn't found anything.
Thanks in advance

Last seen on 20:43, 20. Aug 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you have the registry…
Sat, 12/30/2023 - 15:04

If you have the registry name correct, it's possible the loot table is in the wrong folder for some reason. I had a similar issue with certain recipe overrides being put in the mod data file instead of the minecraft data file. (And therefore not working.) You could check using the built in file explorer in the left tab of the workspace, or by manually looking in the mod's src folder. The data folder should contain a separate file for minecraft and your mod's data, and you need your recipe to be in the minecraft folder for the override to work- MCreator normally does this automatically, but it's for some reason inconsistent at times.

...And of course if that fails, you could also just forget it and make a procedure that has a chance of dropping the item whenever the block is broken. It'll amount to the same thing, even if it's not the most elegant solution...

Last seen on 12:14, 10. Jan 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Just checked and it seems…
Sat, 12/30/2023 - 16:41

Just checked and it seems like it's not in the wrong folder (I guess). I'll probably do it with a procedure for when a leave is brocken but I don't know how to do a procedure when the leave block decay/ rot.

Last seen on 20:43, 20. Aug 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think leaves may have…
Sun, 12/31/2023 - 01:18

I think leaves may have special loot tables for this very reason- they need to have different pools depending on whether the block is mined with shears, whether it decays, etc; not necessarily just silk touch. Here's the vanilla azalea-leaves loot table for reference, not sure what to make of it:

{
  "type": "minecraft:block",
  "pools": [
    {
      "bonus_rolls": 0,
      "entries": [
        {
          "type": "minecraft:alternatives",
          "children": [
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:any_of",
                  "terms": [
                    {
                      "condition": "minecraft:match_tool",
                      "predicate": {
                        "items": [
                          "minecraft:shears"
                        ]
                      }
                    },
                    {
                      "condition": "minecraft:match_tool",
                      "predicate": {
                        "enchantments": [
                          {
                            "enchantment": "minecraft:silk_touch",
                            "levels": {
                              "min": 1
                            }
                          }
                        ]
                      }
                    }
                  ]
                }
              ],
              "name": "minecraft:azalea_leaves"
            },
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:survives_explosion"
                },
                {
                  "chances": [
                    0.05,
                    0.0625,
                    0.083333336,
                    0.1
                  ],
                  "condition": "minecraft:table_bonus",
                  "enchantment": "minecraft:fortune"
                }
              ],
              "name": "minecraft:azalea"
            }
          ]
        }
      ],
      "rolls": 1
    },
    {
      "bonus_rolls": 0,
      "conditions": [
        {
          "condition": "minecraft:inverted",
          "term": {
            "condition": "minecraft:any_of",
            "terms": [
              {
                "condition": "minecraft:match_tool",
                "predicate": {
                  "items": [
                    "minecraft:shears"
                  ]
                }
              },
              {
                "condition": "minecraft:match_tool",
                "predicate": {
                  "enchantments": [
                    {
                      "enchantment": "minecraft:silk_touch",
                      "levels": {
                        "min": 1
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      ],
      "entries": [
        {
          "type": "minecraft:item",
          "conditions": [
            {
              "chances": [
                0.02,
                0.022222223,
                0.025,
                0.033333335,
                0.1
              ],
              "condition": "minecraft:table_bonus",
              "enchantment": "minecraft:fortune"
            }
          ],
          "functions": [
            {
              "add": false,
              "count": {
                "type": "minecraft:uniform",
                "max": 2,
                "min": 1
              },
              "function": "minecraft:set_count"
            },
            {
              "function": "minecraft:explosion_decay"
            }
          ],
          "name": "minecraft:stick"
        }
      ],
      "rolls": 1
    }
  ],
  "random_sequence": "minecraft:blocks/azalea_leaves"
}
Last seen on 12:14, 10. Jan 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This doesn't really helped…
Sun, 12/31/2023 - 17:44

This doesn't really helped me... I still changed the code with yours and my modifications without sucess. I guess the only solution is to make a procedure to detect when a leaf decay and drop a gem with a certain probability, but I don't know how to do this... If you or someone else could help me wit this I would be really grateful.

Last seen on 20:43, 20. Aug 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That's the trouble- I don't…
Sun, 12/31/2023 - 18:58

That's the trouble- I don't know if there is a way to detect when leaf blocks decay, unless you've custom coded the leaf behavior yourself for a modded block. Microsoft has some basic documentation on loot tables, maybe that'll help?

Last seen on 12:14, 10. Jan 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yeah... This is for bedrock…
Sun, 12/31/2023 - 19:59

Yeah... This is for bedrock edition, this doesn't help me much.  I'll try with procedures then, I'll keep you posted and thanks again for trying to help me.

Last seen on 20:43, 20. Aug 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It is for bedrock, but for…
Sun, 12/31/2023 - 21:17

It is for bedrock, but for some reason most of the syntax is the same. You could also try finding an existing datapack that edits leaf loot tables, just to see how they did it. Anyways, good luck!