1. Wiki
  2. /Entities
  3. /minecraft:rail_sensor

minecraft:rail_sensor

Don't want to write this by hand? GodCraft sets minecraft:rail_sensor for you with a switch.Get GodCraft

Overview

minecraft:rail_sensor is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Reacts when the entity rolls over an activator rail, turning things on or off or throwing out riders.

Fields

FieldTypeDefaultDescription
check_block_typesBoolean"false"If true, the entity checks the block it is on every tick and runs its deactivate behavior when it is not on a rail.
eject_on_activateBoolean"true"If true, riders are thrown out when passing over a powered activator rail.
eject_on_deactivateBoolean"false"If true, riders are thrown out when passing over an unpowered activator rail.
on_activateStringnoneEvent to run when passing over a powered activator rail.
on_deactivateStringnoneEvent to run when passing over an unpowered activator rail.
tick_command_block_on_activateBoolean"true"If true, a command block minecart starts running when it hits a powered rail.
tick_command_block_on_deactivateBoolean"false"If false, a command block minecart stops running when it hits an unpowered rail.

Example

Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):

BP/entities/<name>.json
{
  "minecraft:rail_sensor": {
    "check_block_types": "false",
    "eject_on_activate": "true",
    "eject_on_deactivate": "false",
    "on_activate": "",
    "on_deactivate": "",
    "tick_command_block_on_activate": "true",
    "tick_command_block_on_deactivate": "false"
  }
}

We use cookies to improve your experience and analyse site traffic. Learn more