/// <summary> /// 'second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at /// the end, it adds Fences...' /// </summary> public override bool AddComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { FillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 6, 7, 7, 0, 0, false); FillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 0, 5, 1, 7, Block.NetherBrick.BlockID, Block.NetherBrick.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 1, 5, 2, 7, Block.NetherBrick.BlockID, Block.NetherBrick.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 1, 3, 2, 5, 3, 7, Block.NetherBrick.BlockID, Block.NetherBrick.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 3, 5, 4, 7, Block.NetherBrick.BlockID, Block.NetherBrick.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 0, 1, 4, 2, Block.NetherBrick.BlockID, Block.NetherBrick.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 5, 2, 0, 5, 4, 2, Block.NetherBrick.BlockID, Block.NetherBrick.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 2, 1, 5, 3, Block.NetherBrick.BlockID, Block.NetherBrick.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 5, 5, 2, 5, 5, 3, Block.NetherBrick.BlockID, Block.NetherBrick.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 3, 0, 5, 8, Block.NetherBrick.BlockID, Block.NetherBrick.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 6, 5, 3, 6, 5, 8, Block.NetherBrick.BlockID, Block.NetherBrick.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 8, 5, 5, 8, Block.NetherBrick.BlockID, Block.NetherBrick.BlockID, false); PlaceBlockAtCurrentPosition(par1World, Block.NetherFence.BlockID, 0, 1, 6, 3, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.NetherFence.BlockID, 0, 5, 6, 3, par3StructureBoundingBox); FillWithBlocks(par1World, par3StructureBoundingBox, 0, 6, 3, 0, 6, 8, Block.NetherFence.BlockID, Block.NetherFence.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 6, 6, 3, 6, 6, 8, Block.NetherFence.BlockID, Block.NetherFence.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 1, 6, 8, 5, 7, 8, Block.NetherFence.BlockID, Block.NetherFence.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 2, 8, 8, 4, 8, 8, Block.NetherFence.BlockID, Block.NetherFence.BlockID, false); if (!HasSpawner) { int i = GetYWithOffset(5); int k = GetXWithOffset(3, 5); int i1 = GetZWithOffset(3, 5); if (par3StructureBoundingBox.IsVecInside(k, i, i1)) { HasSpawner = true; par1World.SetBlockWithNotify(k, i, i1, Block.MobSpawner.BlockID); TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)par1World.GetBlockTileEntity(k, i, i1); if (tileentitymobspawner != null) { tileentitymobspawner.SetMobID("Blaze"); } } } for (int j = 0; j <= 6; j++) { for (int l = 0; l <= 6; l++) { FillCurrentPositionBlocksDownwards(par1World, Block.NetherBrick.BlockID, 0, j, -1, l, par3StructureBoundingBox); } } return(true); }
/// <summary> /// 'second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at /// the end, it adds Fences...' /// </summary> public override bool AddComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { FillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 10, 7, 15, false, par2Random, StructureStrongholdPieces.GetStrongholdStones()); PlaceDoor(par1World, par2Random, par3StructureBoundingBox, EnumDoor.GRATES, 4, 1, 0); sbyte byte0 = 6; FillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, byte0, 1, 1, byte0, 14, false, par2Random, StructureStrongholdPieces.GetStrongholdStones()); FillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 9, byte0, 1, 9, byte0, 14, false, par2Random, StructureStrongholdPieces.GetStrongholdStones()); FillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 2, byte0, 1, 8, byte0, 2, false, par2Random, StructureStrongholdPieces.GetStrongholdStones()); FillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 2, byte0, 14, 8, byte0, 14, false, par2Random, StructureStrongholdPieces.GetStrongholdStones()); FillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 2, 1, 4, false, par2Random, StructureStrongholdPieces.GetStrongholdStones()); FillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 8, 1, 1, 9, 1, 4, false, par2Random, StructureStrongholdPieces.GetStrongholdStones()); FillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 1, 1, 3, Block.LavaMoving.BlockID, Block.LavaMoving.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 9, 1, 1, 9, 1, 3, Block.LavaMoving.BlockID, Block.LavaMoving.BlockID, false); FillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 3, 1, 8, 7, 1, 12, false, par2Random, StructureStrongholdPieces.GetStrongholdStones()); FillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 9, 6, 1, 11, Block.LavaMoving.BlockID, Block.LavaMoving.BlockID, false); for (int j = 3; j < 14; j += 2) { FillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, j, 0, 4, j, Block.FenceIron.BlockID, Block.FenceIron.BlockID, false); FillWithBlocks(par1World, par3StructureBoundingBox, 10, 3, j, 10, 4, j, Block.FenceIron.BlockID, Block.FenceIron.BlockID, false); } for (int k = 2; k < 9; k += 2) { FillWithBlocks(par1World, par3StructureBoundingBox, k, 3, 15, k, 4, 15, Block.FenceIron.BlockID, Block.FenceIron.BlockID, false); } int l = GetMetadataWithOffset(Block.StairsStoneBrickSmooth.BlockID, 3); FillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 1, 5, 6, 1, 7, false, par2Random, StructureStrongholdPieces.GetStrongholdStones()); FillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 2, 6, 6, 2, 7, false, par2Random, StructureStrongholdPieces.GetStrongholdStones()); FillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 3, 7, 6, 3, 7, false, par2Random, StructureStrongholdPieces.GetStrongholdStones()); for (int i1 = 4; i1 <= 6; i1++) { PlaceBlockAtCurrentPosition(par1World, Block.StairsStoneBrickSmooth.BlockID, l, i1, 1, 4, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.StairsStoneBrickSmooth.BlockID, l, i1, 2, 5, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.StairsStoneBrickSmooth.BlockID, l, i1, 3, 6, par3StructureBoundingBox); } sbyte byte1 = 2; sbyte byte2 = 0; sbyte byte3 = 3; sbyte byte4 = 1; switch (CoordBaseMode) { case 0: byte1 = 0; byte2 = 2; break; case 3: byte1 = 3; byte2 = 1; byte3 = 0; byte4 = 2; break; case 1: byte1 = 1; byte2 = 3; byte3 = 0; byte4 = 2; break; } PlaceBlockAtCurrentPosition(par1World, Block.EndPortalFrame.BlockID, byte1 + (par2Random.NextFloat() <= 0.9F ? 0 : 4), 4, 3, 8, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.EndPortalFrame.BlockID, byte1 + (par2Random.NextFloat() <= 0.9F ? 0 : 4), 5, 3, 8, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.EndPortalFrame.BlockID, byte1 + (par2Random.NextFloat() <= 0.9F ? 0 : 4), 6, 3, 8, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.EndPortalFrame.BlockID, byte2 + (par2Random.NextFloat() <= 0.9F ? 0 : 4), 4, 3, 12, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.EndPortalFrame.BlockID, byte2 + (par2Random.NextFloat() <= 0.9F ? 0 : 4), 5, 3, 12, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.EndPortalFrame.BlockID, byte2 + (par2Random.NextFloat() <= 0.9F ? 0 : 4), 6, 3, 12, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.EndPortalFrame.BlockID, byte3 + (par2Random.NextFloat() <= 0.9F ? 0 : 4), 3, 3, 9, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.EndPortalFrame.BlockID, byte3 + (par2Random.NextFloat() <= 0.9F ? 0 : 4), 3, 3, 10, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.EndPortalFrame.BlockID, byte3 + (par2Random.NextFloat() <= 0.9F ? 0 : 4), 3, 3, 11, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.EndPortalFrame.BlockID, byte4 + (par2Random.NextFloat() <= 0.9F ? 0 : 4), 7, 3, 9, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.EndPortalFrame.BlockID, byte4 + (par2Random.NextFloat() <= 0.9F ? 0 : 4), 7, 3, 10, par3StructureBoundingBox); PlaceBlockAtCurrentPosition(par1World, Block.EndPortalFrame.BlockID, byte4 + (par2Random.NextFloat() <= 0.9F ? 0 : 4), 7, 3, 11, par3StructureBoundingBox); if (!HasSpawner) { int i = GetYWithOffset(3); int j1 = GetXWithOffset(5, 6); int k1 = GetZWithOffset(5, 6); if (par3StructureBoundingBox.IsVecInside(j1, i, k1)) { HasSpawner = true; par1World.SetBlockWithNotify(j1, i, k1, Block.MobSpawner.BlockID); TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)par1World.GetBlockTileEntity(j1, i, k1); if (tileentitymobspawner != null) { tileentitymobspawner.SetMobID("Silverfish"); } } } return(true); }
public override bool Generate(World par1World, Random par2Random, int par3, int par4, int par5) { sbyte byte0 = 3; int i = par2Random.Next(2) + 2; int j = par2Random.Next(2) + 2; int k = 0; for (int l = par3 - i - 1; l <= par3 + i + 1; l++) { for (int k1 = par4 - 1; k1 <= par4 + byte0 + 1; k1++) { for (int j2 = par5 - j - 1; j2 <= par5 + j + 1; j2++) { Material material = par1World.GetBlockMaterial(l, k1, j2); if (k1 == par4 - 1 && !material.IsSolid()) { return(false); } if (k1 == par4 + byte0 + 1 && !material.IsSolid()) { return(false); } if ((l == par3 - i - 1 || l == par3 + i + 1 || j2 == par5 - j - 1 || j2 == par5 + j + 1) && k1 == par4 && par1World.IsAirBlock(l, k1, j2) && par1World.IsAirBlock(l, k1 + 1, j2)) { k++; } } } } if (k < 1 || k > 5) { return(false); } for (int i1 = par3 - i - 1; i1 <= par3 + i + 1; i1++) { for (int l1 = par4 + byte0; l1 >= par4 - 1; l1--) { for (int k2 = par5 - j - 1; k2 <= par5 + j + 1; k2++) { if (i1 == par3 - i - 1 || l1 == par4 - 1 || k2 == par5 - j - 1 || i1 == par3 + i + 1 || l1 == par4 + byte0 + 1 || k2 == par5 + j + 1) { if (l1 >= 0 && !par1World.GetBlockMaterial(i1, l1 - 1, k2).IsSolid()) { par1World.SetBlockWithNotify(i1, l1, k2, 0); continue; } if (!par1World.GetBlockMaterial(i1, l1, k2).IsSolid()) { continue; } if (l1 == par4 - 1 && par2Random.Next(4) != 0) { par1World.SetBlockWithNotify(i1, l1, k2, Block.CobblestoneMossy.BlockID); } else { par1World.SetBlockWithNotify(i1, l1, k2, Block.Cobblestone.BlockID); } } else { par1World.SetBlockWithNotify(i1, l1, k2, 0); } } } } for (int j1 = 0; j1 < 2; j1++) { label0: for (int i2 = 0; i2 < 3; i2++) { int l2 = (par3 + par2Random.Next(i * 2 + 1)) - i; int i3 = par4; int j3 = (par5 + par2Random.Next(j * 2 + 1)) - j; if (!par1World.IsAirBlock(l2, i3, j3)) { continue; } int k3 = 0; if (par1World.GetBlockMaterial(l2 - 1, i3, j3).IsSolid()) { k3++; } if (par1World.GetBlockMaterial(l2 + 1, i3, j3).IsSolid()) { k3++; } if (par1World.GetBlockMaterial(l2, i3, j3 - 1).IsSolid()) { k3++; } if (par1World.GetBlockMaterial(l2, i3, j3 + 1).IsSolid()) { k3++; } if (k3 != 1) { continue; } par1World.SetBlockWithNotify(l2, i3, j3, Block.Chest.BlockID); TileEntityChest tileentitychest = (TileEntityChest)par1World.GetBlockTileEntity(l2, i3, j3); if (tileentitychest == null) { break; } int l3 = 0; do { if (l3 >= 8) { goto label0; } ItemStack itemstack = PickCheckLootItem(par2Random); if (itemstack != null) { tileentitychest.SetInventorySlotContents(par2Random.Next(tileentitychest.GetSizeInventory()), itemstack); } l3++; }while (true); } } par1World.SetBlockWithNotify(par3, par4, par5, Block.MobSpawner.BlockID); TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)par1World.GetBlockTileEntity(par3, par4, par5); if (tileentitymobspawner != null) { tileentitymobspawner.SetMobID(PickMobSpawner(par2Random)); } else { Console.Error.WriteLine((new StringBuilder()).Append("Failed to fetch mob spawner entity at (").Append(par3).Append(", ").Append(par4).Append(", ").Append(par5).Append(")").ToString()); } return(true); }
/// <summary> /// 'second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at /// the end, it adds Fences...' /// </summary> public override bool AddComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { if (IsLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) { return(false); } int i = SectionCount * 5 - 1; FillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 1, i, 0, 0, false); RandomlyFillWithBlocks(par1World, par3StructureBoundingBox, par2Random, 0.8F, 0, 2, 0, 2, 2, i, 0, 0, false); if (HasSpiders) { RandomlyFillWithBlocks(par1World, par3StructureBoundingBox, par2Random, 0.6F, 0, 0, 0, 2, 1, i, Block.Web.BlockID, 0, false); } for (int j = 0; j < SectionCount; j++) { int i1 = 2 + j * 5; FillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, i1, 0, 1, i1, Block.Fence.BlockID, 0, false); FillWithBlocks(par1World, par3StructureBoundingBox, 2, 0, i1, 2, 1, i1, Block.Fence.BlockID, 0, false); if (par2Random.Next(4) != 0) { FillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, i1, 2, 2, i1, Block.Planks.BlockID, 0, false); } else { FillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, i1, 0, 2, i1, Block.Planks.BlockID, 0, false); FillWithBlocks(par1World, par3StructureBoundingBox, 2, 2, i1, 2, 2, i1, Block.Planks.BlockID, 0, false); } RandomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 0, 2, i1 - 1, Block.Web.BlockID, 0); RandomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 2, 2, i1 - 1, Block.Web.BlockID, 0); RandomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 0, 2, i1 + 1, Block.Web.BlockID, 0); RandomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 2, 2, i1 + 1, Block.Web.BlockID, 0); RandomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 0, 2, i1 - 2, Block.Web.BlockID, 0); RandomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 2, 2, i1 - 2, Block.Web.BlockID, 0); RandomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 0, 2, i1 + 2, Block.Web.BlockID, 0); RandomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 2, 2, i1 + 2, Block.Web.BlockID, 0); RandomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, i1 - 1, Block.TorchWood.BlockID, 0); RandomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, i1 + 1, Block.TorchWood.BlockID, 0); if (par2Random.Next(100) == 0) { CreateTreasureChestAtCurrentPosition(par1World, par3StructureBoundingBox, par2Random, 2, 0, i1 - 1, StructureMineshaftPieces.GetTreasurePieces(), 3 + par2Random.Next(4)); } if (par2Random.Next(100) == 0) { CreateTreasureChestAtCurrentPosition(par1World, par3StructureBoundingBox, par2Random, 0, 0, i1 + 1, StructureMineshaftPieces.GetTreasurePieces(), 3 + par2Random.Next(4)); } if (!HasSpiders || SpawnerPlaced) { continue; } int l1 = GetYWithOffset(0); int j2 = (i1 - 1) + par2Random.Next(3); int k2 = GetXWithOffset(1, j2); j2 = GetZWithOffset(1, j2); if (!par3StructureBoundingBox.IsVecInside(k2, l1, j2)) { continue; } SpawnerPlaced = true; par1World.SetBlockWithNotify(k2, l1, j2, Block.MobSpawner.BlockID); TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)par1World.GetBlockTileEntity(k2, l1, j2); if (tileentitymobspawner != null) { tileentitymobspawner.SetMobID("CaveSpider"); } } for (int k = 0; k <= 2; k++) { for (int j1 = 0; j1 <= i; j1++) { int i2 = GetBlockIdAtCurrentPosition(par1World, k, -1, j1, par3StructureBoundingBox); if (i2 == 0) { PlaceBlockAtCurrentPosition(par1World, Block.Planks.BlockID, 0, k, -1, j1, par3StructureBoundingBox); } } } if (HasRails) { for (int l = 0; l <= i; l++) { int k1 = GetBlockIdAtCurrentPosition(par1World, 1, -1, l, par3StructureBoundingBox); if (k1 > 0 && Block.OpaqueCubeLookup[k1]) { RandomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.7F, 1, 0, l, Block.Rail.BlockID, GetMetadataWithOffset(Block.Rail.BlockID, 0)); } } } return(true); }