import { system, world } from '@minecraft/server';
import { decrementStack, getOppositeDirection, DirectionType, cardinalSides, randomFunction } from './utils/helper';
import { directionToVector3 } from './utils/math';

world.beforeEvents.worldInitialize.subscribe(initEvent => { initEvent.itemComponentRegistry.registerCustomComponent('jd_act_blood:trigger', {
  onUse: e => { e.source.runCommand("function act_blood"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_boogie:trigger', {
  onUse: e => { e.source.runCommand("function act_boogie"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_construction:trigger', {
  onUse: e => { e.source.runCommand("function act_contruction"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_cqueen:trigger', {
  onUse: e => { e.source.runCommand("function act_cqueen"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_comedian:trigger', {
  onUse: e => { e.source.runCommand("function act_comedian"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_blazing:trigger', {
  onUse: e => { e.source.runCommand("function act_blazing"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_finger:trigger', {
  onUse: e => { e.source.runCommand("function act_finger"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_limitless:trigger', {
  onUse: e => { e.source.runCommand("function act_limitless"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_judgeman:trigger', {
  onUse: e => { e.source.runCommand("function act_judgeman"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_cryokinesis:trigger', {
  onUse: e => { e.source.runCommand("function act_cryokinesis"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_insect:trigger', {
  onUse: e => { e.source.runCommand("function act_insect"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_gaze:trigger', {
  onUse: e => { e.source.runCommand("function act_gaze"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_cspeech:trigger', {
  onUse: e => { e.source.runCommand("function act_cspeech"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_extin:trigger', {
  onUse: e => { e.source.runCommand("function act_extin"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_maho:trigger', {
  onUse: e => { e.source.runCommand("function act_maho"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_projection:trigger', {
  onUse: e => { e.source.runCommand("function act_projection"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_lovet:trigger', {
  onUse: e => { e.source.runCommand("function act_lovet"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_rages:trigger', {
  onUse: e => { e.source.runCommand("function act_rages"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_shrine:trigger', {
  onUse: e => { e.source.runCommand("function act_shrine"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_ratio:trigger', {
  onUse: e => { e.source.runCommand("function act_ratio"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_rot:trigger', {
  onUse: e => { e.source.runCommand("function act_rot"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_miracles:trigger', {
  onUse: e => { e.source.runCommand("function act_miracles"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_volcanic:trigger', {
  onUse: e => { e.source.runCommand("function act_volcanic"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_tens:trigger', {
  onUse: e => { e.source.runCommand("function act_tens"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_act_strawd:trigger', {
  onUse: e => { e.source.runCommand("function act_strawd"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_blazing_2:trigger', {
  onUse: e => { e.source.runCommand("function blazing_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_blazing_1:trigger', {
  onUse: e => { e.source.runCommand("function blazing_1"); },
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_blazing_3:trigger', {
  onUse: e => { e.source.runCommand("function blazing_3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_blazing_4:trigger', {
  onUse: e => { e.source.runCommand("function blazing_4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_blood_2:trigger', {
  onUse: e => { e.source.runCommand("function blood_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_blood_1:trigger', {
  onUse: e => { e.source.runCommand("function blood_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_blood_3:trigger', {
  onUse: e => { e.source.runCommand("function blood_3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_blood_7:trigger', {
  onUse: e => { e.source.runCommand("function blood_7"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_blood_5:trigger', {
  onUse: e => { e.source.runCommand("function blood_5"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_blood_6:trigger', {
  onUse: e => { e.source.runCommand("function blood_6"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_blood_4:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_blood_more:trigger', {
  onUse: e => { e.source.runCommand("function blood_more"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_bluntsword:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_boogie_2_1:trigger', {
  onUse: e => { e.source.runCommand("function boogie_2_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_boogie_1:trigger', {
  onUse: e => { e.source.runCommand("function boogie_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_boogie_2:trigger', {
  onUse: e => { e.source.runCommand("function boogie_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_boogie_3:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil_boogie");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_boogie_4:trigger', {
  onUse: e => { e.source.runCommand("function boogie_4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_comedian_1:trigger', {
  onUse: e => { e.source.runCommand("function comedian_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_carnage:trigger', {
  onUse: e => { e.source.runCommand("function carnage_power"); },
  
  onHitEntity: e => { 
const functions = ["spearhit1", "spearhit2", "spearhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_comedian_4:trigger', {
  onUse: e => { e.source.runCommand("function comedian_4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_comedian_3:trigger', {
  onUse: e => { e.source.runCommand("function comedian_3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_comedian_2:trigger', {
  onUse: e => { e.source.runCommand("function comedian_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_construction_2:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_construction_1:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_blood:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_blood"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_cryokinesis:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_cryokinesis"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_boogie:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_boogie"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_blazing:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_blazing"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_construction_4:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_construction_3:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_miracles:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_miracles"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_gaze:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_gaze"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_finger:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_fingerb"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_extin:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_extin"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_insect:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_insect"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_lovet:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_lovet"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_limitless:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_limitless"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_judgeman:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_judgeman"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_ratio:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_ratio"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_projection:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_projection"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_tens:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_tens"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_rot:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_rot"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_volcanic:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_volcanic"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_shrine:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_shrine"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_copy_rages:trigger', {
  onUse: e => { e.source.runCommand("function pre_copy_act_rages"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cqueen_3:trigger', {
  onUse: e => { e.source.runCommand("function cqueen_3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cqueen_2:trigger', {
  onUse: e => { e.source.runCommand("function cqueen_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cqueen_4:trigger', {
  onUse: e => { e.source.runCommand("function cqueen_4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cqueen_1:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cqueen_6:trigger', {
  onUse: e => { e.source.runCommand("function cqueen_6"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cqueen_5:trigger', {
  onUse: e => { e.source.runCommand("function cqueen_5"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cqueen_7:trigger', {
  onUse: e => { e.source.runCommand("function cqueen_7"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cqueen_lovepu:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil_purple");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cryokinesis_1:trigger', {
  onUse: e => { e.source.runCommand("function cryokinesis_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cqueen_more:trigger', {
  onUse: e => { e.source.runCommand("function cqueen_more"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cqueen_rika:trigger', {
  onUse: e => { e.source.runCommand("function queen_rika"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cryokinesis_2:trigger', {
  onUse: e => { e.source.runCommand("function cryokinesis_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cryokinesis_1_2:trigger', {
  onUse: e => { e.source.runCommand("function cryokinesis_1_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cspeech_1:trigger', {
  onUse: e => { e.source.runCommand("function cspeech_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cspeech_2:trigger', {
  onUse: e => { e.source.runCommand("function cspeech_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cryokinesis_3:trigger', {
  onUse: e => { e.source.runCommand("function cryokinesis_3"); },
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cryokinesis_4:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cspeech_2_1:trigger', {
  onUse: e => { e.source.runCommand("function cspeech_2_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cspeech_3:trigger', {
  onUse: e => { e.source.runCommand("function cspeech_3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cspeech_4:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_curse_hide:trigger', {
  onUse: e => { e.source.runCommand("function cursehide"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_curse_regelvl2:trigger', {
  onUse: e => { e.source.runCommand("function curseregelvl2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_curse_regelvl1:trigger', {
  onUse: e => { e.source.runCommand("function curserege"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_cursekatanas:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_comedian:trigger', {
  onUse: e => { e.source.runCommand("function des_comedian"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_construction:trigger', {
  onUse: e => { e.source.runCommand("function des_contruction"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_cqueen:trigger', {
  onUse: e => { e.source.runCommand("function des_cqueen"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_blazing:trigger', {
  onUse: e => { e.source.runCommand("function des_blazing"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_boogie:trigger', {
  onUse: e => { e.source.runCommand("function des_boogie"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_cryokinesis:trigger', {
  onUse: e => { e.source.runCommand("function des_cryokinesis"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_blood:trigger', {
  onUse: e => { e.source.runCommand("function des_blood"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_insect:trigger', {
  onUse: e => { e.source.runCommand("function des_insect"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_cspeech:trigger', {
  onUse: e => { e.source.runCommand("function des_cspeech"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_limitless:trigger', {
  onUse: e => { e.source.runCommand("function des_limitless"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_extin:trigger', {
  onUse: e => { e.source.runCommand("function des_extin"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_judgeman:trigger', {
  onUse: e => { e.source.runCommand("function des_judgeman"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_finger:trigger', {
  onUse: e => { e.source.runCommand("function des_finger"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_lovet:trigger', {
  onUse: e => { e.source.runCommand("function des_lovet"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_gaze:trigger', {
  onUse: e => { e.source.runCommand("function des_gaze"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_maho:trigger', {
  onUse: e => { e.source.runCommand("function des_maho"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_ratio:trigger', {
  onUse: e => { e.source.runCommand("function des_ratio"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_shrine:trigger', {
  onUse: e => { e.source.runCommand("function des_shrine"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_projection:trigger', {
  onUse: e => { e.source.runCommand("function des_projection"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_miracles:trigger', {
  onUse: e => { e.source.runCommand("function des_miracles"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_strawd:trigger', {
  onUse: e => { e.source.runCommand("function des_strawd"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_rages:trigger', {
  onUse: e => { e.source.runCommand("function des_rages"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_rot:trigger', {
  onUse: e => { e.source.runCommand("function des_rot"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_volcanic:trigger', {
  onUse: e => { e.source.runCommand("function des_volcanic"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_des_tens:trigger', {
  onUse: e => { e.source.runCommand("function des_tens"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_diavoloarms:trigger', {
  onUse: e => { e.source.runCommand("function diavoloarms_power"); },
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_divineaxe:trigger', {
  onUse: e => { e.source.runCommand("function divineaxe_power"); },
  
  onHitEntity: e => { 
const functions = ["spearhit1", "spearhit2", "spearhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_domain_extin:trigger', {
  onUse: e => { e.source.runCommand("function domain_extin"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_domain_cqueen:trigger', {
  onUse: e => { e.source.runCommand("function domain_cqueen"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_domain_finger:trigger', {
  onUse: e => { e.source.runCommand("function domain_finger"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_divirgentsword:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_domain_limitless:trigger', {
  onUse: e => { e.source.runCommand("function domain_limitless_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_domain_judgeman:trigger', {
  onUse: e => { e.source.runCommand("function domain_judgeman"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_domain_rages:trigger', {
  onUse: e => { e.source.runCommand("function domain_rages"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_domain_shrine_2:trigger', {
  onUse: e => { e.source.runCommand("function domain_shrine_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_domain_lovet:trigger', {
  onUse: e => { e.source.runCommand("function domain_lovet"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_domain_shrine:trigger', {
  onUse: e => { e.source.runCommand("function domain_shrine"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_domain_projection:trigger', {
  onUse: e => { e.source.runCommand("function domain_projection"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_domain_insect:trigger', {
  onUse: e => { e.source.runCommand("function domain_insect"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_domain_tens:trigger', {
  onUse: e => { e.source.runCommand("function domain_tens"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_domain_volcanic:trigger', {
  onUse: e => { e.source.runCommand("function domain_volcanic"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_energyam_1:trigger', {
  onUse: e => { e.source.runCommand("function energyam_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_energyam_4:trigger', {
  onUse: e => { e.source.runCommand("function energyam_4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_energyam_2:trigger', {
  onUse: e => { e.source.runCommand("function energyam_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_energyam_3:trigger', {
  onUse: e => { e.source.runCommand("function energyam_3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_extin_2:trigger', {
  onUse: e => { e.source.runCommand("function extin_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_extin_1:trigger', {
  onUse: e => { e.source.runCommand("function extin_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_extin_3:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_extin_5:trigger', {
  onUse: e => { e.source.runCommand("function extin_5"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_extin_4:trigger', {
  onUse: e => { e.source.runCommand("function extin_4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_extin_6:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_extin_7:trigger', {
  onUse: e => { e.source.runCommand("function maximum_extin"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_extin_more:trigger', {
  onUse: e => { e.source.runCommand("function extin_more"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_finger_1:trigger', {
  onUse: e => { e.source.runCommand("function finger_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_finger_5:trigger', {
  onUse: e => { e.source.runCommand("function finger_5"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_finger_4:trigger', {
  onUse: e => { e.source.runCommand("function finger_4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_finger_6:trigger', {
  onUse: e => { e.source.runCommand("function finger_6"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_finger_3:trigger', {
  onUse: e => { e.source.runCommand("function finger_3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_finger_2:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_finger_sukuna:trigger', {
  onUse: e => { e.source.runCommand("function finger_sukuna"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_forced_reset:trigger', {
  onUse: e => { e.source.runCommand("function forced_reset"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_finger_more:trigger', {
  onUse: e => { e.source.runCommand("function finger_more"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_finger_7:trigger', {
  onUse: e => { e.source.runCommand("function finger_7"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_gaze_1:trigger', {
  onUse: e => { e.source.runCommand("function gaze_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_gaze_2:trigger', {
  onUse: e => { e.source.runCommand("function gaze_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade1_emotionfaof:trigger', {
  onUse: e => { e.source.runCommand("function grade1_emotionfaof"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade1_basketh:trigger', {
  onUse: e => { e.source.runCommand("function grade1_basketh"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade1_emotionfa:trigger', {
  onUse: e => { e.source.runCommand("function grade1_emotionfa"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade2_blackflash:trigger', {
  onUse: e => { e.source.runCommand("function grade2_blackflasha"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade1_rctlvl3:trigger', {
  onUse: e => { e.source.runCommand("function grade1_rctlvl3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade1_rctgroup:trigger', {
  onUse: e => { e.source.runCommand("function grade1_rctgroup"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade1_sdomainlvl3:trigger', {
  onUse: e => { e.source.runCommand("function grade1_sdomainlvl3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade2_curseperlvl3:trigger', {
  onUse: e => { e.source.runCommand("function grade2_curseperlvl3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade3_rctlvl1:trigger', {
  onUse: e => { e.source.runCommand("function grade3_rctlvl1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade2_energyam:trigger', {
  onUse: e => { e.source.runCommand("function grade2_energyam"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade2_rctlvl2:trigger', {
  onUse: e => { e.source.runCommand("function grade2_rctlvl2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade3_curseperlvl2:trigger', {
  onUse: e => { e.source.runCommand("function grade3_curseperlvl2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade2_sdomainlvl2:trigger', {
  onUse: e => { e.source.runCommand("function grade2_sdomainlvl2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade4_divirgent:trigger', {
  onUse: e => { e.source.runCommand("function grade4_divirgentf"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade3_rotatorc:trigger', {
  onUse: e => { e.source.runCommand("function grade3_rotatorc"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade3_sdomain:trigger', {
  onUse: e => { e.source.runCommand("function grade3_sdomain"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade4_curseper:trigger', {
  onUse: e => { e.source.runCommand("function grade4_curseper"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade4_quicka:trigger', {
  onUse: e => { e.source.runCommand("function grade4_quicka"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_grade4_unblock:trigger', {
  onUse: e => { e.source.runCommand("function grade4_unblock"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_halberd:trigger', {
  onUse: e => { e.source.runCommand("function pre_halberd_power"); },
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_heavenly2_dreamingw:trigger', {
  onUse: e => { e.source.runCommand("function heavenly2_dreamingw"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_heavenly1_kickh:trigger', {
  onUse: e => { e.source.runCommand("function heavenly1_kickh"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_heavenly1_doublew:trigger', {
  onUse: e => { e.source.runCommand("function heavenly1_doublew"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_heavenly2_hammerw:trigger', {
  onUse: e => { e.source.runCommand("function heavenly2_hammerw"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_heavenly1_blowb:trigger', {
  onUse: e => { e.source.runCommand("function heavenly1_blowb"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_heavenly2_dashh:trigger', {
  onUse: e => { e.source.runCommand("function heavenly2_dashh"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_heavenly3_enhahea:trigger', {
  onUse: e => { e.source.runCommand("function heavenly3_enhahea"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_heavenly3_shotth:trigger', {
  onUse: e => { e.source.runCommand("function heavenly3_shotth"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_heavenly3_slamhe:trigger', {
  onUse: e => { e.source.runCommand("function heavenly3_slamhe"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_heavenly3_fastre:trigger', {
  onUse: e => { e.source.runCommand("function heavenly3_fastre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_hollowp_200:trigger', {
  onUse: e => { e.source.runCommand("function limitless_7_200_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_infinity_off:trigger', {
  onUse: e => { e.source.runCommand("function infinity_off"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_infinity_on:trigger', {
  onUse: e => { e.source.runCommand("function infinity_on"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_insect_2:trigger', {
  onUse: e => { e.source.runCommand("function insect_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_insect_1:trigger', {
  onUse: e => { e.source.runCommand("function insect_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_insect_3:trigger', {
  onUse: e => { e.source.runCommand("function insect_3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_insect_5:trigger', {
  onUse: e => { e.source.runCommand("function insect_5"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_insect_6:trigger', {
  onUse: e => { e.source.runCommand("function insect_6"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_insect_7:trigger', {
  onUse: e => { e.source.runCommand("function maximum_insect"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_insect_4:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_insect_more:trigger', {
  onUse: e => { e.source.runCommand("function insect_more"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_judgeman_2_1:trigger', {
  onUse: e => { e.source.runCommand("function judgeman_2_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_judgeman_2:trigger', {
  onUse: e => { e.source.runCommand("function judgeman_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_judgeman_1:trigger', {
  onUse: e => { e.source.runCommand("function judgeman_1"); },
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_judgeman_3:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_judgeman_4:trigger', {
  onUse: e => { e.source.runCommand("function judgeman_4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_judgeman_sword:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["swordhit1_judgeman", "swordhit2_judgeman", "swordhit3_judgeman"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_legin_yoro:trigger', {
  onUse: e => { e.source.runCommand("function legin_yoro"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_limitless_1:trigger', {
  onUse: e => { e.source.runCommand("function limitless_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_limitless_2:trigger', {
  onUse: e => { e.source.runCommand("function limitless_2_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_limitless_3:trigger', {
  onUse: e => { e.source.runCommand("function limitless_3_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_limitless_4:trigger', {
  onUse: e => { e.source.runCommand("function limitless_4_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_limitless_1_2:trigger', {
  onUse: e => { e.source.runCommand("function limitless_1_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_limitless_4_y:trigger', {
  onUse: e => { e.source.runCommand("function limitless_4_y_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_limitless_more:trigger', {
  onUse: e => { e.source.runCommand("function limitless_more"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_limitless_5:trigger', {
  onUse: e => { e.source.runCommand("function limitless_5_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_limitless_7:trigger', {
  onUse: e => { e.source.runCommand("function limitless_7"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_limitless_6:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_lovet_1:trigger', {
  onUse: e => { e.source.runCommand("function lovet_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_lovet_2:trigger', {
  onUse: e => { e.source.runCommand("function lovet_2_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_limitless_purple_2:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil_purple2");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_limitless_purple:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil_purple");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_lovet_4:trigger', {
  onUse: e => { e.source.runCommand("function lovet_4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_lovet_5:trigger', {
  onUse: e => { e.source.runCommand("function lovet_5"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_lovet_6:trigger', {
  onUse: e => { e.source.runCommand("function lovet_6_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_lovet_3:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_lovet_more:trigger', {
  onUse: e => { e.source.runCommand("function lovet_more"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_lovet_7:trigger', {
  onUse: e => { e.source.runCommand("function lovet_7"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_maho_1:trigger', {
  onUse: e => { e.source.runCommand("function maho_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_maho_2:trigger', {
  onUse: e => { e.source.runCommand("function maho_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_magmablow:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_maho_3:trigger', {
  onUse: e => { e.source.runCommand("function maho_3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_maho_5:trigger', {
  onUse: e => { e.source.runCommand("function maho_5"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_maho_4:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_miracles_1:trigger', {
  onUse: e => { e.source.runCommand("function miracles_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_miracles_2:trigger', {
  onUse: e => { e.source.runCommand("function miracles_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_megumisword:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_missiongrade2:trigger', {
  onUse: e => { e.source.runCommand("function missiongrade2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_missiondomain:trigger', {
  onUse: e => { e.source.runCommand("function missiondomain"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_missionheavenly3:trigger', {
  onUse: e => { e.source.runCommand("function missionheavenly3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_missiongrade4:trigger', {
  onUse: e => { e.source.runCommand("function missiongrade4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_missiongrade1:trigger', {
  onUse: e => { e.source.runCommand("function missiongrade1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_missionheavenly1:trigger', {
  onUse: e => { e.source.runCommand("function missionheavenly1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_missionheavenly2:trigger', {
  onUse: e => { e.source.runCommand("function missionheavenly2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_missiongrade3:trigger', {
  onUse: e => { e.source.runCommand("function missiongrade3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_missionmaho:trigger', {
  onUse: e => { e.source.runCommand("function missionmaho"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_missionmaximum:trigger', {
  onUse: e => { e.source.runCommand("function missionmaximum"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_missionracelvl3:trigger', {
  onUse: e => { e.source.runCommand("function missionracelvl3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_missionracelvl1:trigger', {
  onUse: e => { e.source.runCommand("function missionracelvl1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_missionracelvl2:trigger', {
  onUse: e => { e.source.runCommand("function missionracelvl2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_mothersledge:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["spearhit1", "spearhit2", "spearhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_normalskills_2:trigger', {
  onUse: e => { e.source.runCommand("function normalskills_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_normalskills_1:trigger', {
  onUse: e => { e.source.runCommand("function normalskills_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_normalspear:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["spearhit1", "spearhit2", "spearhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_phy_dash:trigger', {
  onUse: e => { e.source.runCommand("function dash"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_phy_fkick:trigger', {
  onUse: e => { e.source.runCommand("function phy_fkick"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_phy_barrage:trigger', {
  onUse: e => { e.source.runCommand("function phy_barrage"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_oldmans:trigger', {
  onUse: e => { e.source.runCommand("function oldmank_power"); },
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_phy_knee:trigger', {
  onUse: e => { e.source.runCommand("function phy_knee"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_phy_kickto:trigger', {
  onUse: e => { e.source.runCommand("function phy_kickto"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_phy_puncht:trigger', {
  onUse: e => { e.source.runCommand("function phy_puncht"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_phy_pblow:trigger', {
  onUse: e => { e.source.runCommand("function phy_pblow"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_phy_majink:trigger', {
  onUse: e => { e.source.runCommand("function phy_majink"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_phy_jabs:trigger', {
  onUse: e => { e.source.runCommand("function phy_jabs"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_projection_2:trigger', {
  onUse: e => { e.source.runCommand("function projection_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_projection_1:trigger', {
  onUse: e => { e.source.runCommand("function projection_1_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_projection_4:trigger', {
  onUse: e => { e.source.runCommand("function projection_4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_projection_6:trigger', {
  onUse: e => { e.source.runCommand("function projection_6_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_projection_3:trigger', {
  onUse: e => { e.source.runCommand("function projection_3_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_projection_5:trigger', {
  onUse: e => { e.source.runCommand("function projection_5_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_projection_more:trigger', {
  onUse: e => { e.source.runCommand("function projection_more"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_projection_7:trigger', {
  onUse: e => {
        const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_raceitem_curse:trigger', {
  onUse: e => { e.source.runCommand("function race_curse"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_raceitem_cursev:trigger', {
  onUse: e => { e.source.runCommand("function race_cursev"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_raceitem_heavenly:trigger', {
  onUse: e => { e.source.runCommand("function race_heavenly"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_raceitem_human:trigger', {
  onUse: e => { e.source.runCommand("function race_human"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rages_3:trigger', {
  onUse: e => { e.source.runCommand("function rages_3_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rages_1:trigger', {
  onUse: e => { e.source.runCommand("function rages_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rages_2:trigger', {
  onUse: e => { e.source.runCommand("function rages_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rages_4:trigger', {
  onUse: e => { e.source.runCommand("function rages_4_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rages_7:trigger', {
  onUse: e => { e.source.runCommand("function rages_7"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rages_5:trigger', {
  onUse: e => { e.source.runCommand("function rages_5_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rages_55:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rages_6:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_randomtech:trigger', {
  onUse: e => { e.source.runCommand("function randomtech"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_random_race:trigger', {
  onUse: e => { e.source.runCommand("function randomrace"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rages_more:trigger', {
  onUse: e => { e.source.runCommand("function rages_more"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_ratio_2:trigger', {
  onUse: e => { e.source.runCommand("function ratio_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_ratio_4:trigger', {
  onUse: e => { e.source.runCommand("function ratio_4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_ratio_1:trigger', {
  onUse: e => { e.source.runCommand("function ratio_1"); },
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_ratio_3:trigger', {
  onUse: e => { e.source.runCommand("function ratio_3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_ratio_1_x2:trigger', {
  onUse: e => { e.source.runCommand("function ratio_1"); },
  
  onHitEntity: e => { 
const functions = ["swordhit1_ratio", "swordhit2_ratio", "swordhit3_ratio"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rot_1:trigger', {
  onUse: e => { e.source.runCommand("function rot_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rot_1_2:trigger', {
  onUse: e => { e.source.runCommand("function rot_1_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rot_2:trigger', {
  onUse: e => { e.source.runCommand("function rot_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rot_3:trigger', {
  onUse: e => { e.source.runCommand("function rot_3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rot_4:trigger', {
  onUse: e => { e.source.runCommand("function maximum_rot"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_rot_2_1:trigger', {
  onUse: e => { e.source.runCommand("function rot_2_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_sabersword:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_sharpmoon:trigger', {
  onUse: e => { e.source.runCommand("function sharpm_power"); },
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_shrine_1_2:trigger', {
  onUse: e => { e.source.runCommand("function shrine_1_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_shrine_1:trigger', {
  onUse: e => { e.source.runCommand("function shrine_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_shrine_2:trigger', {
  onUse: e => { e.source.runCommand("function shrine_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_shrine_2_1:trigger', {
  onUse: e => { e.source.runCommand("function shrine_2_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_shrine_4_a:trigger', {
  onUse: e => { e.source.runCommand("function shrine_4_a_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_shrine_3:trigger', {
  onUse: e => { e.source.runCommand("function shrine_3_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_shrine_4:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil_fuga");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_shrine_7:trigger', {
  onUse: e => { e.source.runCommand("function shrine_7"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_shrine_6:trigger', {
  onUse: e => { e.source.runCommand("function shrine_6_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_shrine_5:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil_cut");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_sixeyes:trigger', {
  onUse: e => { e.source.runCommand("function sixeyes"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_choso:trigger', {
  onUse: e => { e.source.runCommand("function spawn_choso"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_eso:trigger', {
  onUse: e => { e.source.runCommand("function spawn_eso"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_shrine_more:trigger', {
  onUse: e => { e.source.runCommand("function shrine_more"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_itadori:trigger', {
  onUse: e => { e.source.runCommand("function spawn_itadori"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_hakari:trigger', {
  onUse: e => { e.source.runCommand("function spawn_hakari"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_higuruma:trigger', {
  onUse: e => { e.source.runCommand("function spawn_higuruma"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_gojos:trigger', {
  onUse: e => { e.source.runCommand("function spawn_gojos"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_fingerb:trigger', {
  onUse: e => { e.source.runCommand("function spawn_fingerb"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_gojoy:trigger', {
  onUse: e => { e.source.runCommand("function spawn_gojoy"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_hana:trigger', {
  onUse: e => { e.source.runCommand("function spawn_hana"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_haruta:trigger', {
  onUse: e => { e.source.runCommand("function spawn_haruta"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_megumi:trigger', {
  onUse: e => { e.source.runCommand("function spawn_megumi"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_rantan:trigger', {
  onUse: e => { e.source.runCommand("function spawn_rantan"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_jogo:trigger', {
  onUse: e => { e.source.runCommand("function spawn_jogo"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_nanami:trigger', {
  onUse: e => { e.source.runCommand("function spawn_nanami"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_sukuna15f:trigger', {
  onUse: e => { e.source.runCommand("function spawn_sukuna15f"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_todo:trigger', {
  onUse: e => { e.source.runCommand("function spawn_todo"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_naoya:trigger', {
  onUse: e => { e.source.runCommand("function spawn_naoya"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_sukunaheian:trigger', {
  onUse: e => { e.source.runCommand("function spawn_sukunaheian"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_yorozu:trigger', {
  onUse: e => { e.source.runCommand("function spawn_yorozu"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_yuki:trigger', {
  onUse: e => { e.source.runCommand("function spawn_yuki"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_toji:trigger', {
  onUse: e => { e.source.runCommand("function spawn_toji"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_yuta:trigger', {
  onUse: e => { e.source.runCommand("function spawn_yuta"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_spawn_urahume:trigger', {
  onUse: e => { e.source.runCommand("function spawn_urahume"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_strawd_3:trigger', {
  onUse: e => { e.source.runCommand("function strawd_3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_strawd_4:trigger', {
  onUse: e => { e.source.runCommand("function strawd_4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_strawd_3_1:trigger', {
  onUse: e => { e.source.runCommand("function strawd_3_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_strawd_1:trigger', {
  onUse: e => { e.source.runCommand("function strawd_1"); },
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_splitkatana:trigger', {
  onUse: e => { e.source.runCommand("function pre_splitsoul_power"); },
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_strawd_2:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_sukunafa:trigger', {
  onUse: e => { e.source.runCommand("function sukunafa"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tens_2:trigger', {
  onUse: e => { e.source.runCommand("function tens_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tens_1:trigger', {
  onUse: e => { e.source.runCommand("function tens_1_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tanjirosword:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tens_4:trigger', {
  onUse: e => { e.source.runCommand("function tens_4_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tens_5:trigger', {
  onUse: e => { e.source.runCommand("function tens_5_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tens_3:trigger', {
  onUse: e => { e.source.runCommand("function tens_3"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tens_3_1:trigger', {
  onUse: e => { e.source.runCommand("function tens_3_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tens_mahoraga:trigger', {
  onUse: e => { e.source.runCommand("function tens_maho_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tens_agito:trigger', {
  onUse: e => { e.source.runCommand("function tens_agito_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tens_7_1:trigger', {
  onUse: e => { e.source.runCommand("function tens_7_1_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tens_6:trigger', {
  onUse: e => { e.source.runCommand("function tens_6_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tens_more:trigger', {
  onUse: e => { e.source.runCommand("function tens_more"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tens_7:trigger', {
  onUse: e => { e.source.runCommand("function tens_7_pre"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_tigerclaws:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_volcanic_2:trigger', {
  onUse: e => { e.source.runCommand("function volcanic_2"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_volcanic_1:trigger', {
  onUse: e => { e.source.runCommand("function volcanic_1"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_volcanic_10:trigger', {
  onUse: e => {
        const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_volcanic_3:trigger', {
  onUse: e => {
        e.source.runCommand("function proyectil");const equippable = e.source.getComponent("minecraft:equippable");
if (!equippable) return;
const mainhand = equippable.getEquipmentSlot("Mainhand");
if (!mainhand.hasItem()) return;
mainhand.amount++;
    },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_volcanic_7:trigger', {
  onUse: e => { e.source.runCommand("function maximum_volcanic"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_volcanic_5:trigger', {
  onUse: e => { e.source.runCommand("function volcanic_5"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_volcanic_6:trigger', {
  onUse: e => { e.source.runCommand("function volcanic_6"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_volcanic_4:trigger', {
  onUse: e => { e.source.runCommand("function volcanic_4"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_wing_angel:trigger', {
  onUse: e => { e.source.runCommand("function wing_angel"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_volcanic_more:trigger', {
  onUse: e => { e.source.runCommand("function volcanic_more"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_whitemace:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["spearhit1", "spearhit2", "spearhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_warspear:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["spearhit1", "spearhit2", "spearhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_wtf:trigger', {
  onUse: e => { e.source.runCommand("function wtf"); },
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_worthyh:trigger', {
  onUse: e => { e.source.runCommand("function worthyh_power"); },
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_yutasword:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});

initEvent.itemComponentRegistry.registerCustomComponent('jd_zangetsu:trigger', {
  
  
  onHitEntity: e => { 
const functions = ["swordhit1", "swordhit2", "swordhit3"];
          e.attackingEntity.runCommand(`function ${randomFunction(functions)}`);
           },
  
});
 });

