import ConditionalBlockTransformation from '../transformations/conditionalBlockTransformation';
import BlockTransformation from '../transformations/blockTransformation';
import { ashLayerToBlock, convertBlockAboveGrass, convertBlockAboveNonRepeat, generateSmallTree, isInAshPatch, isInSoulPatch, placeSoulFire, placeTallWilt, spreadAsh } from './utils';
import { Biome } from '../chunk';
const rules = [
    {
        from: ['minecraft:grass_block', 'minecraft:podzol', 'minecraft:pale_moss_block'],
        to: new ConditionalBlockTransformation(new BlockTransformation('twb_wisu:ash_layer', { states: { 'twb_wisu:level': 7 }, beforeConvert: convertBlockAboveGrass, afterConvert: ashLayerToBlock }), new ConditionalBlockTransformation(new BlockTransformation('minecraft:soul_sand', {
            beforeConvert: convertBlockAboveGrass,
            afterConvert: (b) => {
                placeSoulFire(b);
            },
        }), new BlockTransformation('twb_wisu:wilt_block', {
            beforeConvert: (b) => {
                placeTallWilt(b);
                generateSmallTree(b);
            }
        }), isInSoulPatch), isInAshPatch)
    },
    {
        from: ['minecraft:dirt', 'minecraft:coarse_dirt'],
        to: new ConditionalBlockTransformation(new BlockTransformation('twb_wisu:ash', { afterConvert: convertBlockAboveNonRepeat }), new ConditionalBlockTransformation(new BlockTransformation('minecraft:soul_sand', { afterConvert: convertBlockAboveNonRepeat }), new BlockTransformation('minecraft:soul_soil', { afterConvert: convertBlockAboveNonRepeat }), isInSoulPatch), isInAshPatch)
    },
    {
        from: [
            'minecraft:mossy_cobblestone',
            'minecraft:stone',
            'minecraft:andesite',
            'minecraft:diorite',
            'minecraft:granite',
            'minecraft:coal_ore',
            'minecraft:iron_ore',
            'minecraft:copper_ore',
            'minecraft:gold_ore',
            'minecraft:lapis_ore',
            'minecraft:redstone_ore',
            'minecraft:emerald_ore',
            'minecraft:diamond_ore',
        ],
        to: new BlockTransformation('twb_wisu:withered_stone')
    },
    {
        from: [
            'minecraft:hardened_clay',
            'minecraft:white_terracotta',
            'minecraft:light_gray_terracotta',
            'minecraft:gray_terracotta',
            'minecraft:black_terracotta',
            'minecraft:brown_terracotta',
            'minecraft:red_terracotta',
            'minecraft:orange_terracotta',
            'minecraft:yellow_terracotta',
            'minecraft:lime_terracotta',
            'minecraft:green_terracotta',
            'minecraft:cyan_terracotta',
            'minecraft:light_blue_terracotta',
            'minecraft:blue_terracotta',
            'minecraft:purple_terracotta',
            'minecraft:magenta_terracotta',
            'minecraft:pink_terracotta',
        ],
        to: new BlockTransformation('twb_wisu:withered_stone', { setBiome: Biome.DESERT, afterConvert: convertBlockAboveNonRepeat })
    },
    {
        from: [
            'minecraft:sand',
            'minecraft:red_sand',
            'minecraft:clay',
            'minecraft:gravel',
        ],
        to: new BlockTransformation('twb_wisu:ash')
    },
    {
        from: ['minecraft:sandstone'],
        to: new BlockTransformation('twb_wisu:ash', { setBiome: Biome.DESERT })
    },
    {
        from: [
            'minecraft:mud',
            'minecraft:muddy_mangrove_roots'
        ],
        to: new BlockTransformation('twb_wisu:ash', { setBiome: Biome.MANGROVE })
    },
    {
        from: ['minecraft:grass_path'],
        to: new BlockTransformation('minecraft:soul_sand')
    },
    {
        from: ['minecraft:farmland'],
        to: new BlockTransformation('minecraft:soul_sand', { afterConvert: convertBlockAboveNonRepeat })
    },
    {
        from: ['minecraft:snow'],
        to: new BlockTransformation('twb_wisu:ash', {
            afterConvert: (b, p) => {
                convertBlockAboveNonRepeat(b, p);
                spreadAsh(b, new Set(['minecraft:snow_layer']));
            }
        })
    },
    {
        from: ['minecraft:powder_snow'],
        to: new BlockTransformation('minecraft:soul_sand')
    },
];
export default rules;
