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