    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 structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -7, 0, 5, 11, 8, par5);
    031        return canStrongholdGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(par0List, structureboundingbox) == null ? new ComponentStrongholdStairsStraight(par6, par1Random, structureboundingbox, 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 i = this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 2);
    050
    051            for (int j = 0; j < 6; ++j)
    052            {
    053                this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, i, 1, 6 - j, 1 + j, par3StructureBoundingBox);
    054                this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, i, 2, 6 - j, 1 + j, par3StructureBoundingBox);
    055                this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, i, 3, 6 - j, 1 + j, par3StructureBoundingBox);
    056
    057                if (j < 5)
    058                {
    059                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 5 - j, 1 + j, par3StructureBoundingBox);
    060                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 5 - j, 1 + j, par3StructureBoundingBox);
    061                    this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 5 - j, 1 + j, par3StructureBoundingBox);
    062                }
    063            }
    064
    065            return true;
    066        }
    067    }
    068}