    001package net.minecraft.world.gen.structure;
    002
    003import java.util.List;
    004import java.util.Random;
    005import net.minecraft.block.Block;
    006import net.minecraft.tileentity.TileEntityMobSpawner;
    007import net.minecraft.world.World;
    008
    009public class ComponentNetherBridgeThrone extends ComponentNetherBridgePiece
    010{
    011    private boolean hasSpawner;
    012
    013    public ComponentNetherBridgeThrone(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4)
    014    {
    015        super(par1);
    016        this.coordBaseMode = par4;
    017        this.boundingBox = par3StructureBoundingBox;
    018    }
    019
    020    /**
    021     * Creates and returns a new component piece. Or null if it could not find enough room to place it.
    022     */
    023    public static ComponentNetherBridgeThrone createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6)
    024    {
    025        StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -2, 0, 0, 7, 8, 9, par5);
    026        return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(par0List, structureboundingbox) == null ? new ComponentNetherBridgeThrone(par6, par1Random, structureboundingbox, par5) : null;
    027    }
    028
    029    /**
    030     * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
    031     * the end, it adds Fences...
    032     */
    033    public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
    034    {
    035        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 6, 7, 7, 0, 0, false);
    036        this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 0, 5, 1, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    037        this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 1, 5, 2, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    038        this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 3, 2, 5, 3, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    039        this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 3, 5, 4, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    040        this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 0, 1, 4, 2, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    041        this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 2, 0, 5, 4, 2, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    042        this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 2, 1, 5, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    043        this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 5, 2, 5, 5, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    044        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 3, 0, 5, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    045        this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 5, 3, 6, 5, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    046        this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 8, 5, 5, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false);
    047        this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 1, 6, 3, par3StructureBoundingBox);
    048        this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 5, 6, 3, par3StructureBoundingBox);
    049        this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 6, 3, 0, 6, 8, Block.netherFence.blockID, Block.netherFence.blockID, false);
    050        this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 6, 3, 6, 6, 8, Block.netherFence.blockID, Block.netherFence.blockID, false);
    051        this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 6, 8, 5, 7, 8, Block.netherFence.blockID, Block.netherFence.blockID, false);
    052        this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 8, 8, 4, 8, 8, Block.netherFence.blockID, Block.netherFence.blockID, false);
    053        int i;
    054        int j;
    055
    056        if (!this.hasSpawner)
    057        {
    058            i = this.getYWithOffset(5);
    059            j = this.getXWithOffset(3, 5);
    060            int k = this.getZWithOffset(3, 5);
    061
    062            if (par3StructureBoundingBox.isVecInside(j, i, k))
    063            {
    064                this.hasSpawner = true;
    065                par1World.setBlockAndMetadataWithNotify(j, i, k, Block.mobSpawner.blockID, 0, 2);
    066                TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)par1World.getBlockTileEntity(j, i, k);
    067
    068                if (tileentitymobspawner != null)
    069                {
    070                    tileentitymobspawner.func_98049_a().func_98272_a("Blaze");
    071                }
    072            }
    073        }
    074
    075        for (i = 0; i <= 6; ++i)
    076        {
    077            for (j = 0; j <= 6; ++j)
    078            {
    079                this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, i, -1, j, par3StructureBoundingBox);
    080            }
    081        }
    082
    083        return true;
    084    }
    085}