minecraft:rail_sensor for you with a switch.Get GodCraftOverview
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
| Field | Type | Default | Description |
|---|---|---|---|
check_block_types | Boolean | "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_activate | Boolean | "true" | If true, riders are thrown out when passing over a powered activator rail. |
eject_on_deactivate | Boolean | "false" | If true, riders are thrown out when passing over an unpowered activator rail. |
on_activate | String | none | Event to run when passing over a powered activator rail. |
on_deactivate | String | none | Event to run when passing over an unpowered activator rail. |
tick_command_block_on_activate | Boolean | "true" | If true, a command block minecart starts running when it hits a powered rail. |
tick_command_block_on_deactivate | Boolean | "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"
}
}