import { world } from "@minecraft/server";

const moduleEntities = [
    "pb_plane:module_bender_entity", "pb_plane:module_centrifuge_entity", "pb_plane:module_condenser_entity", "pb_plane:module_sewing_machine_entity"
]

world.afterEvents.entityDie.subscribe((data) => {
    const killed = data.deadEntity
    if (moduleEntities.includes(killed.typeId)) {
  
      const moduleBlock = killed.dimension.getBlock(killed.location)
  
      moduleBlock.setPermutation(
        moduleBlock.permutation.withState(
          "pb_plane:mb_connection",
          "single"
        )
      );
    }
  })