Minecraft Data Packs / Item

Key (Lock Chests)

  • check_circle Advancements
  • check_circle Functions
  • check_circle Recipes
  • 15,359 views, 70 today
  • 2,359 downloads, 11 today
  • 55
  • 49
  • 93
CMD-Golem avatar CMD-Golem
Level 54 : Grandmaster Engineer
111
Lock your Chest to protect your Items from other Players and Creepers. Even if something breaks the Chest it will replace itself without any drops.

Even Hoppers underneath the Chest won't soak up your items. But be aware, if you put items with a hopper into a locked Chest they will drop out if you unlock it.

[​1.16+] You can repair your Key, if you drop a Gold Ingot with the Key on an Anvil. To get more Durability you can also enchant it with Unbreaking.



Crafting

The Crafting Table will show a Gold Nugget as result, but you will get the correct Item after you take it out.

Key (Lock Chests) Minecraft Data Pack


Settings

Show Messages in the Chat instead of above the Hotbar.
/scoreboard players set #message chestlock 1
If you get a Green Shulker Box when you lock or unlock a chest you can use this two commands to fix it. Afterwards the Key won't get Damaged and all items which are putted into the chest, while it is looked will be lost if you unlock it.
/scoreboard players set #compatible chestlock /scoreboard players set #damage chestlock 1
Get the Admin Key.
/function chest_lock:craft/admin_key
[​1.16+] Disable Tool Damage when locking a Chest.
/scoreboard players set #damage chestlock 1
To disable the Setting again you need to execute the same Command except of the 1 replace with a 0.





If you have Questions or you discovered a bug, please write a Comment below.
CompatibilityMinecraft 1.15
toMinecraft 1.16
Tags

7 Update Logs

v x.6 : 04/14/2021 2:24:05 pmApr 14th

Fixed Item duplication bug with tnt
LOAD MORE LOGS

Create an account or sign in to comment.

1
04/30/2021 4:23 pm
Level 1 : New Miner
Legalizeer
Legalizeer avatar
Duuuuude I doiwnloaded it for the server and now we get a key dropped every 4 seconds
pls help
1
05/01/2021 1:08 pmhistory
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Do you have any other datapack installed

If you have a recipe unlocker datapck you need to disable this datapack.
1
04/15/2021 10:27 amhistory
Level 1 : New Miner
Ankhees
Ankhees avatar
Nice!
1
04/15/2021 2:01 pm
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Thanks
1
03/23/2021 8:06 am
Level 1 : New Miner
Batyalas
Batyalas avatar
does it work in 16.5?
1
03/23/2021 12:03 pm
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Yes it should work.
1
03/10/2021 5:22 am
Level 1 : New Miner
AlphaAbBlaze
AlphaAbBlaze avatar
CMD-Golem
Sorry for the ping, but I have a question.
When I make a key, does that mean that I can only unlock chests that I have placed, and that no one else can access my chests even if they have a key?
1
03/10/2021 11:57 am
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Yes, if it would depend on the chest you wouldn't be able to unlock the chest after you die for example in lava and lose the key.
1
02/12/2021 4:32 pm
Level 1 : New Explorer
GregoryBlaze
GregoryBlaze avatar
Hey, don't mean to be a bother but for some reason if i use this with the Star Odyssey texture pack the key has a built in specal texture! Was this intended (like you contated him to add a specal texture or something?) Also i checked and the texture is only for the key not just all gold nuggets. here's the link to the texture pack.
www.planetminecraft.com/texture-pack/odyssey-the-sci-fi-resource-pack-beta-version/ and thanks for making this. it has really helped me!
1
02/13/2021 9:07 am
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
I'm really happy that you like my Datapack.
The special texture is actually a "bug" in the Ressource Pack Odyssey. If you want to see the normal key texture you need to put the Ressource pack from this Datapack at the top of the list.
And the key is not a retextured golden nugget, but, depending on which version you are using, a carrot on a stick or a warped fungus on a stick.
2
02/13/2021 2:33 pm
Level 1 : New Explorer
GregoryBlaze
GregoryBlaze avatar
Ohh ok i get it now. thanks!
1
02/11/2021 2:56 amhistory
Level 1 : New Miner
AienaTeam
AienaTeam avatar
Very Nice Data pack. Is it planned to add Doors to it? Would be very nice!
1
02/11/2021 7:05 amhistory
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Thanks. I already tried it. Saddly datapacks aren't fast enough to close the door again before you walk trough.
1
04/20/2021 4:43 am
Level 28 : Expert Engineer
Solda9
Solda9 avatar
It's a bit longer as process but you could create a custom model for the door and replace the door with barrier. So you couldn't even open the door until you use the key and the barrier will be replaced with a normal door.
2
03/25/2021 5:15 pm
Level 26 : Expert Creeper
SuperCreeper_20
SuperCreeper_20 avatar
That's sad. I will make a vanilla server and your pack is perfect for that.
1
01/29/2021 3:54 pm
Level 1 : New Miner
User3405811G
User3405811G avatar
i have a locked chest in my world right now but no one can unlock it or break it. i can unlock it with the admin key but i still cant break it. it happened i think when i locked the chest then i gave my friend my key and he tried unlocking it witch didn't work of course. but then i i unlocked it and he locked it with my key now it is just in the middle of my house and i cant remove it. is there a way to fully de install the data pack or mabey reset all the data??
1
01/30/2021 6:27 am
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Could it be that bought of you locked the chest at the same time? If yes, it is very likely, that this is the problem. It should be fixable, if you stand on top of the chest and execute this command:
/execute align xyz positioned ~0.5 ~ ~0.5 run function chest_lock:actions/unlockIf this still doesn't work (Try and execute the command above at least two times) take all items out of the chest, unlock all locked chest which are near and execute this command:
/kill @e[tag=chestlock_cloud,distance=..1.5]Afterwards you should be able to break the chest.
1
01/23/2021 7:05 am
Level 1 : New Miner
User3394922G
User3394922G avatar
Hi where can i found the ressource pack i can't find it thanks in advance
1
01/24/2021 7:44 am
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Click on the download button and there you can see it on the right side.
1
01/04/2021 9:39 pm
Level 1 : New Explorer
Noyahttps
Noyahttps avatar
needs texture pack?
2
01/05/2021 3:44 am
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
If you use the texture pack you will see the kay texture. If you don't use it you won't see the key but a carrot on a stick or a warped fungus on a stick.
2
01/05/2021 9:17 am
Level 1 : New Explorer
Noyahttps
Noyahttps avatar
ok, i think upload this to my server. Its a very good work
1
01/05/2021 4:45 pm
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Thank you very much.
1
12/17/2020 8:49 am
Level 4 : Apprentice Miner
vip2kea
vip2kea avatar
Hello CMD-Golem, sorry for pinging you, but I believe I have found a bug.
If you lock a chest in the end, preferably in the void, the Y-level 1 right below the chest and the Y-level 1 of the cords you were standing on will turn to bedrock.

