TransWikia.com

Random item drops

Arqade Asked by user173558 on February 4, 2021

I’m making a fun survival server in which the player has to keep adding items to the generator, or else the item dropper will lose power. This item dropper drops items needed to power the generator, and the only way to get regen is from potions dropped by dropper. I want to know if there is a way to make a random item from a list drop every so often in the air. The exact spot is -1181 32 -131 in case that helps.

I have tried to use an execute command for an armor stand, an invisible guy with his name visibly being ITEM DROP ZONE. this is the command for him: `

/summon armor_stand ~ ~ ~ {Invisible:1b,Invulnerable:1b,PersistenceRequired:1b,NoGravity:1b,CustomName:"ITEM DROP ZONE",CustomNameVisible:1b}

This shouldn’t really change anything for an execute except the @e[type=.... stuff, but I need help with that part. How do I make 1) A chain of commands that allows me to do a random command out of like, lets say, 8 different commands I already have, and 2) a command to have as my guideline, like the working version of /execute @e[type=armor stand, name= ITEM DROP ZONE] /summon Dropped Item.... etc.

2 Answers

My first idea would to build a few redstone randomizers that run from a clock, activated by a command block that tests to see if there is power (are potions) in the generator, and every so often the clock will activate, and the randomizers would activate a random command block that spawns in an item at the spot. You can look up a tutorial on how to make a redstone randomizer, and it should be pretty straight forward from there. But as for a command block chain, I couldn't tell you, I do not know much about command blocks. If you need it to be a command block chain, might have to wait for another answer.

Answered by J. Keller-H. on February 4, 2021

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.

Answered by Eb946207 on February 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP