// priority: 1000

// 生物死亡事件
NativeEvents.onEvent($LivingDeathEvent, event => {
    let player = event.source?.player;
    if (player) {
        deathevent(event)
    }
});

// 玩家受伤/造成伤害事件
NativeEvents.onEvent($LivingHurtEvent, event => {
    if (event.entity && event.source.actual) {
        entityhurt(event)
        //仆从增加易伤
        pu_cong_yi_shang(event);
        damage_source_change(event);
    }
    if (event.entity.isPlayer()) {
        playerhurt(event);
        pu_cong_target_change_hurt(event);
    }
    if (event.source.player && !event.entity.isPlayer()) {
        playerattack(event);
        pu_cong_target_change_attack(event);
    }
});

// 装备变动事件
NativeEvents.onEvent($LivingEquipmentChangeEvent, event => {
    if (!event.entity || !event.entity.isPlayer()) return;
    EquipmentChange(event);
});

// 维度跨越事件
NativeEvents.onEvent($EntityTravelToDimensionEvent, event => {
    if (event.entity.isPlayer()) {
        PlayerChangedDimensionEvent_2(event);
        PlayerChangedDimensionEvent_3(event);
    }
});

// 目标切换事件
NativeEvents.onEvent($LivingChangeTargetEvent, event => {
    if (!event.getEntity().getLevel().isClientSide()) {
        target_change(event);
        ru_meng(event);
        lei_ling(event);
        other_target_change(event);
        
    }
});

// 攻击事件
NativeEvents.onEvent($LivingAttackEvent, event => {
    if (event.entity && event.source.actual) {
        entity_hurt_cancle(event);
    }
});