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 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 SimpleBlockPlacer extends BlockPlacer {
    public SimpleBlockPlacer() {
        super(BlockPlacerType.SIMPLE_BLOCK_PLACER);
    }
    
    public <T> SimpleBlockPlacer(final Dynamic<T> dynamic) {
        this();
    }
    
    @Override
    public void place(final LevelAccessor bjx, final BlockPos fk, final BlockState byj, final Random random) {
        bjx.setBlock(fk, byj, 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();
    }
}
