Is there a way to add a loot table to a modded chest when it generates?

Started by Hogwash on

Topic category: Help with modding (Java Edition)

Last seen on 02:24, 9. Oct 2021
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is there a way to add a loot table to a modded chest when it generates?
Tue, 10/05/2021 - 05:07 (edited)

So, I have a locked chest and when I used a key on it the key disappears and the locked chest gets replaced by an unlocked version it (also there is a keyblade version of the key that uses durability instead of disappearing). I want the unlocked chest to spawn with custom loot table items but I'm not sure how to do it. Here is what I have so far:If locked chest is right clicked with keyWhen unlocked chest spawns? Idk what to do here.

Edited by Hogwash on Tue, 10/05/2021 - 05:07
Last seen on 15:20, 19. Apr 2024
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Bind the unlocked chest with…
Tue, 10/05/2021 - 07:08

Bind the unlocked chest with a Gui and fill the gui with items you want

Then on the trigger block added you can randomize the items inside so they can be different any time

 

Last seen on 02:24, 9. Oct 2021
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm guessing this would mean…
Tue, 10/05/2021 - 09:18

I'm guessing this would mean that if an item were set to slot 0 in the GUI then whenever it appears randomly in a chest it would always be in the same slot? That's a little annoying but beggars can't be choosers. How exactly would you implement the randomization though?

Last seen on 02:24, 9. Oct 2021
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't understand what you…
Tue, 10/05/2021 - 09:35

I don't understand what you said

Last seen on 15:20, 19. Apr 2024
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes if you put in a slot  it…
Tue, 10/05/2021 - 09:52

Yes if you put in a slot  it will always spawn with that item in that slot but as said just randomize the loot

This way you can change either item in slot and quantity to be placed in slot

 

Last seen on 02:24, 9. Oct 2021
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Okay I understand but how…
Tue, 10/05/2021 - 09:56

Okay I understand but how would you randomize it? I'm a little confused on that part.

Last seen on 15:20, 19. Apr 2024
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I use it randomized in my…
Tue, 10/05/2021 - 10:41

I use it randomized in my mod. I believe much funnier for someone finding your chest not knowing what's inside

Last seen on 02:24, 9. Oct 2021
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Everytime i open the chest…
Tue, 10/05/2021 - 12:42

Everytime i open the chest it keeps adding in another item. Do you know how I could fix that?

Last seen on 15:20, 19. Apr 2024
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What means another ? Send me…
Tue, 10/05/2021 - 12:44

What means another ? Send me some screenshots please for the item and the procedure you are using

Last seen on 02:24, 9. Oct 2021
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What should the trigger be?…
Tue, 10/05/2021 - 13:55

What should the trigger be? I have mine OnBlockRightClicked. This means that every time I open the chest again it will keep adding new items from the procedure. https://imgur.com/a/UpbX42T If I open the chests too much my game will crash so I want to know what trigger would make the item generation only happen once.

Last seen on 15:20, 19. Apr 2024
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Of course, trigger must be…
Tue, 10/05/2021 - 15:15

Of course, trigger must be when block added

Last seen on 02:24, 9. Oct 2021
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It says that im missing…
Tue, 10/05/2021 - 15:47

It says that im missing dependencies

Last seen on 02:24, 9. Oct 2021
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nvm I fixed it but only 1…
Tue, 10/05/2021 - 16:18

Nvm I fixed it but only 1 item spawns in the chests at a time, with various amounts of course.