https://imgur.com/uOxIblu
Notice the bedrock at Y-level 1?
1
12/17/2020 10:46 am
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Thank you for your reporting.
Yes that's true. This is needed because of the durability use. If you execute this two commands it shoudn't happen anymore:
/scoreboard players set #compatible chestlock 1
/scoreboard players set #damage chestlock 1
With 1.17 it will be possible to remove this bug, because of a new feature.
1
12/17/2020 2:04 pm
Level 4 : Apprentice Miner
vip2kea
vip2kea avatar
The bedrock still comes up under the chest, but thank you.
And end filled with random bedrock is not exactly bad. :p



This now gives me another reason to be hyped for 1.17! :D XD
1
12/18/2020 12:39 pm
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
I found out that it was possible to fix it also in the existing versions. So now it should work properly.
1
12/15/2020 5:16 pm
Level 4 : Apprentice Miner
vip2kea
vip2kea avatar
I have an idea, make it so you can still see what is inside a locked chest if you are in spectator mode.
Or, make it so you can lock a chest for another player.

Either way, a way for staff to search player's chests without unlocking them would be awesome!
1
12/16/2020 8:49 am
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
If you woulnd't remove the items from the chest, the items would drop if you brake the chest. So i need to remove it.

I think all your ideas would me possible with a plugin or a mod. Saddly I can't make these.
1
12/03/2020 5:45 pm
Level 19 : Journeyman Miner
ArturoDG
ArturoDG avatar
You can do it to newer version 20w49a pls i want play with my friends with this datapack its so useful
1
12/04/2020 1:13 pm
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
This Datapack works in 20w49a. If the Datapack or the Ressource Pack should show an error, just ignore it. It will work fine.
1
11/30/2020 6:07 am
Level 1 : New Explorer
KBOC
KBOC avatar
it is kind of irritating having to shift right click to open it all the time, i wish it immediately opened with the only criteria being i have it equipped on my hand
1
11/30/2020 8:32 am
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
As far as i know this isn't possible.
1
11/21/2020 9:22 am
Level 1 : New Explorer
Arrows_Of_Doom
Arrows_Of_Doom avatar
Wish it was for 1.16.4..... My server is set at that
1
11/21/2020 11:23 am
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
You can use it in 1.16.4. If it should show an error in the datapack selector just ignore it.
1
11/09/2020 8:22 am
Level 1 : New Miner
User3292865G
User3292865G avatar
Hi. Great datapack, but I have some suggestions for it like for example an admin key, which can unlock any chest. This could be useful on servers, where someone could lock someone elses chest and then refuse to unlock it. It would be more convinient for the admin to unlock the chest using an admin key rather than copy and pasting a command and standing on top of a chest to unlock it. One more suggestion would be the ability to show who locked the chest, like when you try to open a locked chest, it would show "Chest is locked! Owner: *name*".
1
11/21/2020 6:47 am
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
I added bough your ideas. Thank you very much for suggesting them.

