How can I get items from a loot table to *drop* on a trigger?

Started by liarbag on

Topic category: Help with Minecraft modding (Java Edition)

Active 11 months ago
Joined Oct 2024
Points:
68

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 2
How can I get items from a loot table to *drop* on a trigger?

So basically, I have an item that, when right clicked, I want to drop an item from a loot table in front of the player. I know the spawn item command, and I have a loot table, but how can I link the two? I don't know if there's a 'loot table data block' or something I can plug into the gem. Thanks!

Active 5 months ago
Joined Jul 2022
Points:
561

User statistics:

  • Modifications: 1
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 237
You dont need spawn item…
Tue, 10/15/2024 - 16:25

You dont need spawn item command. Just use the spanw item procedure block. 

Use:

For each item from loot table [mod_name:type/custom_loot_table_name] as [itemstack iterator]

       spawn item [itemstack iterator] at x y z

 

Also make a logic if the trigger is a tick.

Active 11 months ago
Joined Oct 2024
Points:
68

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 2
Works great, thanks!
Wed, 10/16/2024 - 03:44

Works great, thanks!