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 ComponentNetherBridgeEnd extends ComponentNetherBridgePiece
009{
010    private int fillSeed;
011
012    public ComponentNetherBridgeEnd(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4)
013    {
014        super(par1);
015        this.coordBaseMode = par4;
016        this.boundingBox = par3StructureBoundingBox;
017        this.fillSeed = par2Random.nextInt();
018    }
019
020    public static ComponentNetherBridgeEnd func_74971_a(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6)
021    {
022        StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -3, 0, 5, 10, 8, par5);
023        return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(par0List, structureboundingbox) == null ? new ComponentNetherBridgeEnd(par6, par1Random, structureboundingbox, par5) : null;
024    }
025
026    /**
027     * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
028     * the end, it adds Fences...
029     */
030    public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
031    {
032        Random random1 = new Random((long)this.fillSeed);
033        int i;
034        int j;
035        int k;
036
037        for (i = 0; i <= 4; ++i)
038        {
039            for (j = 3; j <= 4; ++j)
040            {
041                k = random1.nextInt(8);
042                this.fillWithBlocks(par1World, par3StructureBoundingBox, i, j, 0, i, j, k, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
043            }
044        }
045
046        i = random1.nextInt(8);
047        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 0, 5, i, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
048        i = random1.nextInt(8);
049        this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 5, 0, 4, 5, i, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
050
051        for (i = 0; i <= 4; ++i)
052        {
053            j = random1.nextInt(5);
054            this.fillWithBlocks(par1World, par3StructureBoundingBox, i, 2, 0, i, 2, j, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
055        }
056
057        for (i = 0; i <= 4; ++i)
058        {
059            for (j = 0; j <= 1; ++j)
060            {
061                k = random1.nextInt(3);
062                this.fillWithBlocks(par1World, par3StructureBoundingBox, i, j, 0, i, j, k, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
063            }
064        }
065
066        return true;
067    }
068}