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