import BlockTransformation from '../transformations/blockTransformation';
// eslint-disable-next-line import/no-cycle
import { destroySnowLayer, destroyAttachedVines, destroyHangingPropagule, replaceDirtBelow, destroyAttachedCocoa, transformLogBlock, mangroveLogReplaceTips, destroyHangingMoss } from './utils';
import { Biome } from '../chunk';
const rules = [
    {
        from: [
            'minecraft:birch_leaves',
            'minecraft:dark_oak_leaves',
            'minecraft:cherry_leaves',
            'minecraft:azalea_leaves',
            'minecraft:azalea_leaves_flowered',
        ],
        to: new BlockTransformation(null)
    },
    {
        from: ['minecraft:spruce_leaves'],
        to: new BlockTransformation(null, { beforeConvert: destroySnowLayer })
    },
    {
        from: ['minecraft:oak_leaves'],
        to: new BlockTransformation(null, { beforeConvert: destroyAttachedVines })
    },
    {
        from: ['minecraft:acacia_leaves'],
        to: new BlockTransformation(null, { setBiome: Biome.SAVANNAH })
    },
    {
        from: ['minecraft:jungle_leaves'],
        to: new BlockTransformation(null, {
            beforeConvert: destroyAttachedVines,
            setBiome: Biome.JUNGLE
        })
    },
    {
        from: ['minecraft:mangrove_leaves'],
        to: new BlockTransformation(null, {
            beforeConvert: (b) => {
                destroyAttachedVines(b);
                destroyHangingPropagule(b);
            },
            setBiome: Biome.MANGROVE,
        })
    },
    {
        from: ['minecraft:pale_oak_leaves'],
        to: new BlockTransformation(null, { beforeConvert: destroyHangingMoss })
    },
    {
        from: [
            'minecraft:oak_log',
            'minecraft:spruce_log',
            'minecraft:birch_log',
            'minecraft:dark_oak_log',
            'minecraft:cherry_log',
            'minecraft:creaking_heart',
        ],
        // to: new BlockTransformation('twb_wisu:withered_log', {mapStates:{pillar_axis: transformLogBlock} })
        to: new BlockTransformation(null, { afterConvert: replaceDirtBelow })
    },
    {
        from: ['minecraft:acacia_log'],
        to: new BlockTransformation(null, { setBiome: Biome.SAVANNAH, afterConvert: replaceDirtBelow })
    },
    {
        from: ['minecraft:mangrove_log'],
        to: new BlockTransformation('twb_wisu:withered_log', {
            mapStates: { pillar_axis: transformLogBlock },
            afterConvert: mangroveLogReplaceTips,
            setBiome: Biome.MANGROVE
        })
    },
    {
        from: ['minecraft:jungle_log'],
        // to: new BlockTransformation('twb_wisu:withered_log', {mapStates:{pillar_axis: transformLogBlock} })
        to: new BlockTransformation(null, {
            beforeConvert: (b) => {
                destroyAttachedCocoa(b);
                destroyAttachedVines(b);
            },
            afterConvert: replaceDirtBelow,
            setBiome: Biome.JUNGLE,
        })
    },
    {
        from: ['minecraft:pale_oak_log',],
        to: new BlockTransformation(null, {
            beforeConvert: destroyHangingMoss,
            afterConvert: replaceDirtBelow,
        })
    },
    {
        from: ['minecraft:bee_nest'],
        to: new BlockTransformation(null)
    },
    {
        from: ['minecraft:mangrove_propagule'],
        to: new BlockTransformation(null, { setBiome: Biome.MANGROVE })
    },
    {
        from: ['minecraft:mangrove_roots'],
        to: new BlockTransformation('twb_wisu:withered_roots', { setBiome: Biome.MANGROVE })
    },
    {
        from: ['minecraft:cocoa'],
        to: new BlockTransformation(null, { setBiome: Biome.JUNGLE })
    }
];
export default rules;
