    001    package net.minecraft.src;
    002
    003    import java.util.List;
    004    import java.util.Random;
    005
    006    public class ComponentStrongholdStairs extends ComponentStronghold
    007    {
    008        private final boolean field_75024_a;
    009        private final EnumDoor doorType;
    010
    011        public ComponentStrongholdStairs(int par1, Random par2Random, int par3, int par4)
    012        {
    013            super(par1);
    014            this.field_75024_a = true;
    015            this.coordBaseMode = par2Random.nextInt(4);
    016            this.doorType = EnumDoor.OPENING;
    017
    018            switch (this.coordBaseMode)
    019            {
    020                case 0:
    021                case 2:
    022                    this.boundingBox = new StructureBoundingBox(par3, 64, par4, par3 + 5 - 1, 74, par4 + 5 - 1);
    023                    break;
    024                default:
    025                    this.boundingBox = new StructureBoundingBox(par3, 64, par4, par3 + 5 - 1, 74, par4 + 5 - 1);
    026            }
    027        }
    028
    029        public ComponentStrongholdStairs(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4)
    030        {
    031            super(par1);
    032            this.field_75024_a = false;
    033            this.coordBaseMode = par4;
    034            this.doorType = this.getRandomDoor(par2Random);
    035            this.boundingBox = par3StructureBoundingBox;
    036        }
    037
    038        /**
    039         * Initiates construction of the Structure Component picked, at the current Location of StructGen
    040         */
    041        public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random)
    042        {
    043            if (this.field_75024_a)
    044            {
    045                StructureStrongholdPieces.setComponentType(ComponentStrongholdCrossing.class);
    046            }
    047
    048            this.getNextComponentNormal((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1);
    049        }
    050
    051        /**
    052         * performs some checks, then gives out a fresh Stairs component
    053         */
    054        public static ComponentStrongholdStairs getStrongholdStairsComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6)
    055        {
    056            StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -7, 0, 5, 11, 5, par5);
    057            return canStrongholdGoDeeper(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentStrongholdStairs(par6, par1Random, var7, par5) : null;
    058        }
    059
    060        /**
    061         * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
    062         * the end, it adds Fences...
    063         */
    064        public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
    065        {
    066            if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox))
    067            {
    068                return false;
    069            }
    070            else
    071            {
    072                this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 10, 4, true, par2Random, StructureStrongholdPieces.getStrongholdStones());
    073                this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.doorType, 1, 7, 0);
    074                this.placeDoor(par1World, par2Random, par3StructureBoundingBox, EnumDoor.OPENING, 1, 1, 4);
    075                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 6, 1, par3StructureBoundingBox);
    076                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 5, 1, par3StructureBoundingBox);
    077                this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 1, 6, 1, par3StructureBoundingBox);
    078                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 5, 2, par3StructureBoundingBox);
    079                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 4, 3, par3StructureBoundingBox);
    080                this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 1, 5, 3, par3StructureBoundingBox);
    081                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 4, 3, par3StructureBoundingBox);
    082                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 3, 3, par3StructureBoundingBox);
    083                this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 3, 4, 3, par3StructureBoundingBox);
    084                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 3, 2, par3StructureBoundingBox);
    085                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 2, 1, par3StructureBoundingBox);
    086                this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 3, 3, 1, par3StructureBoundingBox);
    087                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 2, 1, par3StructureBoundingBox);
    088                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 1, 1, par3StructureBoundingBox);
    089                this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 1, 2, 1, par3StructureBoundingBox);
    090                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 1, 2, par3StructureBoundingBox);
    091                this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 1, 1, 3, par3StructureBoundingBox);
    092                return true;
    093            }
    094        }
    095    }