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