//空手右击轨道召唤矿车并乘坐
BlockEvents.rightClicked(
    [
        'minecraft:rail',
        'minecraft:powered_rail',
        'minecraft:detector_rail',
        'minecraft:activator_rail'
    ],
    event => {
        if (event.player.getHeldItem(event.hand).isEmpty() && event.player.getVehicle() === null) {
            let { x, y, z } = event.block
            let player = event.player.name.string
            event.server.runCommandSilent(`summon minecraft:minecart ${x} ${y} ${z} {Tags:[snk_player_minecart]}`)
            event.server.runCommandSilent(`ride ${player} mount @e[x=${x},y=${y},z=${z},type=minecart,tag=snk_player_minecart,distance=..1,limit=1]`)
        }
    })

// 禁止玩家与警卫村民的互动
ItemEvents.entityInteracted(event => {
    if (event.target.type === "guardvillagers:guard") {
        event.cancel()
    }
})