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


export class lv_xt {
    static run() {
      world.afterEvents.playerSpawn.subscribe((e) => {
        const player = e.player
          if (e.initialSpawn === true && !player.hasTag('xxltnt_spawned')) {
            this.replaceItem(player, 'dh_xt:recipe_book_spawn_egg')
            player.addTag('xxltnt_spawned')
          }
      });
  }
  static replaceItem(source, itemToReplace) {
    const equipment = source.getComponent('equippable');
    const item = new ItemStack(itemToReplace);
    equipment.setEquipment(EquipmentSlot.Mainhand, item);
  }
}

