GM Secure Doors: coded keys for vanilla Minecraft doors

A new open-source Bedrock add-on that turns any vanilla door into a coded-key lock — no padlock, no flicker, unbreakable while locked. And the story of why a small mod took so many evenings.

A locked Minecraft door with a glowing coded key

A locked Minecraft door with a glowing coded key

Our family Bedrock server needed doors that could actually keep a room shut. Not a padlock sitting on a chest, not a redstone contraption that a stray lever defeats — a door that a kid cannot open unless they hold the right key, that cannot be broken or blown up, and that still looks and behaves like the door they placed.

That became GM Secure Doors, released today as an open-source add-on.

What it does

Sneak and tap a vanilla door while holding a Door Key, and that door becomes locked. The key picks up a short code (K#a1b2c) the first time it is used. From then on:

  • tapping the door with the matching key opens and closes it
  • tapping it with anything else prints Doors Locked or Wrong key, and nothing moves
  • the door cannot be broken (except in creative) and shrugs off explosions
  • a pressure plate can close it, but never open it
  • releasing the lock with a sneak-tap returns the door to exactly what it was before

One key can own several doors. Coding a blank key from a coded one (key in hand, blank in the offhand) makes copies for family members. There is no padlock item, no dropped item, no inventory clutter — the key is the lock.

It supports oak, spruce, birch, jungle, acacia, dark oak and iron doors, including both halves of double doors and the mirrored hinge of each pair.

Why it took so long

The feature list above is short. Getting there was not, and most of the time went into fighting the engine rather than writing features.

The flicker problem was the first wall. Cancelling the interaction in beforeEvents.playerInteractWithBlock genuinely stops the door from opening on the server — I verified the block state stayed closed. But the client had already animated its predicted swing, and because the server state never changed, no corrective block update was ever sent. The result: every locked door visibly opened for about half a second whenever anyone tapped it. The fix was to stop pretending a vanilla door can be protected by script, and instead replace it with a custom block: the engine has no hand-open path for a custom block, so the client never predicts anything. That is the same trick QB Doors uses, and it is why the door cannot flicker.

Then came the small cruelties. A door carries two direction states — a modern minecraft:cardinal_direction and a legacy integer direction — and the renderer honours the integer, so restoring only one leaves the door rotated. Block-model space flips the X axis, so panels kept landing on the wrong side of their cell. Oak is special twice over: its block id is minecraft:wooden_door (the item is oak_door) and its texture is door_wood_* rather than door_oak_*, while every other wood's texture is drawn mirrored relative to it. The two halves of a door can even hold different hinge bits, and the upper half is the one that actually distinguishes the doors of a double pair.

Worst of all: state degraded silently. Rebuilding a door beside its partner makes vanilla re-derive the hinge, so locking and releasing a door repeatedly walked its hinge bit to the wrong value. The door had to be re-asserted a couple of ticks after the restore, and the original values recorded rather than re-read.

And then the most embarrassing one. For several evenings the geometry changes appeared to change nothing at all. The code was right, the files on the server were right — the client was serving a cached copy of the resource pack, because I had only bumped the version and not the pack's UUID. An hour of that would have been saved by remembering that clients key their cache on the UUID.

The final appearance rules are not derived from documentation — there isn't any covering this — but from eight vanilla doors placed, locked, opened and compared side by side, then encoded as explicit lookup tables.

Get it

No Mojang assets are shipped — the resource pack points at the client's own vanilla door textures rather than redistributing them. The code is MIT licensed.

If you run a world where rooms actually need to stay shut, I hope it saves you the evenings it cost me.