import { world, ItemStack } from '@minecraft/server';
import './features/blasters';
import './features/entitySystems';
import './features/dynamicLight';

// Give guidebook on first spawn
world.afterEvents.playerSpawn.subscribe(event => {
  const { player, initialSpawn } = event;
  if (!initialSpawn) return;
  if (player.getDynamicProperty('compycraft_alien:given_book')) return;

  player.dimension.spawnItem(new ItemStack('compycraft_alien:guide_1'), player.location);
  player.setDynamicProperty('compycraft_alien:given_book', true);
});