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.blockComponentRegistry.registerCustomComponent('tool_indicator:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function indicator_place`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('tool_rover:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function rover_place`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('tool_vhs:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function vhs_place`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('vhs_tape2:trigger', {
  onPlayerInteract: e => { e.player.runCommand("function hw_tp2"); },
});

initEvent.blockComponentRegistry.registerCustomComponent('vhs_tape1:trigger', {
  onPlayerInteract: e => { e.player.runCommand("function hw_tp1"); },
});

initEvent.blockComponentRegistry.registerCustomComponent('vhs_tape3:trigger', {
  onPlayerInteract: e => { e.player.runCommand("function hw_tp3"); },
});

initEvent.blockComponentRegistry.registerCustomComponent('vhs_tape4:trigger', {
  onPlayerInteract: e => { e.player.runCommand("function hw_tp4"); },
});

initEvent.blockComponentRegistry.registerCustomComponent('vhs_tape5:trigger', {
  onPlayerInteract: e => { e.player.runCommand("function hw_tp5"); },
});

initEvent.blockComponentRegistry.registerCustomComponent('vhs_tape6:trigger', {
  onPlayerInteract: e => { e.player.runCommand("function hw_tp6"); },
});

initEvent.blockComponentRegistry.registerCustomComponent('vhs_tape7:trigger', {
  onPlayerInteract: e => { e.player.runCommand("function hw_tp7"); },
});

initEvent.blockComponentRegistry.registerCustomComponent('vhs_tape9:trigger', {
  onPlayerInteract: e => { e.player.runCommand("function hw_tp9"); },
});

initEvent.blockComponentRegistry.registerCustomComponent('vhs_tape8:trigger', {
  onPlayerInteract: e => { e.player.runCommand("function hw_tp8"); },
});

initEvent.blockComponentRegistry.registerCustomComponent('vhs_tape10:trigger', {
  onPlayerInteract: e => { e.player.runCommand("function hw_tp10"); },
});

initEvent.blockComponentRegistry.registerCustomComponent('hw_dirt_trail:trigger', {
  onTick: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function dirt_trail_dr`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('hw_torch_break:trigger', {
  onTick: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function dirt_trail_dr`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_visor_pose2:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_visor_pose2`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_visor_pose5:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_visor_pose5`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_visor_pose3:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_visor_pose3`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_visor_pose1:trigger', {
  onPlayerDestroy: e => { e.player.runCommand("function frmini_en"); },
onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_visor_pose1`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_visor_pose4:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_visor_pose4`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_electro_pose1:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_electro_pose1`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_electro_pose4:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_electro_pose4`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_electro_pose2:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_electro_pose2`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_electro_pose3:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_electro_pose3`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('tool_cage_trap:trigger', {
  onTick: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function block_cage_trap_tick`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_electro_pose5:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_electro_pose5`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('hw_dirt_sm:trigger', {
  onTick: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function hw_summon_spirits`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_ob_pose1:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_ob_pose1`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_ob_pose2:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_ob_pose2`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_ob_pose3:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_ob_pose3`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_ob_pose4:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_ob_pose4`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_ob_pose5:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_ob_pose5`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_ad_pose2:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_adam_pose2`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_ad_pose3:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_adam_pose3`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_ad_pose4:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_adam_pose4`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_ad_pose1:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_adam_pose1`); },
});

initEvent.blockComponentRegistry.registerCustomComponent('figure_ad_pose5:trigger', {
  onPlayerInteract: e => { e.dimension.runCommand(`execute positioned ${e.block.location.x} ${e.block.location.y} ${e.block.location.z} run function fr_adam_pose5`); },
});

});
