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 ComponentStrongholdStraight extends ComponentStronghold 009 { 010 private final EnumDoor doorType; 011 private final boolean expandsX; 012 private final boolean expandsZ; 013 014 public ComponentStrongholdStraight(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) 015 { 016 super(par1); 017 this.coordBaseMode = par4; 018 this.doorType = this.getRandomDoor(par2Random); 019 this.boundingBox = par3StructureBoundingBox; 020 this.expandsX = par2Random.nextInt(2) == 0; 021 this.expandsZ = par2Random.nextInt(2) == 0; 022 } 023 024 /** 025 * Initiates construction of the Structure Component picked, at the current Location of StructGen 026 */ 027 public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) 028 { 029 this.getNextComponentNormal((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1); 030 031 if (this.expandsX) 032 { 033 this.getNextComponentX((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 2); 034 } 035 036 if (this.expandsZ) 037 { 038 this.getNextComponentZ((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 2); 039 } 040 } 041 042 public static ComponentStrongholdStraight findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) 043 { 044 StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, 7, par5); 045 return canStrongholdGoDeeper(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentStrongholdStraight(par6, par1Random, var7, par5) : null; 046 } 047 048 /** 049 * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at 050 * the end, it adds Fences... 051 */ 052 public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) 053 { 054 if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) 055 { 056 return false; 057 } 058 else 059 { 060 this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 4, 6, true, par2Random, StructureStrongholdPieces.getStrongholdStones()); 061 this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.doorType, 1, 1, 0); 062 this.placeDoor(par1World, par2Random, par3StructureBoundingBox, EnumDoor.OPENING, 1, 1, 6); 063 this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 1, 2, 1, Block.torchWood.blockID, 0); 064 this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 3, 2, 1, Block.torchWood.blockID, 0); 065 this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 1, 2, 5, Block.torchWood.blockID, 0); 066 this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 3, 2, 5, Block.torchWood.blockID, 0); 067 068 if (this.expandsX) 069 { 070 this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 2, 0, 3, 4, 0, 0, false); 071 } 072 073 if (this.expandsZ) 074 { 075 this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 2, 4, 3, 4, 0, 0, false); 076 } 077 078 return true; 079 } 080 } 081 }