Automatically Generated Chests

Started by minecrafthooman on

Topic category: Help with MCreator software

Last seen on 17:27, 29. Jan 2021
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Automatically Generated Chests

Is it possible to automatically generate loot in a structure.  I understand how to make a loot crate, but how do I automatically generate it?  I tried making a procedure to run the lootcrate command but it did not work.

Last seen on 00:30, 24. Aug 2023
Joined May 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
First, you need to create a…
Sun, 01/24/2021 - 06:22

First, you need to create a loot table. Make sure you set the loot table type to something like "Block" or "Generic". Then, use this command to place a chest with your loot table in it: 

/setblock ~ ~ ~ chest{LootTable:"<your mod id>:<your loot table's registry name>"}

Your loot table's registry name can be found at the top of the Loot Table editor menu when you are making your loot table.

Now, it is very important that you DO NOT OPEN THIS CHEST. You can open it to verify that you typed the command correctly, but you must use a chest that you have not opened yet to put in your structures. This is because when you open a chest, it generates the loot inside it, meaning that the loot will no longer be random when it's generated in your structure- it will always be the items that were in it when you looked inside the first time.

Hold Ctrl + Middle Click the chest in Creative mode to get a copy of the chest with the loot table stored. Now you can place it wherever you'd like! The loot will always be randomly chosen from the loot table you created!

If you edit the loot table later, the chests' loot pools will be automatically updated as well, until they were opened first.

Last seen on 17:27, 29. Jan 2021
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, but is there a way to…
Sun, 01/24/2021 - 06:25

Yes, but is there a way to put this loot into a chest, block with gui, etc without having to use this command?  With a procedure or something?

Last seen on 00:30, 24. Aug 2023
Joined May 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hmm... That's a tough one. I…
Sun, 01/24/2021 - 15:14

hmm... That's a tough one. I don't think you can explicitly do it with procedures, but there is an option to execute commands with procedure blocks.

This is an example of a procedure that replaces the block at X, Y, Z with a version of itself that is filled with the desired loot table. There is no true way to just inject a loot table into a block because, as I said, you cannot put a loot table into an already generated container.

Last seen on 17:27, 29. Jan 2021
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok Thanks :)
Sun, 01/24/2021 - 19:58

Ok Thanks :)