5

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).

0

3 Answers 3

4

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 https://minecraft.wiki/w/Chunk_format#Entity_format.

4
  • Won't the cow suffocate if spawned in a solid block? Or is that part of NoAI?
    – MrLemon
    Commented Oct 7, 2014 at 12:19
  • ... only in Minecraft :) Commented Oct 7, 2014 at 12:23
  • You could make a mob invincible. - See gaming.stackexchange.com/questions/165923/… - Alternatively, make it a Wither Skull instead.
    – aytimothy
    Commented Oct 7, 2014 at 12:27
  • Your NBT tag is out of date as of 1.9.
    – pppery
    Commented Sep 1, 2018 at 19:27
4

You 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 https://mcstacker.net/

5
  • If you're wondering what the magic number in the DisabledSlots NBT tag is doing... well, you're not alone. But that specific number disables removing and placing items on all slots of the armor stand.
    – Unionhawk
    Commented Oct 7, 2014 at 22:48
  • The value of DisabledSlots tag should be 2039583. 2039552 allows removing.
    – Q20
    Commented Jan 28, 2015 at 6:46
  • @QbsidianH20 According to the wiki, 2039552 is correct. 1<<(8+slotindex) disables removing and replacing of that slot.
    – MrLemon
    Commented Jan 28, 2015 at 9:56
  • Nevermind, I can't read obviously, thanks for correcting me!
    – Q20
    Commented Jan 28, 2015 at 16:19
  • @ppperry Thank you for pointing this out, I'll take a look whenever I get the chance
    – Unionhawk
    Commented Sep 2, 2018 at 1:37
0

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.

You must log in to answer this question.

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