Minecraft – How to make a chest Unbreakable in Minecraft

minecraft-java-edition

I have a 1.8 world for people to play in 'Survival' mode.

In this world is a chest, which is locked by a key (new 1.8 feature).

In theory, players should work hard elsewhere to obtain the key object, then they can open the chest and pillage the lovely, lovely loot.

In practice, they whack the chest with their pickaxe until it breaks, and pick up the loot from the kindling.

Is there a way to set 'unbreakable' on the Chest so that players canot do this? Alternatively, making broken chests NOT dump their contents would be acceptable. I don't want to install any mods to do this, though changing world settings, or even doing something complex with a command block is acceptable.

Possibly when 1.8 goes production it will only allow breaking of unlocked chests or will not dump contents of locked chests; however this is just speculation.

Best Answer

You can use command blocks to set an area to adventure mode, this could be used so that the room with the chest in can't have blocks broken.

This command will set adventure mode for anyone within a radious of 20 blocks. Just have this activated by a pressure plate or two as they enter the room or leave it.

/gamemode 2 @a[m=0,r=20] (r=20 will set the area radius to 20 blocks)

This will set the gamemode to normal for anyone outside of 20 blocks

/gamemode 0 @a[m=2,rm=20] (rm=20 will set the mode for anyone that is more than 20 blocks away.

Just change the radius and the position of the command blocks depending on your situation. Source