    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 ComponentNetherBridgeCrossing3 extends ComponentNetherBridgePiece
    009{
    010    public ComponentNetherBridgeCrossing3(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4)
    011    {
    012        super(par1);
    013        this.coordBaseMode = par4;
    014        this.boundingBox = par3StructureBoundingBox;
    015    }
    016
    017    protected ComponentNetherBridgeCrossing3(Random par1Random, int par2, int par3)
    018    {
    019        super(0);
    020        this.coordBaseMode = par1Random.nextInt(4);
    021
    022        switch (this.coordBaseMode)
    023        {
    024            case 0:
    025            case 2:
    026                this.boundingBox = new StructureBoundingBox(par2, 64, par3, par2 + 19 - 1, 73, par3 + 19 - 1);
    027                break;
    028            default:
    029                this.boundingBox = new StructureBoundingBox(par2, 64, par3, par2 + 19 - 1, 73, par3 + 19 - 1);
    030        }
    031    }
    032
    033    /**
    034     * Initiates construction of the Structure Component picked, at the current Location of StructGen
    035     */
    036    public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random)
    037    {
    038        this.getNextComponentNormal((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 8, 3, false);
    039        this.getNextComponentX((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 3, 8, false);
    040        this.getNextComponentZ((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 3, 8, false);
    041    }
    042
    043    /**
    044     * Creates and returns a new component piece. Or null if it could not find enough room to place it.
    045     */
    046    public static ComponentNetherBridgeCrossing3 createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6)
    047    {
    048        StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -8, -3, 0, 19, 10, 19, par5);
    049        return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeCrossing3(par6, par1Random, var7, par5) : null;
    050    }
    051
    052    /**
    053     * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
    054     * the end, it adds Fences...
    055     */
    056    public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
    057    {
    058        this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 3, 0, 11, 4, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    059        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 7, 18, 4, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    060        this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 5, 0, 10, 7, 18, 0, 0, false);
    061        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 8, 18, 7, 10, 0, 0, false);
    062        this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 5, 0, 7, 5, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    063        this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 5, 11, 7, 5, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    064        this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 5, 0, 11, 5, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    065        this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 5, 11, 11, 5, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    066        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 7, 7, 5, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    067        this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 5, 7, 18, 5, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    068        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 11, 7, 5, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    069        this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 5, 11, 18, 5, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    070        this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 2, 0, 11, 2, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    071        this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 2, 13, 11, 2, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    072        this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 0, 0, 11, 1, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    073        this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 0, 15, 11, 1, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    074        int var4;
    075        int var5;
    076
    077        for (var4 = 7; var4 <= 11; ++var4)
    078        {
    079            for (var5 = 0; var5 <= 2; ++var5)
    080            {
    081                this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox);
    082                this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, 18 - var5, par3StructureBoundingBox);
    083            }
    084        }
    085
    086        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 7, 5, 2, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    087        this.fillWithBlocks(par1World, par3StructureBoundingBox, 13, 2, 7, 18, 2, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    088        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 7, 3, 1, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    089        this.fillWithBlocks(par1World, par3StructureBoundingBox, 15, 0, 7, 18, 1, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    090
    091        for (var4 = 0; var4 <= 2; ++var4)
    092        {
    093            for (var5 = 7; var5 <= 11; ++var5)
    094            {
    095                this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox);
    096                this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, 18 - var4, -1, var5, par3StructureBoundingBox);
    097            }
    098        }
    099
    100        return true;
    101    }
    102}