001package net.minecraft.world.gen.structure;
002
003import java.util.List;
004import java.util.Random;
005import net.minecraft.world.World;
006
007public class ComponentStrongholdLeftTurn extends ComponentStronghold
008{
009    protected final EnumDoor doorType;
010
011    public ComponentStrongholdLeftTurn(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4)
012    {
013        super(par1);
014        this.coordBaseMode = par4;
015        this.doorType = this.getRandomDoor(par2Random);
016        this.boundingBox = par3StructureBoundingBox;
017    }
018
019    /**
020     * Initiates construction of the Structure Component picked, at the current Location of StructGen
021     */
022    public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random)
023    {
024        if (this.coordBaseMode != 2 && this.coordBaseMode != 3)
025        {
026            this.getNextComponentZ((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1);
027        }
028        else
029        {
030            this.getNextComponentX((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1);
031        }
032    }
033
034    public static ComponentStrongholdLeftTurn findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6)
035    {
036        StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, 5, par5);
037        return canStrongholdGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(par0List, structureboundingbox) == null ? new ComponentStrongholdLeftTurn(par6, par1Random, structureboundingbox, par5) : null;
038    }
039
040    /**
041     * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
042     * the end, it adds Fences...
043     */
044    public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
045    {
046        if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox))
047        {
048            return false;
049        }
050        else
051        {
052            this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 4, 4, true, par2Random, StructureStrongholdPieces.getStrongholdStones());
053            this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.doorType, 1, 1, 0);
054
055            if (this.coordBaseMode != 2 && this.coordBaseMode != 3)
056            {
057                this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 1, 4, 3, 3, 0, 0, false);
058            }
059            else
060            {
061                this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 1, 0, 3, 3, 0, 0, false);
062            }
063
064            return true;
065        }
066    }
067}