    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 ComponentStrongholdCorridor extends ComponentStronghold
    009    {
    010        private final int field_74993_a;
    011
    012        public ComponentStrongholdCorridor(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4)
    013        {
    014            super(par1);
    015            this.coordBaseMode = par4;
    016            this.boundingBox = par3StructureBoundingBox;
    017            this.field_74993_a = par4 != 2 && par4 != 0 ? par3StructureBoundingBox.getXSize() : par3StructureBoundingBox.getZSize();
    018        }
    019
    020        public static StructureBoundingBox func_74992_a(List par0List, Random par1Random, int par2, int par3, int par4, int par5)
    021        {
    022            StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, 4, par5);
    023            StructureComponent var8 = StructureComponent.findIntersecting(par0List, var7);
    024
    025            if (var8 == null)
    026            {
    027                return null;
    028            }
    029            else
    030            {
    031                if (var8.getBoundingBox().minY == var7.minY)
    032                {
    033                    for (int var9 = 3; var9 >= 1; --var9)
    034                    {
    035                        var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, var9 - 1, par5);
    036
    037                        if (!var8.getBoundingBox().intersectsWith(var7))
    038                        {
    039                            return StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, var9, par5);
    040                        }
    041                    }
    042                }
    043
    044                return null;
    045            }
    046        }
    047
    048        /**
    049         * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
    050         * the end, it adds Fences...
    051         */
    052        public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
    053        {
    054            if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox))
    055            {
    056                return false;
    057            }
    058            else
    059            {
    060                for (int var4 = 0; var4 < this.field_74993_a; ++var4)
    061                {
    062                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 0, 0, var4, par3StructureBoundingBox);
    063                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 0, var4, par3StructureBoundingBox);
    064                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 0, var4, par3StructureBoundingBox);
    065                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 0, var4, par3StructureBoundingBox);
    066                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 4, 0, var4, par3StructureBoundingBox);
    067
    068                    for (int var5 = 1; var5 <= 3; ++var5)
    069                    {
    070                        this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 0, var5, var4, par3StructureBoundingBox);
    071                        this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, var5, var4, par3StructureBoundingBox);
    072                        this.placeBlockAtCurrentPosition(par1World, 0, 0, 2, var5, var4, par3StructureBoundingBox);
    073                        this.placeBlockAtCurrentPosition(par1World, 0, 0, 3, var5, var4, par3StructureBoundingBox);
    074                        this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 4, var5, var4, par3StructureBoundingBox);
    075                    }
    076
    077                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 0, 4, var4, par3StructureBoundingBox);
    078                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 4, var4, par3StructureBoundingBox);
    079                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 4, var4, par3StructureBoundingBox);
    080                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 4, var4, par3StructureBoundingBox);
    081                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 4, 4, var4, par3StructureBoundingBox);
    082                }
    083
    084                return true;
    085            }
    086        }
    087    }