I'm tying to make hidden chests in Minecraft. I found this code:
/summon MinecartChest ~ ~-1 ~.05 {CustomName:"Hidden Chest"}Which summons a Minecart Chest In the block beneath [whoever's using the command]. So when you right click on it, it opens the Minecart Chest, with the name "Hidden Chest".
But there's a problem: If you go really close to the block (in particular, step on top of it), the Minecart is inside of the block moves downwards thus making it impossible to open it without breaking blocks.
I wonder if there's any way to prevent this?
Can I make it with the NoAI NBT tag? I tried to spawn a skeleton without an AI, and then I couldn't move it. But, when I tried to summon the Minecart Chest without AI, but it didn't work. (Of course, Minecarts have no AI in the first place).
03 Answers
Try summoning a Minecart Chest riding placeholder entity.
/summon MinecartChest ~ ~-1 ~ {CustomName:"Hidden Chest",Riding:{id:Chicken,Invulnerable:1,NoAI:1,Silent:1,Age:-2147483648,ActiveEffects:[{Id:14,Amplifier:0,Duration:2147483647,ShowParticles:0b}]}}Note: This command is too long to paste into chat, use command block instead.
Added information about Invincibility - See Making mobs invincible (David Toh's solution for more details) and .
4You can do this by summoning an armor stand with a minecart chest as its passenger:
/summon armor_stand ~ ~ ~ {Invisible:1b,Marker:1b,Passengers:[{id:"minecraft:chest_minecart",CustomName:"{\"text\":\"Hidden Chest\"}"}]}This is the command as updated for Minecraft version 1.13. Previously (prior to 1.9), this command was reversed; /summon chest_minecart ~ ~ ~ {Riding:{id:armor_stand}}. The Riding NBT tag was changed to Passengers in 1.9. A really cool resource to help you build these kinds of commands, which I used for this updated answer, is
Stick this in a command block set up with a 'setblock' or 'fill' clock:
entitydata @e[(stuff to identify the right minecart)] {Motion:[0:0d,1:0.03999999910593d,2:0d]}
The minecart will be stuck WHEREVER you put it. It's given a constant motion of no north/south, no east/west, and a tiny upward motion (to counteract gravity if it's in the air). Don't worry, even if it's on the ground, it will stay EXACTLY where you put it. Have fun with this!
EDIT: Make sure to put this in a spawn chunk or within two chunks of where it's being used. If not, it could stop working and the MinecartChest, or whatever other minecart, would become normal and move around.