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.world.World;
007    
008    public class ComponentVillageTorch extends ComponentVillage
009    {
010        private int averageGroundLevel = -1;
011    
012        public ComponentVillageTorch(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5)
013        {
014            super(par1ComponentVillageStartPiece, par2);
015            this.coordBaseMode = par5;
016            this.boundingBox = par4StructureBoundingBox;
017        }
018    
019        public static StructureBoundingBox func_74904_a(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6)
020        {
021            StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par3, par4, par5, 0, 0, 0, 3, 4, 2, par6);
022            return StructureComponent.findIntersecting(par1List, var7) != null ? null : var7;
023        }
024    
025        /**
026         * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
027         * the end, it adds Fences...
028         */
029        public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
030        {
031            if (this.averageGroundLevel < 0)
032            {
033                this.averageGroundLevel = this.getAverageGroundLevel(par1World, par3StructureBoundingBox);
034    
035                if (this.averageGroundLevel < 0)
036                {
037                    return true;
038                }
039    
040                this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 4 - 1, 0);
041            }
042    
043            this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 3, 1, 0, 0, false);
044            this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 0, 0, par3StructureBoundingBox);
045            this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 1, 0, par3StructureBoundingBox);
046            this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 2, 0, par3StructureBoundingBox);
047            this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, 15, 1, 3, 0, par3StructureBoundingBox);
048            this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 15, 0, 3, 0, par3StructureBoundingBox);
049            this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 15, 1, 3, 1, par3StructureBoundingBox);
050            this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 15, 2, 3, 0, par3StructureBoundingBox);
051            this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 15, 1, 3, -1, par3StructureBoundingBox);
052            return true;
053        }
054    }