package net.minecraft.world.level.levelgen.feature.blockplacers;

import java.util.Map;
import com.google.common.collect.ImmutableMap;
import net.minecraft.core.Registry;
import com.mojang.datafixers.types.DynamicOps;
import net.minecraft.world.level.block.DoublePlantBlock;
import java.util.Random;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelAccessor;
import com.mojang.datafixers.Dynamic;

public class DoublePlantPlacer extends BlockPlacer {
    public DoublePlantPlacer() {
        super(BlockPlacerType.DOUBLE_PLANT_PLACER);
    }
    
    public <T> DoublePlantPlacer(final Dynamic<T> dynamic) {
        this();
    }
    
    @Override
    public void place(final LevelAccessor bjx, final BlockPos fk, final BlockState byj, final Random random) {
        ((DoublePlantBlock)byj.getBlock()).placeAt(bjx, fk, 2);
    }
    
    @Override
    public <T> T serialize(final DynamicOps<T> dynamicOps) {
        return (T)new Dynamic((DynamicOps)dynamicOps, dynamicOps.createMap((Map)ImmutableMap.of(dynamicOps.createString("type"), dynamicOps.createString(Registry.BLOCK_PLACER_TYPES.getKey(this.type).toString())))).getValue();
    }
}
