import { system, BlockTypes } from "@minecraft/server";
const replaceMap = {
  "maca_probuilder:roof_precise": "maca_probuilder:roof",
  "maca_probuilder:roof_solid": "maca_probuilder:roof"
};
const replaceBlocks = {
  onTick(e) {
    const { dimension, block } = e;
    const perms = block.permutation.getAllStates() || false;
    if (!perms)
      return;
    const lookup = block.typeId;
    const ID = BlockTypes.get(replaceMap[lookup]);
    block.setType(ID);
    system.run(() => {
      const newBlock = dimension.getBlock(block.location);
      for (const [perm, value] of Object.entries(perms)) {
        newBlock.setPermutation(newBlock.permutation.withState(perm, value));
      }
    });
  }
};
export {
  replaceBlocks
};