Sadly due to the limitations of Minecraft it would be very complicated to show the name of the player when he isn't on the server, so it shows it when the Owner of the Chest is online.
1
11/29/2020 10:44 amhistory
Level 1 : New Miner
User3292865G
User3292865G avatar
You can actually. Just set the name of the armor stand, which holds the items to the name of the player. So when somebody tries to open that chest, it would show the armor stand´s name instead, even when the owner is offline.
1
11/29/2020 12:44 pm
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
This of course isn't the problem. The problem is to get the name to the armorstand.
1
11/29/2020 2:52 pm
Level 1 : New Miner
User3292865G
User3292865G avatar
That is easy! Tag the player wich just locked a chest then summon armorstand after that summon a item using the /loot commnad with custom name set to {"selector":"@a[tag=*tag name*]"}. That will give the item the name of the player. Then with the commnad /data you set the name of armorstand to item´s name. The only downside is that it is not backwards compatible.
Heres my implementation:
lock.ncfunction function
#summon storage entity
summon minecraft:armor_stand ~ ~ ~ {ArmorItems:[{},{},{id:"minecraft:stone",Count:1b,tag:{Items:[], OwnerName:""}},{}],NoGravity:1b,Invulnerable:1b,Small:1b,Marker:1b,Invisible:1b,NoBasePlate:1b,PersistenceRequired:1b,Tags:["chestlock_cloud","chestlock_new"]}
#lock chest
data merge block ~ ~ ~ {Lock:"fsjionevnbmeuwrbt0er9bvnwrenvu"}
#store data
data modify entity @e[tag=chestlock_cloud,distance=..0.1,limit=1] ArmorItems[2].tag.Items set from block ~ ~ ~ Items

#store owners name
tag @s add owner_new
loot spawn ~ 1000 ~ loot chest_lock:name_tag
tag @e[type=minecraft:item,nbt={Item:{tag:{chestNameTag:1b}}}] add chestName
data modify entity @e[tag=chestlock_cloud,distance=..0.1,limit=1] CustomName set from entity @e[type=minecraft:item,tag=chestName,limit=1] Item.tag.display.Name
kill @e[type=minecraft:item,tag=chestName,limit=1]
tag @s remove owner_new

#clear chest
data merge block ~ ~ ~ {Items:[]}
#store uuid
scoreboard players operation @e[tag=chestlock_cloud,distance=..0.1] chestlock = @s chestlock
#detect type
execute as @e[tag=chestlock_cloud,distance=..0.1] run function chest_lock:type

#message
playsound minecraft:block.iron_door.close block @s ~ ~ ~ 10 0.5
execute unless score #message chestlock matches 1 run title @s actionbar {"text":"Chest has been locked"}
execute if score #message chestlock matches 1 run tellraw @s {"text":"Chest has been locked"}

execute unless score #damage chestlock matches 1 at @s run function chest_lock:damage/durability


name_tag.json loot table:
{
"type": "minecraft:command",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:stone_button",
"functions": [
{
"function": "minecraft:set_name",
"name": {"selector":"@a[tag=owner_new]"},
"entity": "this"
},
{
"function": "minecraft:set_nbt",
"tag": "{chestNameTag:1b}"
}
]
}
]
}
]
}
1
12/03/2020 4:10 pm
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
I updated the datapack. Saddly your idea hasn't worked. I actually don't know why. To fix it, I had to use a sign instead of an item to get the name but the result should be the same.

Thanks for your help anyway.
1
12/01/2020 2:41 pm
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Sorry for the long wait.
Nice, I actually never thought of this method. I will implement this in the next days.
Thank you very much for your help.
1
11/10/2020 6:22 am
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Very nice ideas. I try to implement them.
1
11/08/2020 10:52 pm
Level 1 : New Miner
FlavC
FlavC avatar
Im having trouble getting this to work on a realm. On a singleplayer world it works fine, but when I upload that world to realms and play it, the chest doesnt lock with the key (no message appears)
I dont have any conflicting datapacks.
2
11/09/2020 5:53 am
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Try and craft a new key. Probably your scoreboard got deleted.
2
11/09/2020 12:32 pmhistory
Level 1 : New Miner
FlavC
FlavC avatar
It turns out there was a conflicting datapack. Thanks awesome datapack
2
10/16/2020 3:27 am
Level 59 : Grandmaster Kitten
FunkyToc
FunkyToc avatar
Awesome ! very efficient and simple =)
1
10/05/2020 1:54 pm
Level 1 : New Miner
fat nat
fat nat avatar
Hi, I've just downloaded this datapack onto my multiplayer server in Vanilla 1.16.3.
I have a pretty strange issue where as soon as the datapack is enabled it starts spawning keys into my inventory and doesn't stop.
Any ideas on what I've managed to mess up?
Thanks.
1
10/08/2020 7:09 amhistory
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Do you have any other installed Datapack on your Server?
1
11/28/2020 5:36 am
Level 1 : New Miner
GreezSam
GreezSam avatar
Im having the saem issue, as soon as i enable the datapack it keeps giving keys to everyone
1
11/28/2020 2:42 pm
Level 54 : Grandmaster Engineer
CMD-Golem
CMD-Golem avatar
Do you have any other datapacks installed
Planet Minecraft

Website

© 2010 - 2021
www.planetminecraft.com

Welcome