I was looking for a datapack for locked boxes in Minecraft for a relatively long time, but only found those that needed an item to open the box. I would like one that adds a recipe for locked chests, such as adding an iron to the chest to lock it. You may know the locked chests from the open source game Minetest, which cost 1 iron and 1 chest and can only be opened by the player who placed them. Do any of you have an idea how to solve this with a command block or a data pack?
The only thing I can think of would be that you can only open the locked chest if the owner is within a radius of 2 blocks around the box. However, other players can also access the box during this period.
Otherwise it only works with one item.
Thanks! That sounds pretty good. How would you do that? LG
Sorry that you had to wait so long, but I have now completed the data pack: https://drive.google.com/...sp=sharing
About the function: actually relatively simple. With the help of advancements and a few commands it is found out where the player places the closed chest. Afterwards, an invisible armor stand will be spawned as a placeholder at this location. This gets the same scoreboard value as the player who placed it, which ensures that only the owner can open the chest.
Now the owner can put his items in the chest. As soon as it is two blocks away from the box, all items are saved in the placeholder, the box is emptied and locked. As soon as the player comes within a radius of 2 blocks, all items that are stored in the Armor Stand are copied back into the chest and the "encryption" of the box is canceled.
The box can only be dismantled if the owner is in a 2 block radius. At the moment it has to be re-crafted with an iron so that it is a locked box again. If you want, I can also program you to get the locked box back.
If you want to upload the data pack somewhere and distribute it, I would be happy if you ask me first or at least mention me as the creator, as there's still a lot of work in the data pack.
Thanks for putting so much work into the datapack! I just tried it and it turned out really good! LG
Many Thanks
Hey Berry623 Would you mind Explaining how the pack works? And I have ALOT more questions regarding this so Please do tell me =D