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

import com.mojang.datafixers.kinds.Applicative;
import com.mojang.datafixers.kinds.App;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.world.level.levelgen.structure.templatesystem.BlockIgnoreProcessor;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
import net.minecraft.world.level.block.Rotation;
import com.google.common.collect.ImmutableList;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import net.minecraft.resources.ResourceLocation;
import com.mojang.datafixers.util.Either;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessor;
import java.util.List;
import com.mojang.serialization.Codec;

public class LegacySinglePoolElement extends SinglePoolElement {
    public static final Codec<LegacySinglePoolElement> CODEC;
    
    @Deprecated
    public LegacySinglePoolElement(final String string, final List<StructureProcessor> list) {
        super(string, list);
    }
    
    private LegacySinglePoolElement(final Either<ResourceLocation, StructureTemplate> either, final List<StructureProcessor> list, final StructureTemplatePool.Projection a) {
        super(either, list, a);
    }
    
    @Deprecated
    public LegacySinglePoolElement(final String string) {
        super(string, ImmutableList.of());
    }
    
    @Override
    protected StructurePlaceSettings getSettings(final Rotation cap, final BoundingBox ctd, final boolean boolean3) {
        final StructurePlaceSettings cvb5 = super.getSettings(cap, ctd, boolean3);
        cvb5.popProcessor(BlockIgnoreProcessor.STRUCTURE_BLOCK);
        cvb5.addProcessor(BlockIgnoreProcessor.STRUCTURE_AND_AIR);
        return cvb5;
    }
    
    @Override
    public StructurePoolElementType<?> getType() {
        return StructurePoolElementType.LEGACY;
    }
    
    @Override
    public String toString() {
        return "LegacySingle[" + this.template + "]";
    }
    
    static {
        CODEC = RecordCodecBuilder.create(instance -> ((RecordCodecBuilder.Instance)instance).group((App)SinglePoolElement.<SinglePoolElement>templateCodec(), (App)SinglePoolElement.<SinglePoolElement>processorsCodec(), (App)StructurePoolElement.<StructurePoolElement>projectionCodec()).apply(instance, LegacySinglePoolElement::new));
    }
}
