14

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.

  • i know there's a command to turn off mob drops, not sure if it applies to chests though when they are destroyed with items inside – Memor-X Aug 13 '14 at 0:11
  • 3
    @MemorX it doesn't. And I can't think of a way to do this other than gamemode 2. Get on it dinnerbone. – Unionhawk Aug 13 '14 at 0:16
  • I beleive this feature is intended for use in adventure maps, where the adventure gamemode is commonly used. Most blocks cannot be broken in adventure mode anyway, so it is not a problem. The only way I think this is possible is through the use of a mod or plugins. – Caleb Aug 13 '14 at 8:30
  • @Caleb - I think you're right; however I'd like to be able to use chests in this way somehow... – Steve Shipway Aug 13 '14 at 21:41
9

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

  • This is a pretty clever way of achieving it -- I hadn't known you could set the gamemode per-player rather than globally. This is probably a 1.8 enhancement. Although it is a bit messy -- if you're not careful, players could get left in adventure mode, such as if they die in the room -- it seems to be the only way of achieving it without making the whole map adventure mode. Thanks for the tip – Steve Shipway Aug 13 '14 at 21:44
  • In the end they don't have to be the ones to press the off switch. PLUS HOW DANGEROUS IS THIS BLOODY CHEST ROOM – Flaunting Aug 14 '14 at 6:18
  • PVP compeitition. Nuff said. – Steve Shipway Aug 17 '14 at 0:12
2

Instead of unlocking the chest that has the loot in it, make the key unlock a trapped chest that sends a redstone signal to a secret door, with the actual loot in another chest behind the door.

  • 1
    Or, a trapped chest that sends a redstone signal to a command block, which puts the actual loot into the chest? Might need something to stop them from repeatedly re-filling the chest, too. Not quite sure how to construct this, though. Thanks for the idea... – Steve Shipway Aug 19 '14 at 22:53
0

another Option could be to /kill all of the items that drop in the area..

on a "/setblock clock" or a "/fill clock" put the following command

/kill @e[type=item,r=5]

this will clear all items the moment the chest is broken leaving the player in the gamemode that they were already in...

the drawback to this is if a player throws an item while close to the chest they will lose it... (though it is a small area)

then to improve the idea check out this Video for a way to keep the items safe! Although you may want to take the signal from the trapped chest to temporarily disable the fill clock or (as in the video) repeating command block

  • he said to prevent the items from droping was an option and to have it come back use a "/testforblocks" command followed by a comparator into a not gate into a "/clone" command on the same fill clock...then if it does break it just comes back and then its fine (though you may want to use a trapped chest with the output inverted and then have the output of that pause the fill clock – Xaith_Xyne Jan 16 '16 at 20:01
  • My bad, I didn't fully read the question myself. Apologies for that. That said, it wouldn't hurt to add the information you've just mentioned in your comment into your answer using the 'edit' link. – nine Jan 16 '16 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.