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