export class HurtBlockComponent {
    constructor() {
        this.onTick = this.onTick.bind(this);
    }
    onTick(event) {
        let height = 0;
        let damageEvent = ((entity) => {
            entity.applyDamage(0.5);
        });
        if (event.block.typeId !== "pu_biomes:bubble_cactus")
            height = 1;
        if (event.block.typeId === "pu_biomes:toxic_magma") {
            damageEvent = ((entity) => {
                entity.addEffect("minecraft:poison", 20, { showParticles: false, amplifier: 2 });
            });
        }
        const location = {
            x: event.block.location.x,
            y: event.block.location.y + height,
            z: event.block.location.z
        };
        const entities = event.dimension.getEntities({
            location,
            minDistance: 0,
            maxDistance: 1
        });
        entities.forEach((entity) => {
            if (!entity.isSneaking)
                damageEvent(entity);
        });
    }
}
HurtBlockComponent.id = 'pu_biomes:hurt_block';
