    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 ComponentNetherBridgeCorridor3 extends ComponentNetherBridgePiece
    009    {
    010        public ComponentNetherBridgeCorridor3(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4)
    011        {
    012            super(par1);
    013            this.coordBaseMode = par4;
    014            this.boundingBox = par3StructureBoundingBox;
    015        }
    016
    017        /**
    018         * Initiates construction of the Structure Component picked, at the current Location of StructGen
    019         */
    020        public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random)
    021        {
    022            this.getNextComponentNormal((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 1, 0, true);
    023        }
    024
    025        /**
    026         * Creates and returns a new component piece. Or null if it could not find enough room to place it.
    027         */
    028        public static ComponentNetherBridgeCorridor3 createValidComponent(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, 14, 10, par5);
    031            return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeCorridor3(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            int var4 = this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 2);
    041
    042            for (int var5 = 0; var5 <= 9; ++var5)
    043            {
    044                int var6 = Math.max(1, 7 - var5);
    045                int var7 = Math.min(Math.max(var6 + 5, 14 - var5), 13);
    046                int var8 = var5;
    047                this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, var5, 4, var6, var5, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    048                this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, var6 + 1, var5, 3, var7 - 1, var5, 0, 0, false);
    049
    050                if (var5 <= 6)
    051                {
    052                    this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var4, 1, var6 + 1, var5, par3StructureBoundingBox);
    053                    this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var4, 2, var6 + 1, var5, par3StructureBoundingBox);
    054                    this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var4, 3, var6 + 1, var5, par3StructureBoundingBox);
    055                }
    056
    057                this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, var7, var5, 4, var7, var5, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    058                this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, var6 + 1, var5, 0, var7 - 1, var5, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    059                this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, var6 + 1, var5, 4, var7 - 1, var5, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    060
    061                if ((var5 & 1) == 0)
    062                {
    063                    this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, var6 + 2, var5, 0, var6 + 3, var5, Block.netherFence.blockID, Block.netherFence.blockID, false);
    064                    this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, var6 + 2, var5, 4, var6 + 3, var5, Block.netherFence.blockID, Block.netherFence.blockID, false);
    065                }
    066
    067                for (int var9 = 0; var9 <= 4; ++var9)
    068                {
    069                    this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var9, -1, var8, par3StructureBoundingBox);
    070                }
    071            }
    072
    073            return true;
    074        }
    075    }