import { world, system } from "@minecraft/server";


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

  initEvent.itemComponentRegistry.registerCustomComponent('pc_green:trigger', {
    onUse: e => {
      e.source.runCommand("function ppp");
      e.source.runCommand("function pppp");
      e.source.runCommand("function ppppp");
      e.source.runCommand("function pppppp");
      e.source.runCommand("function ppppppp");
      e.source.runCommand("function net");
      e.source.runCommand("function o09p0");
      e.source.runCommand("function o09p08");
    },
  });

  initEvent.itemComponentRegistry.registerCustomComponent('pc_purple:trigger', {
    onUse: e => {
      e.source.runCommand("function ggg");
      e.source.runCommand("function gggg");
      e.source.runCommand("function ggggg");
      e.source.runCommand("function gggggg");
      e.source.runCommand("function ggggggg");
      e.source.runCommand("function nettt");
      e.source.runCommand("function o09p0");
      e.source.runCommand("function o09p08");
    },
  });

  initEvent.itemComponentRegistry.registerCustomComponent('pc_gp_2:trigger', {
    onUse: e => {
      e.source.runCommand("function pppppp");
      e.source.runCommand("function ppppp");
      e.source.runCommand("function ppppppp");
    },
  });

  initEvent.itemComponentRegistry.registerCustomComponent('pc_gp_25:trigger', {
    onUse: e => {
      e.source.runCommand("function o9p");
      e.source.runCommand("function o09p");
      e.source.runCommand("function o09p0h79");
      e.source.runCommand("function o079p0h79");
    },
  });

  {
    initEvent.itemComponentRegistry.registerCustomComponent("pc_grabpack_g2: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("pc_grabpack_o: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("pc_grabpack_bg: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("pc_grabpack_ob: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("pc_grabpack_bp: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("pc_grabpack_omb:trigger", {
      onUse: e => {
        const equippable = e.source.getComponent("minecraft:equippable");
        if (!equippable) return;
        const mainhand = equippable.getEquipmentSlot("Mainhand");
        if (!mainhand.hasItem()) return;
        mainhand.amount++;
      },
      onUse: e => {
        e.source.runCommand("function gbr12")
      }
    });
  }
  {
    initEvent.itemComponentRegistry.registerCustomComponent("pc_grabpack_pr: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("pc_grabpack_p: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('pc_purple2:trigger', {
      onUse: e => {
        e.source.runCommand("function ggg");
        e.source.runCommand("function gggg");
        e.source.runCommand("function ggggg");
        e.source.runCommand("function nettt");
        e.source.runCommand("function o09p0");
        e.source.runCommand("function o09p08");
        e.source.runCommand("function o09p0h7");
        e.source.runCommand("function o079p0h79");
        e.source.runCommand("function o079p0h79y");
        e.source.runCommand("function ggggggg");
        e.source.runCommand("function o079p70h79y0");
      },
    });

    initEvent.itemComponentRegistry.registerCustomComponent('pc_green2:trigger', {
      onUse: e => {
        e.source.runCommand("function ppp");
        e.source.runCommand("function pppp");
        e.source.runCommand("function ppppp");
        e.source.runCommand("function net");
        e.source.runCommand("function o09p0");
        e.source.runCommand("function o09p08");
        e.source.runCommand("function o09p0h7");
        e.source.runCommand("function o09p0h79");
        e.source.runCommand("function o079p0h79y");
        e.source.runCommand("function pppppp");
        e.source.runCommand("function o079p0h79y0");
      },
    });

    initEvent.itemComponentRegistry.registerCustomComponent('pc_omni:trigger', {
      onUse: e => {
        e.source.runCommand("function gggggg");
        e.source.runCommand("function ppp");
        e.source.runCommand("function pppp");
        e.source.runCommand("function ggg");
        e.source.runCommand("function o9p");
        e.source.runCommand("function o09p");
        e.source.runCommand("function o09p0h79");
        e.source.runCommand("function o079p0h79");
      },
    });
  });
