TransWikia.com

How do you lock and give chest a name?

Arqade Asked by Six sided on July 20, 2021

I’m making an adventure map and I need to have a command block next to a clock set the block near it to a chest with a custom name with a lock this I what I have so far:

/setblock ~-1 ~-1 ~ Minecraft:trapped_chest 1 {display:{Name:"Locked Chest",Lock:"Chest Key 47"}}

And then it says:

[16:26:39] Data tag parsing failed: Invalid tag encountered, expected '{' as first char.

I’m in 1.8.

3 Answers

The syntax of /setblock is:

/setblock <x> <y> <z> <TimeName> [dataValue] [oldBlockHandling] [dataTag]

Which means that you need to specify an [oldBlockHandling] mode (E.G: replace) before you can specify the [dataTag].

The name tag of an entity or tile entity is CustomName, rather than just Name as it is on items. Also, neither it nor Lock are stored in a Display compound tag.

This should be your fixed command:

/setblock ~-1 ~-1 ~ trapped_chest 1 replace {CustomName:"Locked Chest",Lock:"Chest Key 47"}

Answered by SirBenet on July 20, 2021

You might need to use block data such as

/blockdata ~ ~ ~ {Lock:"Chest Key 47"}

Answered by CaptainMoose on July 20, 2021

Go on top of the thing you want to lock (examples include chest, dispenser, dropper, trapped chest) and type this command. Make sure you are the owner of the world or have Operator rights.

/blockdata ~ ~-1 ~ {Lock:"Key"}

I'll break this up so it is easier to understand.

(/blockdata) You are editing the data of the block

(~ ~-1 ~) You are telling minecraft what you are locking in co ordinates. XYZ

{Lock:"Key"} And you are telling to only open this thing when you have "Key" in your hand.

You may change the word "Key" to whatever you like, just act like it is a password so it's not like 123 or ABC. Someone could rename a block as 123 and open your thing.

Happy locking!

Answered by Daniel Kwon on July 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP