    001    package net.minecraft.src;
    002
    003    import java.util.List;
    004    import java.util.Random;
    005
    006    public class ComponentStrongholdCrossing extends ComponentStronghold
    007    {
    008        protected final EnumDoor doorType;
    009        private boolean field_74996_b;
    010        private boolean field_74997_c;
    011        private boolean field_74995_d;
    012        private boolean field_74999_h;
    013
    014        public ComponentStrongholdCrossing(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4)
    015        {
    016            super(par1);
    017            this.coordBaseMode = par4;
    018            this.doorType = this.getRandomDoor(par2Random);
    019            this.boundingBox = par3StructureBoundingBox;
    020            this.field_74996_b = par2Random.nextBoolean();
    021            this.field_74997_c = par2Random.nextBoolean();
    022            this.field_74995_d = par2Random.nextBoolean();
    023            this.field_74999_h = par2Random.nextInt(3) > 0;
    024        }
    025
    026        /**
    027         * Initiates construction of the Structure Component picked, at the current Location of StructGen
    028         */
    029        public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random)
    030        {
    031            int var4 = 3;
    032            int var5 = 5;
    033
    034            if (this.coordBaseMode == 1 || this.coordBaseMode == 2)
    035            {
    036                var4 = 8 - var4;
    037                var5 = 8 - var5;
    038            }
    039
    040            this.getNextComponentNormal((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 5, 1);
    041
    042            if (this.field_74996_b)
    043            {
    044                this.getNextComponentX((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, var4, 1);
    045            }
    046
    047            if (this.field_74997_c)
    048            {
    049                this.getNextComponentX((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, var5, 7);
    050            }
    051
    052            if (this.field_74995_d)
    053            {
    054                this.getNextComponentZ((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, var4, 1);
    055            }
    056
    057            if (this.field_74999_h)
    058            {
    059                this.getNextComponentZ((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, var5, 7);
    060            }
    061        }
    062
    063        public static ComponentStrongholdCrossing findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6)
    064        {
    065            StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -4, -3, 0, 10, 9, 11, par5);
    066            return canStrongholdGoDeeper(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentStrongholdCrossing(par6, par1Random, var7, par5) : null;
    067        }
    068
    069        /**
    070         * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
    071         * the end, it adds Fences...
    072         */
    073        public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
    074        {
    075            if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox))
    076            {
    077                return false;
    078            }
    079            else
    080            {
    081                this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 9, 8, 10, true, par2Random, StructureStrongholdPieces.getStrongholdStones());
    082                this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.doorType, 4, 3, 0);
    083
    084                if (this.field_74996_b)
    085                {
    086                    this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 1, 0, 5, 3, 0, 0, false);
    087                }
    088
    089                if (this.field_74995_d)
    090                {
    091                    this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 3, 1, 9, 5, 3, 0, 0, false);
    092                }
    093
    094                if (this.field_74997_c)
    095                {
    096                    this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 7, 0, 7, 9, 0, 0, false);
    097                }
    098
    099                if (this.field_74999_h)
    100                {
    101                    this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 5, 7, 9, 7, 9, 0, 0, false);
    102                }
    103
    104                this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 1, 10, 7, 3, 10, 0, 0, false);
    105                this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, 2, 1, 8, 2, 6, false, par2Random, StructureStrongholdPieces.getStrongholdStones());
    106                this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 1, 5, 4, 4, 9, false, par2Random, StructureStrongholdPieces.getStrongholdStones());
    107                this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 8, 1, 5, 8, 4, 9, false, par2Random, StructureStrongholdPieces.getStrongholdStones());
    108                this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, 4, 7, 3, 4, 9, false, par2Random, StructureStrongholdPieces.getStrongholdStones());
    109                this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, 3, 5, 3, 3, 6, false, par2Random, StructureStrongholdPieces.getStrongholdStones());
    110                this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 3, 4, 3, 3, 4, Block.stoneSingleSlab.blockID, Block.stoneSingleSlab.blockID, false);
    111                this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 6, 3, 4, 6, Block.stoneSingleSlab.blockID, Block.stoneSingleSlab.blockID, false);
    112                this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 5, 1, 7, 7, 1, 8, false, par2Random, StructureStrongholdPieces.getStrongholdStones());
    113                this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 1, 9, 7, 1, 9, Block.stoneSingleSlab.blockID, Block.stoneSingleSlab.blockID, false);
    114                this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 2, 7, 7, 2, 7, Block.stoneSingleSlab.blockID, Block.stoneSingleSlab.blockID, false);
    115                this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 5, 7, 4, 5, 9, Block.stoneSingleSlab.blockID, Block.stoneSingleSlab.blockID, false);
    116                this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 5, 7, 8, 5, 9, Block.stoneSingleSlab.blockID, Block.stoneSingleSlab.blockID, false);
    117                this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 5, 7, 7, 5, 9, Block.stoneDoubleSlab.blockID, Block.stoneDoubleSlab.blockID, false);
    118                this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 6, 5, 6, par3StructureBoundingBox);
    119                return true;
    120            }
    121        }
    122    }