Random item drops
You can create a loot table that contains all the different items you want the item dropper to drop.
Go to minecraft.tools/en/loots.php to create a loot table with all of the items you want in it. Because loot tables are random (you don’t get the same exact drops and amounts of those drops when you kill mobs), loot tables can be used to generate random drops, but can be controlled enough to decide probabilities and amounts if you so desire.
If you don’t know how to create loot tables, there are plenty of examples on the internet that explain how.
Once you create your loot table, copy it to your clipboard and go to your world saves folder (the world saves folder’s name is default to “world” on servers) and then navigate to the folder called data
. Create a folder called loot_tables
inside of it if it doesn’t already exist. Inside of that folder, create a folder called custom_drops
. Inside of the custom_drops folder, create a folder called entities
. Then in that folder create a text file called item_dropper.json
with your loot table pasted inside of it.
In your minecraft world, use this command to summon the armor stand:
/summon armor_stand -1181 32 -131 {Invisible:1b,Invulnerable:1b,PersistenceRequired:1b,NoGravity:1b,CustomName:"item_dropper",CustomNameVisible:0b,DeathLootTable:”custom_drops:entities/item_dropper”}
Then kill the armor stand with the command /kill @e[type=armor_stand,name=item_dropper]
right after you summon it (with chain command blocks you could do this on the same tick).
This will summon an armor stand with the loot table created, and then kill it to make it drop the items in the loot table.
Keep in mind that the mob loot gamerule must be on for this to work. Use /gamerule doMobLoot true
to toggle mob loot to true.