001 package net.minecraft.src; 002 003 import java.util.List; 004 import java.util.Random; 005 006 public class ComponentMineshaftStairs extends StructureComponent 007 { 008 public ComponentMineshaftStairs(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) 009 { 010 super(par1); 011 this.coordBaseMode = par4; 012 this.boundingBox = par3StructureBoundingBox; 013 } 014 015 /** 016 * Trys to find a valid place to put this component. 017 */ 018 public static StructureBoundingBox findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5) 019 { 020 StructureBoundingBox var6 = new StructureBoundingBox(par2, par3 - 5, par4, par2, par3 + 2, par4); 021 022 switch (par5) 023 { 024 case 0: 025 var6.maxX = par2 + 2; 026 var6.maxZ = par4 + 8; 027 break; 028 case 1: 029 var6.minX = par2 - 8; 030 var6.maxZ = par4 + 2; 031 break; 032 case 2: 033 var6.maxX = par2 + 2; 034 var6.minZ = par4 - 8; 035 break; 036 case 3: 037 var6.maxX = par2 + 8; 038 var6.maxZ = par4 + 2; 039 } 040 041 return StructureComponent.findIntersecting(par0List, var6) != null ? null : var6; 042 } 043 044 /** 045 * Initiates construction of the Structure Component picked, at the current Location of StructGen 046 */ 047 public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) 048 { 049 int var4 = this.getComponentType(); 050 051 switch (this.coordBaseMode) 052 { 053 case 0: 054 StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4); 055 break; 056 case 1: 057 StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ, 1, var4); 058 break; 059 case 2: 060 StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4); 061 break; 062 case 3: 063 StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ, 3, var4); 064 } 065 } 066 067 /** 068 * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at 069 * the end, it adds Fences... 070 */ 071 public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) 072 { 073 if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) 074 { 075 return false; 076 } 077 else 078 { 079 this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 2, 7, 1, 0, 0, false); 080 this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 7, 2, 2, 8, 0, 0, false); 081 082 for (int var4 = 0; var4 < 5; ++var4) 083 { 084 this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5 - var4 - (var4 < 4 ? 1 : 0), 2 + var4, 2, 7 - var4, 2 + var4, 0, 0, false); 085 } 086 087 return true; 088 } 089 } 090 }