Skip to content

Access Controller

The Access Controller blockAccess Controller: open
Access Controller: normal, open. Asset render of the block model, not an in-game screenshot.

The Access Controller guards a door. A player uses it to ask to come in. Allowed players get a short redstone pulse that opens the door; everyone else is refused. It works on its own, without any program or computer.

Access Controller

Shaped crafting table recipe. Progression: intermediate automation. Ingredients: 4 × Iron Ingot, 1 × Glass Pane, 2 × Any button, 1 × Redstone, 1 × Gold Ingot. It appears in the recipe book once you pick up one of its ingredients.

  1. Place it next to a door, lamp or other redstone device. Its keypad faces you.
  2. Sneak and use it with an empty hand to open its form.
  3. Add players by name with Player name and Allow (they must be online), or switch restricted to public to let everyone in.
  4. Set Seconds (1 to 30, default 3) and Side, the side it powers: all or a face such as north. Select Save. Test opens it once.

Other players use it with an empty hand. The owner, trusted players and listed players are let in: the light on the keypad turns green and the outputs are powered for the set time. Everyone else hears a low note and sees Access denied. The form lists the last 10 attempts. A new controller starts restricted.

It does not need to be linked to a computer to work. Link it to a Network Repeater when a program should react to visitors.

Yes. A drive program can react to attempts and open the door, for example to keep a guest book. See the Door guest book starter. Programs can open and close it and read the list, but they cannot change who is allowed or make it public.

accessControllers.named(alias)

Refer to an Access Controller by its name. Use it in a constant, then handle its events with on NAME.event(...).

Parameters: alias: string. Gives: AccessController. Cost: 4 operations.

const front_door = accessControllers.named("front_door")

accessControllers.from(alias)

Resolve an access controller by name.

Parameters: alias: string. Gives: AccessController, or an error. Errors: device.type, device.unavailable, device.unknown, host.denied. Capability: access.control. Cost: 16 operations.

door, err = accessControllers.from("front_door")

Properties: front_door.connected, front_door.id, front_door.kind, front_door.name. They are read-only.

front_door.allowed()

List the names of players on the access list.

Gives: list, or an error. Errors: device.type, device.unavailable, device.unknown, host.denied. Capability: access.control. Cost: 8 operations.

names = door.allowed()

front_door.close()

Turn the outputs off now.

Gives: bool, or an error. Errors: device.type, device.unavailable, device.unknown, host.denied. Capability: access.control. Cost: 16 operations.

door.close()

front_door.isOpen()

True while the outputs are powered.

Gives: bool, or an error. Errors: device.type, device.unavailable, device.unknown, host.denied. Capability: access.control. Cost: 4 operations.

if door.isOpen() { print("open") }

front_door.isPublic()

True when anyone may open the door.

Gives: bool, or an error. Errors: device.type, device.unavailable, device.unknown, host.denied. Capability: access.control. Cost: 4 operations.

open = door.isPublic()

front_door.open()

Power the outputs for the configured number of seconds, as if access was granted.

Gives: bool, or an error. Errors: access.limit, device.type, device.unavailable, device.unknown, host.denied. Capability: access.control. Cost: 24 operations.

door.open()

front_door.openFor(seconds)

Power the outputs for 1 to 30 seconds.

Parameters: seconds: number. Gives: bool, or an error. Errors: access.limit, argument.range, device.type, device.unavailable, device.unknown, host.denied. Capability: access.control. Cost: 24 operations.

door.openFor(10)

front_door.recent()

List up to 10 recent attempts, newest first, as text.

Gives: list, or an error. Errors: device.type, device.unavailable, device.unknown, host.denied. Capability: access.control. Cost: 8 operations.

for line in door.recent() { print(line) }
EventWhen it runs
accessAttempted(player)Runs when a player uses the controller. player has name, uuid and result (Access.GRANTED or Access.DENIED).
accessGranted(player)Runs when a player is let in.
accessDenied(player)Runs when a player is refused.
connectedRuns when the device becomes reachable, for example after its area loads.
disconnectedRuns when the device stops being reachable: unloaded, unlinked or removed.
programStartedRuns when the device's own program starts.
programStoppedRuns when the device's own program stops.
programFailed(message)Runs when the device's own program stops on an error.

Each event’s player is {name, uuid, result, granted}, where result is Access.GRANTED or Access.DENIED.

  • Up to 32 players on the list, by UUID. Only online players can be added; offline players can be removed.
  • Only the owner can change the list and the public setting.
  • It never changes Minecraft permissions or protects blocks: anyone can still break into a house through a wall.
  • A server allows 256 controllers to be open at once; more fail with access.limit.
const front_door = accessControllers.named("front_door")
on front_door.accessDenied(player) {
print(player.name + " tried to come in")
}