0

I just wanted to know if there is a way to get a random item without hundreds of commands.

1

1 Answer 1

1

If you can use datapacks, then the following method is a possibility. The method can take a lot of time to make, but requires a few commands to run. So in a datapack make a loot table with every item as a possibility. You can use misode.github.io as a generator. This loot table doesn't need to be a specific type of loot table, but if you want to get the item in a chest, I'm pretty you have to set it to a chest type. With a loot table you can add weight to make one item appear more often the others. If you don't want to spend the time creating this loot table , then if you know a programming language, you can automate it with an executable or a script. I know a programming language, so if you want me to automate it for you, I can. After you finished your loot table and properly installed it, then you have a few options. 1: Give a player a container with the item in it. 2: Give a player the item itself to the player. 3: Drop the item on the ground so the player can pick it up. I will start with number 1. For this method, use the command give <player selector> chest{BlockEntityTag:{LootTable:"<your loot table>"}}

Next is number 2. For this method use the following command.

loot give <player selector> loot <your loot table>

The next and final method is number 3. For this method use the following command.

loot spawn <coordinates> loot <your loot table>

For filling up the spots I didn't put in, use the in game command line. If you need help with anything let me know.

8
  • Thanks a lot for telling me. Can you automate it for me?
    – James Read
    Nov 17, 2020 at 16:53
  • @JamesRead I will automate it for you sometime later. You're welcome. Nov 17, 2020 at 21:10
  • @JamesRead What version are you in? Are you in 1.16.4? Nov 17, 2020 at 22:08
  • Just curious, what do you mean by “automate it with a programming language”? Do you just mean quick whip up an EXE to write the loot table file? or something to interact with the game, because that would require mods.
    – Penguin
    Nov 17, 2020 at 22:55
  • @randomuser922 I'm in 1.16.4
    – James Read
    Nov 17, 2020 at 23:40

You must log in to answer this question.

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