KnightMiner / Inspirations

Mod adding various smaller features to Minecraft
MIT License
44 stars 18 forks source link

[Suggestion] One-time use keys #50

Open SeriousCreeper opened 6 years ago

SeriousCreeper commented 6 years ago

Heya,

was wondering if we could get an option to have keys and locks be used up once unlocked. I'm currently building some custom dungeons using blocks like the secret brick to unlock secret rooms and such. Would love to have locked chests spawn in the dungeon and have the player find several keys to unlocks those chests, instead of finding 1 key and being able to unlock them all.

So basically once you got the right key and right click a locked chest, both the lock and the key should get deleted. (i think it would also require not being able to shift-right click with the key to remove the lock)

Would this be something that could be added?

Cheers, SC

KnightMiner commented 6 years ago

That is an interesting idea, though ideally there would be a survival use to the item as well. The hard part is with the way the vanilla mechanic works any item can be used as a key, so making a single use key enticing to craft is a bit difficult (you could arguably just craft a stick into a key which can be reused). I could possibly add some sort of configurable override preventing vanilla "keys", or if you have another suggestion of how to handle it I am open.

SeriousCreeper commented 6 years ago

Ohh i didn't realize minecraft had a lock mechanic built-in lol, just checked the source, interesting! Hm yeah if renaming an item is enough, that would kinda defeat the purpose of having the keys inside a dungeon (they could just come with a renamed stack of cobble to get all the loot).

I think what you said would make the most sense, config option which, if enabled, cancels the event to open the container if the player is not holding an actual Key in their hand. If you choose to go with that option, it might be nice if right clicking a locked container display what key it requires. So it would say something like "Chest is locked! Requires 'Small Key'" (where "Small Key" is the lock code). Of course that would only make sense if the key item is enforced.

For one time use, perhaps a nbtag ("OneTime" or something) on the key itself could work for that? It would destroy the lock on the container if either right or shift+right clicked on it, as well as delete the key itself.

KnightMiner commented 6 years ago

With the way the vanilla mechanic works, the main thing that makes a lock secure is the fact that the name is unknown, if it displays the string on right click anyone with an anvil can now open the chest. For you purposes it sounds like some sort of separate locked chest system might be better, one with specific matching keys rather than general secret keys.

SeriousCreeper commented 6 years ago

Yeah that's why i mentioned showing what key is required would only be active if only the key item from inspiration was able to open locked containers (but i guess they could still craft the keys itself and name them, if the pack wouldn't disable the recipe for them). But that setting isn't too important to be honest. Having the one-time keys and enforcing the key item to unlock locked chests would be amazing.