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 ComponentNetherBridgeCorridor5 extends ComponentNetherBridgePiece
009{
010    public ComponentNetherBridgeCorridor5(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 ComponentNetherBridgeCorridor5 createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6)
029    {
030        StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, 0, 0, 5, 7, 5, par5);
031        return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(par0List, structureboundingbox) == null ? new ComponentNetherBridgeCorridor5(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        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 1, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
041        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 4, 5, 4, 0, 0, false);
042        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 0, 5, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
043        this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 2, 0, 4, 5, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
044        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 1, 0, 4, 1, Block.netherFence.blockID, Block.netherFence.blockID, false);
045        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 3, 0, 4, 3, Block.netherFence.blockID, Block.netherFence.blockID, false);
046        this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 1, 4, 4, 1, Block.netherFence.blockID, Block.netherFence.blockID, false);
047        this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 3, 4, 4, 3, Block.netherFence.blockID, Block.netherFence.blockID, false);
048        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 6, 0, 4, 6, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
049
050        for (int i = 0; i <= 4; ++i)
051        {
052            for (int j = 0; j <= 4; ++j)
053            {
054                this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, i, -1, j, par3StructureBoundingBox);
055            }
056        }
057
058        return true;
059    }
060}