    001package net.minecraft.world.gen.structure;
    002
    003import java.util.List;
    004import java.util.Random;
    005import net.minecraft.block.Block;
    006import net.minecraft.world.World;
    007
    008public 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 structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, 4, par5);
    023        StructureComponent structurecomponent = StructureComponent.findIntersecting(par0List, structureboundingbox);
    024
    025        if (structurecomponent == null)
    026        {
    027            return null;
    028        }
    029        else
    030        {
    031            if (structurecomponent.getBoundingBox().minY == structureboundingbox.minY)
    032            {
    033                for (int i1 = 3; i1 >= 1; --i1)
    034                {
    035                    structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, i1 - 1, par5);
    036
    037                    if (!structurecomponent.getBoundingBox().intersectsWith(structureboundingbox))
    038                    {
    039                        return StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, i1, 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 i = 0; i < this.field_74993_a; ++i)
    061            {
    062                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 0, 0, i, par3StructureBoundingBox);
    063                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 0, i, par3StructureBoundingBox);
    064                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 0, i, par3StructureBoundingBox);
    065                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 0, i, par3StructureBoundingBox);
    066                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 4, 0, i, par3StructureBoundingBox);
    067
    068                for (int j = 1; j <= 3; ++j)
    069                {
    070                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 0, j, i, par3StructureBoundingBox);
    071                    this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, j, i, par3StructureBoundingBox);
    072                    this.placeBlockAtCurrentPosition(par1World, 0, 0, 2, j, i, par3StructureBoundingBox);
    073                    this.placeBlockAtCurrentPosition(par1World, 0, 0, 3, j, i, par3StructureBoundingBox);
    074                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 4, j, i, par3StructureBoundingBox);
    075                }
    076
    077                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 0, 4, i, par3StructureBoundingBox);
    078                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 4, i, par3StructureBoundingBox);
    079                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 4, i, par3StructureBoundingBox);
    080                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 4, i, par3StructureBoundingBox);
    081                this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 4, 4, i, par3StructureBoundingBox);
    082            }
    083
    084            return true;
    085        }
    086    }
    087}