    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.tileentity.TileEntityMobSpawner;
    007    import net.minecraft.world.World;
    008
    009    public 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 var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -2, 0, 0, 7, 8, 9, par5);
    026            return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeThrone(par6, par1Random, var7, 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 var4;
    054            int var5;
    055
    056            if (!this.hasSpawner)
    057            {
    058                var4 = this.getYWithOffset(5);
    059                var5 = this.getXWithOffset(3, 5);
    060                int var6 = this.getZWithOffset(3, 5);
    061
    062                if (par3StructureBoundingBox.isVecInside(var5, var4, var6))
    063                {
    064                    this.hasSpawner = true;
    065                    par1World.setBlockWithNotify(var5, var4, var6, Block.mobSpawner.blockID);
    066                    TileEntityMobSpawner var7 = (TileEntityMobSpawner)par1World.getBlockTileEntity(var5, var4, var6);
    067
    068                    if (var7 != null)
    069                    {
    070                        var7.setMobID("Blaze");
    071                    }
    072                }
    073            }
    074
    075            for (var4 = 0; var4 <= 6; ++var4)
    076            {
    077                for (var5 = 0; var5 <= 6; ++var5)
    078                {
    079                    this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox);
    080                }
    081            }
    082
    083            return true;
    084        }
    085    }