MEJSEvents.entityStartRiding(event => {
    let entity = event.entity
    let mount = event.vehicle
    //科妮莉亚骑乘任何实体时杀死实体
    if (entity.type === "aquamirae:captain_cornelia") {
        mount.discard()
    }
    //祈灵师乘任何实体时杀死实体
    if (entity.type === "mowziesmobs:frostmaw") {
        mount.discard()
    }
})
MEJSEvents.entityStopRiding(event => {
    let entity = event.entity
    let mount = event.vehicle
    //玩家离开登记的坐骑时送回坐骑
    if (mount.tags.contains("snk_mount")) {
        entity.server.scheduleInTicks(3, () => {
            //切换战略模式也会触发停止骑乘监听，需要排除此情况
            if (mount.getPassengers().length > 0) return
            let pUuid = entity.uuid.toString()
            let allow = true
            entity.server.entities.forEach(stable => {
                if (allow === false) return
                let sData = stable.persistentData
                let sUuid = sData.getString("pUuid")
                if (stable.tags.contains('snk_stable') && sUuid === pUuid) {
                    mount.teleportTo(stable.level.dimension.path, stable.x, stable.y + 3, stable.z, 0, 0)
                    allow = false
                }
            })
        })
    }
    //玩家离开召唤的矿车时删除矿车
    if (mount.tags.contains("snk_player_minecart")) {
        mount.discard()
    }
})