    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 ComponentVillageWell extends ComponentVillage
    009    {
    010        private final boolean field_74924_a = true;
    011        private int averageGroundLevel = -1;
    012
    013        public ComponentVillageWell(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, int par4, int par5)
    014        {
    015            super(par1ComponentVillageStartPiece, par2);
    016            this.coordBaseMode = par3Random.nextInt(4);
    017
    018            switch (this.coordBaseMode)
    019            {
    020                case 0:
    021                case 2:
    022                    this.boundingBox = new StructureBoundingBox(par4, 64, par5, par4 + 6 - 1, 78, par5 + 6 - 1);
    023                    break;
    024                default:
    025                    this.boundingBox = new StructureBoundingBox(par4, 64, par5, par4 + 6 - 1, 78, par5 + 6 - 1);
    026            }
    027        }
    028
    029        /**
    030         * Initiates construction of the Structure Component picked, at the current Location of StructGen
    031         */
    032        public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random)
    033        {
    034            StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, 1, this.getComponentType());
    035            StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, 3, this.getComponentType());
    036            StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ - 1, 2, this.getComponentType());
    037            StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.maxZ + 1, 0, this.getComponentType());
    038        }
    039
    040        /**
    041         * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
    042         * the end, it adds Fences...
    043         */
    044        public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
    045        {
    046            if (this.averageGroundLevel < 0)
    047            {
    048                this.averageGroundLevel = this.getAverageGroundLevel(par1World, par3StructureBoundingBox);
    049
    050                if (this.averageGroundLevel < 0)
    051                {
    052                    return true;
    053                }
    054
    055                this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 3, 0);
    056            }
    057
    058            this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 4, 12, 4, Block.cobblestone.blockID, Block.waterMoving.blockID, false);
    059            this.placeBlockAtCurrentPosition(par1World, 0, 0, 2, 12, 2, par3StructureBoundingBox);
    060            this.placeBlockAtCurrentPosition(par1World, 0, 0, 3, 12, 2, par3StructureBoundingBox);
    061            this.placeBlockAtCurrentPosition(par1World, 0, 0, 2, 12, 3, par3StructureBoundingBox);
    062            this.placeBlockAtCurrentPosition(par1World, 0, 0, 3, 12, 3, par3StructureBoundingBox);
    063            this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 13, 1, par3StructureBoundingBox);
    064            this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 14, 1, par3StructureBoundingBox);
    065            this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 13, 1, par3StructureBoundingBox);
    066            this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 14, 1, par3StructureBoundingBox);
    067            this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 13, 4, par3StructureBoundingBox);
    068            this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 14, 4, par3StructureBoundingBox);
    069            this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 13, 4, par3StructureBoundingBox);
    070            this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 14, 4, par3StructureBoundingBox);
    071            this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 15, 1, 4, 15, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
    072
    073            for (int var4 = 0; var4 <= 5; ++var4)
    074            {
    075                for (int var5 = 0; var5 <= 5; ++var5)
    076                {
    077                    if (var5 == 0 || var5 == 5 || var4 == 0 || var4 == 5)
    078                    {
    079                        this.placeBlockAtCurrentPosition(par1World, Block.gravel.blockID, 0, var5, 11, var4, par3StructureBoundingBox);
    080                        this.clearCurrentPositionBlocksUpwards(par1World, var5, 12, var4, par3StructureBoundingBox);
    081                    }
    082                }
    083            }
    084
    085            return true;
    086        }
    087    }