import { offsetPos } from "../util/dirUtils";
import { breakBlock } from "../util/miscUtils";
import { suppEvents } from "../suppEventHandler";
import { isUnbreakable } from "../util/blockProperties";
suppEvents.subscribeOnPistonPushed((event) => {
    if (event.isExpanding) {
        for (const block of event.attachedBlocks) {
            if (block.typeId == "razz_sup:ram_block" /* SuppBlocks.RamBlock */) {
                const target = offsetPos(block, event.pistonDir, 1);
                if (target.isAir)
                    return;
                if (isUnbreakable(target.permutation)) {
                    const options = { pitch: 1.7, volume: 0.4 };
                    target.dimension.playSound("random.anvil_land", target.center(), options);
                    return;
                }
                const options = { pitch: 1.7, volume: 1 };
                target.dimension.playSound("mob.goat.ram_impact", target.center(), options);
                breakBlock(target);
            }
        }
    }
});
