import { world } from "@minecraft/server";
import { multiblockManager } from "../Dino/MultiblockManager";
//blockComponents
const blockComponents = [
  {
    id: "pb_dino:multiblock_component",
    code: {
      onTick: (data) => {
        multiblockManager.update(data.block);
      },
    },
  },
];
let reload = 0;
world.beforeEvents.worldInitialize.subscribe((data) => {
  //reload is needed to stop crashes
  reload = reload + 1;
  if (reload > 1) return;
  //registers the component
  for (const comp of blockComponents)
    data.blockComponentRegistry.registerCustomComponent(comp.id, comp.code);
});


