    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 ComponentStrongholdStairsStraight extends ComponentStronghold
    009{
    010    private final EnumDoor doorType;
    011
    012    public ComponentStrongholdStairsStraight(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4)
    013    {
    014        super(par1);
    015        this.coordBaseMode = par4;
    016        this.doorType = this.getRandomDoor(par2Random);
    017        this.boundingBox = par3StructureBoundingBox;
    018    }
    019
    020    /**
    021     * Initiates construction of the Structure Component picked, at the current Location of StructGen
    022     */
    023    public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random)
    024    {
    025        this.getNextComponentNormal((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1);
    026    }
    027
    028    public static ComponentStrongholdStairsStraight findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6)
    029    {
    030        StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -7, 0, 5, 11, 8, par5);
    031        return canStrongholdGoDeeper(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentStrongholdStairsStraight(par6, par1Random, var7, par5) : null;
    032    }
    033
    034    /**
    035     * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
    036     * the end, it adds Fences...
    037     */
    038    public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
    039    {
    040        if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox))
    041        {
    042            return false;
    043        }
    044        else
    045        {
    046            this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 10, 7, true, par2Random, StructureStrongholdPieces.getStrongholdStones());
    047            this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.doorType, 1, 7, 0);
    048            this.placeDoor(par1World, par2Random, par3StructureBoundingBox, EnumDoor.OPENING, 1, 1, 7);
    049            int var4 = this.getMetadataWithOffset(Block.stairCompactCobblestone.blockID, 2);
    050
    051            for (int var5 = 0; var5 < 6; ++var5)
    052            {
    053                this.placeBlockAtCurrentPosition(par1World, Block.stairCompactCobblestone.blockID, var4, 1, 6 - var5, 1 + var5, par3StructureBoundingBox);
    054                this.placeBlockAtCurrentPosition(par1World, Block.stairCompactCobblestone.blockID, var4, 2, 6 - var5, 1 + var5, par3StructureBoundingBox);
    055                this.placeBlockAtCurrentPosition(par1World, Block.stairCompactCobblestone.blockID, var4, 3, 6 - var5, 1 + var5, par3StructureBoundingBox);
    056
    057                if (var5 < 5)
    058                {
    059                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 5 - var5, 1 + var5, par3StructureBoundingBox);
    060                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 5 - var5, 1 + var5, par3StructureBoundingBox);
    061                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 5 - var5, 1 + var5, par3StructureBoundingBox);
    062                }
    063            }
    064
    065            return true;
    066        }
    067    }
    068}