Command for spawning a certain item in a chest?

I'm trying to make a quest, and I need to have a particular item show up in a chest that players will be required to grab. What is the command for this, if any exist? Thanks!
14 Replies
Admincraft Meta
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close !close !solved !answered
Requested by nuttapillar#0
Gray
Gray2y ago
so hear me out, Use this plugin and have it check for the chest, then use deluxe menus to have a menu that looks like a chest, but has the item in it. You can have it play the sound of a chest open/close on open/close of the menu to make it feel more realistic. You will have to use a command to give the player the item and MAKE SURE IT HAS A COOLDOWN because i dont think that DM has a feature to let players take the item, but i might be wrong, (read here yourself if you want)[https://wiki.helpch.at/clips-plugins/deluxemenus]
Gray
Gray2y ago
dang i guess we dont have link embeds
QarthO
QarthO2y ago
Can you be more specific what you’re looking for? Are you trying to add an item to the loottables in chests in a regular vanilla world? Are you trying to make a custom inventory (like a chest) that has a custom item? Are you looking for a bukkit plugin, fabric or forge mod? Or is there an existing vanilla command you’re looking for? (I doubt with the little info u gave u vanilla can do this) Please be more specific!
Nuttapillar
NuttapillarOP2y ago
I just want to run command that places an item in a specific chest that I know the coordinates of. I want a potion to appear in the chest, with a display name of "rum" the chest is normally empty, so I just need to run the command when a player does the quest. Running a command on demand is the easy part, I just need to know how to make such a command, if it exists.
Decent60
Decent602y ago
If you got an admin only section, you can just clone it. /clone x1 y1 z1 x2 y2 z2 x y z replace Then run that whenever you want or on a scheduler.. Even hook it into a normal command alias to make it easier. With it being on replace, it won't stack and chest will generate if something should happen to it. (could even make it disappear and then reappear).
Tizo
Tizo2y ago
you could use a custom lootable and /setblock
Gray
Gray2y ago
look at my suggestion
Nuttapillar
NuttapillarOP2y ago
That sounds like a good solution. I'll try that. I can hide a protected chest somewhere to clone from I have no idea how to do custom loottables, but I'll look into it if the cloning doesn't work I've read through it. It sounds complicated, but I'll look into it more if cloning doesn't work. If I can avoid adding more plugins, that'd be preferred
Gray
Gray2y ago
you would only be adding dm and condetioinal events, which are really small plugins but my way is the only surefire way that this will work, because, you will still need to find a way to detect when the player opens the chest, so making it work through code will be way beter
Daenyth
Daenyth2y ago
I think you can probably do this with fill and then manually specify the chest's NBT which says what items are in it but it sounds fucking awful to write out that way so I think a vanilla command block is all you "need" but probably not a fun method
Mortis
Mortis2y ago
Many ways of doing this: - Datapack loot tables so you can use /loot to refill/set chest - clone chest - use a plugin that does this
Nuttapillar
NuttapillarOP2y ago
I don't need to detect when the player opens the chest. The quests plugin can handle running any command, at any given point within the questline
Gray
Gray2y ago
then do that

Did you find this page helpful?