minecraft:rail_sensor

Dynamic value

Properties

This component has no properties in the official schema: add it as an empty object {} to switch the behaviour on.

Example from the game files

This is how vanilla Minecart with Command Block uses it in Minecraft Bedrock 1.26.60.5:

{
  "minecraft:rail_sensor": {
    "check_block_types": true,
    "on_deactivate": {
      "event": "minecraft:command_block_deactivate"
    },
    "eject_on_activate": false,
    "eject_on_deactivate": false,
    "tick_command_block_on_activate": true,
    "tick_command_block_on_deactivate": false
  }
}

Used by 4

Vanilla entities with minecraft:rail_sensor in their definition:

Related components