the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 748 lines 38 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.h" 3#include "net.minecraft.world.entity.monster.h" 4#include "net.minecraft.world.item.h" 5#include "net.minecraft.world.level.dimension.h" 6#include "net.minecraft.world.level.h" 7#include "net.minecraft.world.level.tile.h" 8#include "net.minecraft.world.level.levelgen.structure.h" 9#include "WeighedTreasure.h" 10#include "ScatteredFeaturePieces.h" 11 12void ScatteredFeaturePieces::loadStatic() 13{ 14 StructureFeatureIO::setPieceId(eStructurePiece_DesertPyramidPiece, DesertPyramidPiece::Create, L"TeDP"); 15 StructureFeatureIO::setPieceId(eStructurePiece_JunglePyramidPiece, DesertPyramidPiece::Create, L"TeJP"); 16 StructureFeatureIO::setPieceId(eStructurePiece_SwamplandHut, DesertPyramidPiece::Create, L"TeSH"); 17} 18 19ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece() 20{ 21 width = 0; 22 height = 0; 23 depth = 0; 24 heightPosition = 0; 25 // for reflection 26} 27 28ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece(Random *random, int west, int floor, int north, int width, int height, int depth) : StructurePiece(0) 29{ 30 heightPosition = -1; 31 this->width = width; 32 this->height = height; 33 this->depth = depth; 34 35 orientation = random->nextInt(4); 36 37 LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); 38 if( levelGenOptions != NULL ) 39 { 40 int tempOrientation = 0; 41 if(levelGenOptions->isFeatureChunk(west>>4,north>>4,StructureFeature::eFeature_Temples, &tempOrientation) ) 42 { 43 orientation = tempOrientation; 44 } 45 } 46 47 switch (orientation) 48 { 49 case Direction::NORTH: 50 case Direction::SOUTH: 51 boundingBox = new BoundingBox(west, floor, north, west + width - 1, floor + height - 1, north + depth - 1); 52 break; 53 default: 54 boundingBox = new BoundingBox(west, floor, north, west + depth - 1, floor + height - 1, north + width - 1); 55 break; 56 } 57} 58 59void ScatteredFeaturePieces::ScatteredFeaturePiece::addAdditonalSaveData(CompoundTag *tag) 60{ 61 tag->putInt(L"Width", width); 62 tag->putInt(L"Height", height); 63 tag->putInt(L"Depth", depth); 64 tag->putInt(L"HPos", heightPosition); 65} 66 67void ScatteredFeaturePieces::ScatteredFeaturePiece::readAdditonalSaveData(CompoundTag *tag) 68{ 69 width = tag->getInt(L"Width"); 70 height = tag->getInt(L"Height"); 71 depth = tag->getInt(L"Depth"); 72 heightPosition = tag->getInt(L"HPos"); 73} 74 75bool ScatteredFeaturePieces::ScatteredFeaturePiece::updateAverageGroundHeight(Level *level, BoundingBox *chunkBB, int offset) 76{ 77 if (heightPosition >= 0) 78 { 79 return true; 80 } 81 82 int total = 0; 83 int count = 0; 84 for (int z = boundingBox->z0; z <= boundingBox->z1; z++) 85 { 86 for (int x = boundingBox->x0; x <= boundingBox->x1; x++) 87 { 88 if (chunkBB->isInside(x, 64, z)) 89 { 90 total += max(level->getTopSolidBlock(x, z), level->dimension->getSpawnYPosition()); 91 count++; 92 } 93 } 94 } 95 96 if (count == 0) 97 { 98 return false; 99 } 100 heightPosition = total / count; 101 boundingBox->move(0, heightPosition - boundingBox->y0 + offset, 0); 102 return true; 103} 104 105WeighedTreasure *ScatteredFeaturePieces::DesertPyramidPiece::treasureItems[ScatteredFeaturePieces::DesertPyramidPiece::TREASURE_ITEMS_COUNT] = 106{ 107 new WeighedTreasure(Item::diamond_Id, 0, 1, 3, 3), 108 new WeighedTreasure(Item::ironIngot_Id, 0, 1, 5, 10), 109 new WeighedTreasure(Item::goldIngot_Id, 0, 2, 7, 15), 110 new WeighedTreasure(Item::emerald_Id, 0, 1, 3, 2), 111 new WeighedTreasure(Item::bone_Id, 0, 4, 6, 20), 112 new WeighedTreasure(Item::rotten_flesh_Id, 0, 3, 7, 16), 113 // very rare for pyramids ... 114 new WeighedTreasure(Item::saddle_Id, 0, 1, 1, 3), 115 new WeighedTreasure(Item::horseArmorMetal_Id, 0, 1, 1, 1), 116 new WeighedTreasure(Item::horseArmorGold_Id, 0, 1, 1, 1), 117 new WeighedTreasure(Item::horseArmorDiamond_Id, 0, 1, 1, 1), 118 // ... 119}; 120 121ScatteredFeaturePieces::DesertPyramidPiece::DesertPyramidPiece() 122{ 123 hasPlacedChest[0] = false; 124 hasPlacedChest[1] = false; 125 hasPlacedChest[2] = false; 126 hasPlacedChest[3] = false; 127 // for reflection 128} 129 130ScatteredFeaturePieces::DesertPyramidPiece::DesertPyramidPiece(Random *random, int west, int north) : ScatteredFeaturePiece(random, west, 64, north, 21, 15, 21) 131{ 132 hasPlacedChest[0] = false; 133 hasPlacedChest[1] = false; 134 hasPlacedChest[2] = false; 135 hasPlacedChest[3] = false; 136} 137 138void ScatteredFeaturePieces::DesertPyramidPiece::addAdditonalSaveData(CompoundTag *tag) 139{ 140 ScatteredFeaturePiece::addAdditonalSaveData(tag); 141 tag->putBoolean(L"hasPlacedChest0", hasPlacedChest[0]); 142 tag->putBoolean(L"hasPlacedChest1", hasPlacedChest[1]); 143 tag->putBoolean(L"hasPlacedChest2", hasPlacedChest[2]); 144 tag->putBoolean(L"hasPlacedChest3", hasPlacedChest[3]); 145} 146 147void ScatteredFeaturePieces::DesertPyramidPiece::readAdditonalSaveData(CompoundTag *tag) 148{ 149 ScatteredFeaturePiece::readAdditonalSaveData(tag); 150 hasPlacedChest[0] = tag->getBoolean(L"hasPlacedChest0"); 151 hasPlacedChest[1] = tag->getBoolean(L"hasPlacedChest1"); 152 hasPlacedChest[2] = tag->getBoolean(L"hasPlacedChest2"); 153 hasPlacedChest[3] = tag->getBoolean(L"hasPlacedChest3"); 154} 155 156bool ScatteredFeaturePieces::DesertPyramidPiece::postProcess(Level *level, Random *random, BoundingBox *chunkBB) 157{ 158 // pyramid 159 generateBox(level, chunkBB, 0, -4, 0, width - 1, 0, depth - 1, Tile::sandStone_Id, Tile::sandStone_Id, false); 160 for (int pos = 1; pos <= 9; pos++) 161 { 162 generateBox(level, chunkBB, pos, pos, pos, width - 1 - pos, pos, depth - 1 - pos, Tile::sandStone_Id, Tile::sandStone_Id, false); 163 generateBox(level, chunkBB, pos + 1, pos, pos + 1, width - 2 - pos, pos, depth - 2 - pos, 0, 0, false); 164 } 165 for (int x = 0; x < width; x++) 166 { 167 for (int z = 0; z < depth; z++) 168 { 169 fillColumnDown(level, Tile::sandStone_Id, 0, x, -5, z, chunkBB); 170 } 171 } 172 173 int stairsNorth = getOrientationData(Tile::stairs_sandstone_Id, 3); 174 int stairsSouth = getOrientationData(Tile::stairs_sandstone_Id, 2); 175 int stairsEast = getOrientationData(Tile::stairs_sandstone_Id, 0); 176 int stairsWest = getOrientationData(Tile::stairs_sandstone_Id, 1); 177 int baseDecoColor = ~DyePowderItem::ORANGE & 0xf; 178 int blue = ~DyePowderItem::BLUE & 0xf; 179 180 // towers 181 generateBox(level, chunkBB, 0, 0, 0, 4, 9, 4, Tile::sandStone_Id, 0, false); 182 generateBox(level, chunkBB, 1, 10, 1, 3, 10, 3, Tile::sandStone_Id, Tile::sandStone_Id, false); 183 placeBlock(level, Tile::stairs_sandstone_Id, stairsNorth, 2, 10, 0, chunkBB); 184 placeBlock(level, Tile::stairs_sandstone_Id, stairsSouth, 2, 10, 4, chunkBB); 185 placeBlock(level, Tile::stairs_sandstone_Id, stairsEast, 0, 10, 2, chunkBB); 186 placeBlock(level, Tile::stairs_sandstone_Id, stairsWest, 4, 10, 2, chunkBB); 187 generateBox(level, chunkBB, width - 5, 0, 0, width - 1, 9, 4, Tile::sandStone_Id, 0, false); 188 generateBox(level, chunkBB, width - 4, 10, 1, width - 2, 10, 3, Tile::sandStone_Id, Tile::sandStone_Id, false); 189 placeBlock(level, Tile::stairs_sandstone_Id, stairsNorth, width - 3, 10, 0, chunkBB); 190 placeBlock(level, Tile::stairs_sandstone_Id, stairsSouth, width - 3, 10, 4, chunkBB); 191 placeBlock(level, Tile::stairs_sandstone_Id, stairsEast, width - 5, 10, 2, chunkBB); 192 placeBlock(level, Tile::stairs_sandstone_Id, stairsWest, width - 1, 10, 2, chunkBB); 193 194 // entrance 195 generateBox(level, chunkBB, 8, 0, 0, 12, 4, 4, Tile::sandStone_Id, 0, false); 196 generateBox(level, chunkBB, 9, 1, 0, 11, 3, 4, 0, 0, false); 197 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 9, 1, 1, chunkBB); 198 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 9, 2, 1, chunkBB); 199 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 9, 3, 1, chunkBB); 200 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 10, 3, 1, chunkBB); 201 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 11, 3, 1, chunkBB); 202 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 11, 2, 1, chunkBB); 203 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 11, 1, 1, chunkBB); 204 205 // tower pathways 206 generateBox(level, chunkBB, 4, 1, 1, 8, 3, 3, Tile::sandStone_Id, 0, false); 207 generateBox(level, chunkBB, 4, 1, 2, 8, 2, 2, 0, 0, false); 208 generateBox(level, chunkBB, 12, 1, 1, 16, 3, 3, Tile::sandStone_Id, 0, false); 209 generateBox(level, chunkBB, 12, 1, 2, 16, 2, 2, 0, 0, false); 210 211 // hall floor and pillars 212 generateBox(level, chunkBB, 5, 4, 5, width - 6, 4, depth - 6, Tile::sandStone_Id, Tile::sandStone_Id, false); 213 generateBox(level, chunkBB, 9, 4, 9, 11, 4, 11, 0, 0, false); 214 generateBox(level, chunkBB, 8, 1, 8, 8, 3, 8, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); 215 generateBox(level, chunkBB, 12, 1, 8, 12, 3, 8, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); 216 generateBox(level, chunkBB, 8, 1, 12, 8, 3, 12, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); 217 generateBox(level, chunkBB, 12, 1, 12, 12, 3, 12, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); 218 219 // catwalks 220 generateBox(level, chunkBB, 1, 1, 5, 4, 4, 11, Tile::sandStone_Id, Tile::sandStone_Id, false); 221 generateBox(level, chunkBB, width - 5, 1, 5, width - 2, 4, 11, Tile::sandStone_Id, Tile::sandStone_Id, false); 222 generateBox(level, chunkBB, 6, 7, 9, 6, 7, 11, Tile::sandStone_Id, Tile::sandStone_Id, false); 223 generateBox(level, chunkBB, width - 7, 7, 9, width - 7, 7, 11, Tile::sandStone_Id, Tile::sandStone_Id, false); 224 generateBox(level, chunkBB, 5, 5, 9, 5, 7, 11, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); 225 generateBox(level, chunkBB, width - 6, 5, 9, width - 6, 7, 11, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); 226 placeBlock(level, 0, 0, 5, 5, 10, chunkBB); 227 placeBlock(level, 0, 0, 5, 6, 10, chunkBB); 228 placeBlock(level, 0, 0, 6, 6, 10, chunkBB); 229 placeBlock(level, 0, 0, width - 6, 5, 10, chunkBB); 230 placeBlock(level, 0, 0, width - 6, 6, 10, chunkBB); 231 placeBlock(level, 0, 0, width - 7, 6, 10, chunkBB); 232 233 // tower stairs 234 generateBox(level, chunkBB, 2, 4, 4, 2, 6, 4, 0, 0, false); 235 generateBox(level, chunkBB, width - 3, 4, 4, width - 3, 6, 4, 0, 0, false); 236 placeBlock(level, Tile::stairs_sandstone_Id, stairsNorth, 2, 4, 5, chunkBB); 237 placeBlock(level, Tile::stairs_sandstone_Id, stairsNorth, 2, 3, 4, chunkBB); 238 placeBlock(level, Tile::stairs_sandstone_Id, stairsNorth, width - 3, 4, 5, chunkBB); 239 placeBlock(level, Tile::stairs_sandstone_Id, stairsNorth, width - 3, 3, 4, chunkBB); 240 generateBox(level, chunkBB, 1, 1, 3, 2, 2, 3, Tile::sandStone_Id, Tile::sandStone_Id, false); 241 generateBox(level, chunkBB, width - 3, 1, 3, width - 2, 2, 3, Tile::sandStone_Id, Tile::sandStone_Id, false); 242 placeBlock(level, Tile::stairs_sandstone_Id, 0, 1, 1, 2, chunkBB); 243 placeBlock(level, Tile::stairs_sandstone_Id, 0, width - 2, 1, 2, chunkBB); 244 placeBlock(level, Tile::stoneSlabHalf_Id, StoneSlabTile::SAND_SLAB, 1, 2, 2, chunkBB); 245 placeBlock(level, Tile::stoneSlabHalf_Id, StoneSlabTile::SAND_SLAB, width - 2, 2, 2, chunkBB); 246 placeBlock(level, Tile::stairs_sandstone_Id, stairsWest, 2, 1, 2, chunkBB); 247 placeBlock(level, Tile::stairs_sandstone_Id, stairsEast, width - 3, 1, 2, chunkBB); 248 249 // indoor decoration 250 generateBox(level, chunkBB, 4, 3, 5, 4, 3, 18, Tile::sandStone_Id, Tile::sandStone_Id, false); 251 generateBox(level, chunkBB, width - 5, 3, 5, width - 5, 3, 17, Tile::sandStone_Id, Tile::sandStone_Id, false); 252 generateBox(level, chunkBB, 3, 1, 5, 4, 2, 16, 0, 0, false); 253 generateBox(level, chunkBB, width - 6, 1, 5, width - 5, 2, 16, 0, 0, false); 254 for (int z = 5; z <= 17; z += 2) 255 { 256 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 4, 1, z, chunkBB); 257 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, 4, 2, z, chunkBB); 258 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, width - 5, 1, z, chunkBB); 259 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, width - 5, 2, z, chunkBB); 260 } 261 placeBlock(level, Tile::wool_Id, baseDecoColor, 10, 0, 7, chunkBB); 262 placeBlock(level, Tile::wool_Id, baseDecoColor, 10, 0, 8, chunkBB); 263 placeBlock(level, Tile::wool_Id, baseDecoColor, 9, 0, 9, chunkBB); 264 placeBlock(level, Tile::wool_Id, baseDecoColor, 11, 0, 9, chunkBB); 265 placeBlock(level, Tile::wool_Id, baseDecoColor, 8, 0, 10, chunkBB); 266 placeBlock(level, Tile::wool_Id, baseDecoColor, 12, 0, 10, chunkBB); 267 placeBlock(level, Tile::wool_Id, baseDecoColor, 7, 0, 10, chunkBB); 268 placeBlock(level, Tile::wool_Id, baseDecoColor, 13, 0, 10, chunkBB); 269 placeBlock(level, Tile::wool_Id, baseDecoColor, 9, 0, 11, chunkBB); 270 placeBlock(level, Tile::wool_Id, baseDecoColor, 11, 0, 11, chunkBB); 271 placeBlock(level, Tile::wool_Id, baseDecoColor, 10, 0, 12, chunkBB); 272 placeBlock(level, Tile::wool_Id, baseDecoColor, 10, 0, 13, chunkBB); 273 placeBlock(level, Tile::wool_Id, blue, 10, 0, 10, chunkBB); 274 275 // outdoor decoration 276 for (int x = 0; x <= width - 1; x += width - 1) 277 { 278 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 2, 1, chunkBB); 279 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 2, 2, chunkBB); 280 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 2, 3, chunkBB); 281 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 3, 1, chunkBB); 282 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 3, 2, chunkBB); 283 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 3, 3, chunkBB); 284 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 4, 1, chunkBB); 285 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, x, 4, 2, chunkBB); 286 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 4, 3, chunkBB); 287 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 5, 1, chunkBB); 288 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 5, 2, chunkBB); 289 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 5, 3, chunkBB); 290 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 6, 1, chunkBB); 291 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, x, 6, 2, chunkBB); 292 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 6, 3, chunkBB); 293 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 7, 1, chunkBB); 294 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 7, 2, chunkBB); 295 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 7, 3, chunkBB); 296 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 8, 1, chunkBB); 297 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 8, 2, chunkBB); 298 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 8, 3, chunkBB); 299 } 300 for (int x = 2; x <= width - 3; x += width - 3 - 2) 301 { 302 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x - 1, 2, 0, chunkBB); 303 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 2, 0, chunkBB); 304 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x + 1, 2, 0, chunkBB); 305 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x - 1, 3, 0, chunkBB); 306 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 3, 0, chunkBB); 307 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x + 1, 3, 0, chunkBB); 308 placeBlock(level, Tile::wool_Id, baseDecoColor, x - 1, 4, 0, chunkBB); 309 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, x, 4, 0, chunkBB); 310 placeBlock(level, Tile::wool_Id, baseDecoColor, x + 1, 4, 0, chunkBB); 311 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x - 1, 5, 0, chunkBB); 312 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 5, 0, chunkBB); 313 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x + 1, 5, 0, chunkBB); 314 placeBlock(level, Tile::wool_Id, baseDecoColor, x - 1, 6, 0, chunkBB); 315 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, x, 6, 0, chunkBB); 316 placeBlock(level, Tile::wool_Id, baseDecoColor, x + 1, 6, 00, chunkBB); 317 placeBlock(level, Tile::wool_Id, baseDecoColor, x - 1, 7, 0, chunkBB); 318 placeBlock(level, Tile::wool_Id, baseDecoColor, x, 7, 0, chunkBB); 319 placeBlock(level, Tile::wool_Id, baseDecoColor, x + 1, 7, 0, chunkBB); 320 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x - 1, 8, 0, chunkBB); 321 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 8, 0, chunkBB); 322 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x + 1, 8, 0, chunkBB); 323 } 324 generateBox(level, chunkBB, 8, 4, 0, 12, 6, 0, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); 325 placeBlock(level, 0, 0, 8, 6, 0, chunkBB); 326 placeBlock(level, 0, 0, 12, 6, 0, chunkBB); 327 placeBlock(level, Tile::wool_Id, baseDecoColor, 9, 5, 0, chunkBB); 328 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, 10, 5, 0, chunkBB); 329 placeBlock(level, Tile::wool_Id, baseDecoColor, 11, 5, 0, chunkBB); 330 331 // tombs 332 generateBox(level, chunkBB, 8, -14, 8, 12, -11, 12, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); 333 generateBox(level, chunkBB, 8, -10, 8, 12, -10, 12, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, false); 334 generateBox(level, chunkBB, 8, -9, 8, 12, -9, 12, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); 335 generateBox(level, chunkBB, 8, -8, 8, 12, -1, 12, Tile::sandStone_Id, Tile::sandStone_Id, false); 336 generateBox(level, chunkBB, 9, -11, 9, 11, -1, 11, 0, 0, false); 337 placeBlock(level, Tile::pressurePlate_stone_Id, 0, 10, -11, 10, chunkBB); 338 generateBox(level, chunkBB, 9, -13, 9, 11, -13, 11, Tile::tnt_Id, 0, false); 339 placeBlock(level, 0, 0, 8, -11, 10, chunkBB); 340 placeBlock(level, 0, 0, 8, -10, 10, chunkBB); 341 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, 7, -10, 10, chunkBB); 342 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 7, -11, 10, chunkBB); 343 placeBlock(level, 0, 0, 12, -11, 10, chunkBB); 344 placeBlock(level, 0, 0, 12, -10, 10, chunkBB); 345 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, 13, -10, 10, chunkBB); 346 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 13, -11, 10, chunkBB); 347 placeBlock(level, 0, 0, 10, -11, 8, chunkBB); 348 placeBlock(level, 0, 0, 10, -10, 8, chunkBB); 349 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, 10, -10, 7, chunkBB); 350 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 10, -11, 7, chunkBB); 351 placeBlock(level, 0, 0, 10, -11, 12, chunkBB); 352 placeBlock(level, 0, 0, 10, -10, 12, chunkBB); 353 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, 10, -10, 13, chunkBB); 354 placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 10, -11, 13, chunkBB); 355 356 // chests! 357 for (int i = 0; i < 4; i++) 358 { 359 if (!hasPlacedChest[i]) 360 { 361 int xo = Direction::STEP_X[i] * 2; 362 int zo = Direction::STEP_Z[i] * 2; 363 hasPlacedChest[i] = createChest(level, chunkBB, random, 10 + xo, -11, 10 + zo, WeighedTreasure::addToTreasure(WeighedTreasureArray(treasureItems,TREASURE_ITEMS_COUNT), Item::enchantedBook->createForRandomTreasure(random)), 2 + random->nextInt(5)); 364 } 365 } 366 367 return true; 368} 369 370WeighedTreasure *ScatteredFeaturePieces::JunglePyramidPiece::treasureItems[ScatteredFeaturePieces::JunglePyramidPiece::TREASURE_ITEMS_COUNT] = 371{ 372 new WeighedTreasure(Item::diamond_Id, 0, 1, 3, 3), 373 new WeighedTreasure(Item::ironIngot_Id, 0, 1, 5, 10), 374 new WeighedTreasure(Item::goldIngot_Id, 0, 2, 7, 15), 375 new WeighedTreasure(Item::emerald_Id, 0, 1, 3, 2), 376 new WeighedTreasure(Item::bone_Id, 0, 4, 6, 20), 377 new WeighedTreasure(Item::rotten_flesh_Id, 0, 3, 7, 16), 378 // very rare for pyramids ... 379 new WeighedTreasure(Item::saddle_Id, 0, 1, 1, 3), 380 new WeighedTreasure(Item::horseArmorMetal_Id, 0, 1, 1, 1), 381 new WeighedTreasure(Item::horseArmorGold_Id, 0, 1, 1, 1), 382 new WeighedTreasure(Item::horseArmorDiamond_Id, 0, 1, 1, 1), 383 // ... 384}; 385 386 387WeighedTreasure *ScatteredFeaturePieces::JunglePyramidPiece::dispenserItems[ScatteredFeaturePieces::JunglePyramidPiece::DISPENSER_ITEMS_COUNT] = 388{ 389 new WeighedTreasure(Item::arrow_Id, 0, 2, 7, 30), 390 // new WeighedTreasure(Item.fireball.id, 0, 1, 1, 10), 391}; 392 393ScatteredFeaturePieces::JunglePyramidPiece::JunglePyramidPiece() 394{ 395 // for reflection 396} 397 398ScatteredFeaturePieces::JunglePyramidPiece::JunglePyramidPiece(Random *random, int west, int north) : ScatteredFeaturePiece(random, west, 64, north, 12, 10, 15) 399{ 400 placedMainChest = false; 401 placedHiddenChest = false; 402 placedTrap1 = false; 403 placedTrap2 = false; 404} 405 406void ScatteredFeaturePieces::JunglePyramidPiece::addAdditonalSaveData(CompoundTag *tag) 407{ 408 ScatteredFeaturePiece::addAdditonalSaveData(tag); 409 tag->putBoolean(L"placedMainChest", placedMainChest); 410 tag->putBoolean(L"placedHiddenChest", placedHiddenChest); 411 tag->putBoolean(L"placedTrap1", placedTrap1); 412 tag->putBoolean(L"placedTrap2", placedTrap2); 413} 414 415void ScatteredFeaturePieces::JunglePyramidPiece::readAdditonalSaveData(CompoundTag *tag) 416{ 417 ScatteredFeaturePiece::readAdditonalSaveData(tag); 418 placedMainChest = tag->getBoolean(L"placedMainChest"); 419 placedHiddenChest = tag->getBoolean(L"placedHiddenChest"); 420 placedTrap1 = tag->getBoolean(L"placedTrap1"); 421 placedTrap2 = tag->getBoolean(L"placedTrap2"); 422} 423 424bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(Level *level, Random *random, BoundingBox *chunkBB) 425{ 426 if (!updateAverageGroundHeight(level, chunkBB, 0)) 427 { 428 return false; 429 } 430 431 int stairsNorth = getOrientationData(Tile::stairs_stone_Id, 3); 432 int stairsSouth = getOrientationData(Tile::stairs_stone_Id, 2); 433 int stairsEast = getOrientationData(Tile::stairs_stone_Id, 0); 434 int stairsWest = getOrientationData(Tile::stairs_stone_Id, 1); 435 436 // floor 437 generateBox(level, chunkBB, 0, -4, 0, width - 1, 0, depth - 1, false, random, &stoneSelector); 438 439 // first floor walls 440 generateBox(level, chunkBB, 2, 1, 2, 9, 2, 2, false, random, &stoneSelector); 441 generateBox(level, chunkBB, 2, 1, 12, 9, 2, 12, false, random, &stoneSelector); 442 generateBox(level, chunkBB, 2, 1, 3, 2, 2, 11, false, random, &stoneSelector); 443 generateBox(level, chunkBB, 9, 1, 3, 9, 2, 11, false, random, &stoneSelector); 444 445 // second floor walls 446 generateBox(level, chunkBB, 1, 3, 1, 10, 6, 1, false, random, &stoneSelector); 447 generateBox(level, chunkBB, 1, 3, 13, 10, 6, 13, false, random, &stoneSelector); 448 generateBox(level, chunkBB, 1, 3, 2, 1, 6, 12, false, random, &stoneSelector); 449 generateBox(level, chunkBB, 10, 3, 2, 10, 6, 12, false, random, &stoneSelector); 450 451 // roof levels 452 generateBox(level, chunkBB, 2, 3, 2, 9, 3, 12, false, random, &stoneSelector); 453 generateBox(level, chunkBB, 2, 6, 2, 9, 6, 12, false, random, &stoneSelector); 454 generateBox(level, chunkBB, 3, 7, 3, 8, 7, 11, false, random, &stoneSelector); 455 generateBox(level, chunkBB, 4, 8, 4, 7, 8, 10, false, random, &stoneSelector); 456 457 // clear interior 458 generateAirBox(level, chunkBB, 3, 1, 3, 8, 2, 11); 459 generateAirBox(level, chunkBB, 4, 3, 6, 7, 3, 9); 460 generateAirBox(level, chunkBB, 2, 4, 2, 9, 5, 12); 461 generateAirBox(level, chunkBB, 4, 6, 5, 7, 6, 9); 462 generateAirBox(level, chunkBB, 5, 7, 6, 6, 7, 8); 463 464 // doors and windows 465 generateAirBox(level, chunkBB, 5, 1, 2, 6, 2, 2); 466 generateAirBox(level, chunkBB, 5, 2, 12, 6, 2, 12); 467 generateAirBox(level, chunkBB, 5, 5, 1, 6, 5, 1); 468 generateAirBox(level, chunkBB, 5, 5, 13, 6, 5, 13); 469 placeBlock(level, 0, 0, 1, 5, 5, chunkBB); 470 placeBlock(level, 0, 0, 10, 5, 5, chunkBB); 471 placeBlock(level, 0, 0, 1, 5, 9, chunkBB); 472 placeBlock(level, 0, 0, 10, 5, 9, chunkBB); 473 474 // outside decoration 475 for (int z = 0; z <= 14; z += 14) 476 { 477 generateBox(level, chunkBB, 2, 4, z, 2, 5, z, false, random, &stoneSelector); 478 generateBox(level, chunkBB, 4, 4, z, 4, 5, z, false, random, &stoneSelector); 479 generateBox(level, chunkBB, 7, 4, z, 7, 5, z, false, random, &stoneSelector); 480 generateBox(level, chunkBB, 9, 4, z, 9, 5, z, false, random, &stoneSelector); 481 } 482 generateBox(level, chunkBB, 5, 6, 0, 6, 6, 0, false, random, &stoneSelector); 483 for (int x = 0; x <= 11; x += 11) 484 { 485 for (int z = 2; z <= 12; z += 2) 486 { 487 generateBox(level, chunkBB, x, 4, z, x, 5, z, false, random, &stoneSelector); 488 } 489 generateBox(level, chunkBB, x, 6, 5, x, 6, 5, false, random, &stoneSelector); 490 generateBox(level, chunkBB, x, 6, 9, x, 6, 9, false, random, &stoneSelector); 491 } 492 generateBox(level, chunkBB, 2, 7, 2, 2, 9, 2, false, random, &stoneSelector); 493 generateBox(level, chunkBB, 9, 7, 2, 9, 9, 2, false, random, &stoneSelector); 494 generateBox(level, chunkBB, 2, 7, 12, 2, 9, 12, false, random, &stoneSelector); 495 generateBox(level, chunkBB, 9, 7, 12, 9, 9, 12, false, random, &stoneSelector); 496 generateBox(level, chunkBB, 4, 9, 4, 4, 9, 4, false, random, &stoneSelector); 497 generateBox(level, chunkBB, 7, 9, 4, 7, 9, 4, false, random, &stoneSelector); 498 generateBox(level, chunkBB, 4, 9, 10, 4, 9, 10, false, random, &stoneSelector); 499 generateBox(level, chunkBB, 7, 9, 10, 7, 9, 10, false, random, &stoneSelector); 500 generateBox(level, chunkBB, 5, 9, 7, 6, 9, 7, false, random, &stoneSelector); 501 placeBlock(level, Tile::stairs_stone_Id, stairsNorth, 5, 9, 6, chunkBB); 502 placeBlock(level, Tile::stairs_stone_Id, stairsNorth, 6, 9, 6, chunkBB); 503 placeBlock(level, Tile::stairs_stone_Id, stairsSouth, 5, 9, 8, chunkBB); 504 placeBlock(level, Tile::stairs_stone_Id, stairsSouth, 6, 9, 8, chunkBB); 505 506 // front stairs 507 placeBlock(level, Tile::stairs_stone_Id, stairsNorth, 4, 0, 0, chunkBB); 508 placeBlock(level, Tile::stairs_stone_Id, stairsNorth, 5, 0, 0, chunkBB); 509 placeBlock(level, Tile::stairs_stone_Id, stairsNorth, 6, 0, 0, chunkBB); 510 placeBlock(level, Tile::stairs_stone_Id, stairsNorth, 7, 0, 0, chunkBB); 511 512 // indoor stairs up 513 placeBlock(level, Tile::stairs_stone_Id, stairsNorth, 4, 1, 8, chunkBB); 514 placeBlock(level, Tile::stairs_stone_Id, stairsNorth, 4, 2, 9, chunkBB); 515 placeBlock(level, Tile::stairs_stone_Id, stairsNorth, 4, 3, 10, chunkBB); 516 placeBlock(level, Tile::stairs_stone_Id, stairsNorth, 7, 1, 8, chunkBB); 517 placeBlock(level, Tile::stairs_stone_Id, stairsNorth, 7, 2, 9, chunkBB); 518 placeBlock(level, Tile::stairs_stone_Id, stairsNorth, 7, 3, 10, chunkBB); 519 generateBox(level, chunkBB, 4, 1, 9, 4, 1, 9, false, random, &stoneSelector); 520 generateBox(level, chunkBB, 7, 1, 9, 7, 1, 9, false, random, &stoneSelector); 521 generateBox(level, chunkBB, 4, 1, 10, 7, 2, 10, false, random, &stoneSelector); 522 523 // indoor hand rail 524 generateBox(level, chunkBB, 5, 4, 5, 6, 4, 5, false, random, &stoneSelector); 525 placeBlock(level, Tile::stairs_stone_Id, stairsEast, 4, 4, 5, chunkBB); 526 placeBlock(level, Tile::stairs_stone_Id, stairsWest, 7, 4, 5, chunkBB); 527 528 // indoor stairs down 529 for (int i = 0; i < 4; i++) 530 { 531 placeBlock(level, Tile::stairs_stone_Id, stairsSouth, 5, 0 - i, 6 + i, chunkBB); 532 placeBlock(level, Tile::stairs_stone_Id, stairsSouth, 6, 0 - i, 6 + i, chunkBB); 533 generateAirBox(level, chunkBB, 5, 0 - i, 7 + i, 6, 0 - i, 9 + i); 534 } 535 536 // underground corridors 537 generateAirBox(level, chunkBB, 1, -3, 12, 10, -1, 13); 538 generateAirBox(level, chunkBB, 1, -3, 1, 3, -1, 13); 539 generateAirBox(level, chunkBB, 1, -3, 1, 9, -1, 5); 540 for (int z = 1; z <= 13; z += 2) 541 { 542 generateBox(level, chunkBB, 1, -3, z, 1, -2, z, false, random, &stoneSelector); 543 } 544 for (int z = 2; z <= 12; z += 2) 545 { 546 generateBox(level, chunkBB, 1, -1, z, 3, -1, z, false, random, &stoneSelector); 547 } 548 generateBox(level, chunkBB, 2, -2, 1, 5, -2, 1, false, random, &stoneSelector); 549 generateBox(level, chunkBB, 7, -2, 1, 9, -2, 1, false, random, &stoneSelector); 550 generateBox(level, chunkBB, 6, -3, 1, 6, -3, 1, false, random, &stoneSelector); 551 generateBox(level, chunkBB, 6, -1, 1, 6, -1, 1, false, random, &stoneSelector); 552 553 // trip wire trap 1 554 placeBlock(level, Tile::tripWireSource_Id, getOrientationData(Tile::tripWireSource_Id, Direction::EAST) | TripWireSourceTile::MASK_ATTACHED, 1, -3, 8, chunkBB); 555 placeBlock(level, Tile::tripWireSource_Id, getOrientationData(Tile::tripWireSource_Id, Direction::WEST) | TripWireSourceTile::MASK_ATTACHED, 4, -3, 8, chunkBB); 556 placeBlock(level, Tile::tripWire_Id, TripWireTile::MASK_ATTACHED, 2, -3, 8, chunkBB); 557 placeBlock(level, Tile::tripWire_Id, TripWireTile::MASK_ATTACHED, 3, -3, 8, chunkBB); 558 placeBlock(level, Tile::redStoneDust_Id, 0, 5, -3, 7, chunkBB); 559 placeBlock(level, Tile::redStoneDust_Id, 0, 5, -3, 6, chunkBB); 560 placeBlock(level, Tile::redStoneDust_Id, 0, 5, -3, 5, chunkBB); 561 placeBlock(level, Tile::redStoneDust_Id, 0, 5, -3, 4, chunkBB); 562 placeBlock(level, Tile::redStoneDust_Id, 0, 5, -3, 3, chunkBB); 563 placeBlock(level, Tile::redStoneDust_Id, 0, 5, -3, 2, chunkBB); 564 placeBlock(level, Tile::redStoneDust_Id, 0, 5, -3, 1, chunkBB); 565 placeBlock(level, Tile::redStoneDust_Id, 0, 4, -3, 1, chunkBB); 566 placeBlock(level, Tile::mossyCobblestone_Id, 0, 3, -3, 1, chunkBB); 567 if (!placedTrap1) 568 { 569 placedTrap1 = createDispenser(level, chunkBB, random, 3, -2, 1, Facing::NORTH, WeighedTreasureArray(dispenserItems,DISPENSER_ITEMS_COUNT), 2); 570 } 571 placeBlock(level, Tile::vine_Id, 0xf, 3, -2, 2, chunkBB); 572 573 // trip wire trap 2 574 placeBlock(level, Tile::tripWireSource_Id, getOrientationData(Tile::tripWireSource_Id, Direction::NORTH) | TripWireSourceTile::MASK_ATTACHED, 7, -3, 1, chunkBB); 575 placeBlock(level, Tile::tripWireSource_Id, getOrientationData(Tile::tripWireSource_Id, Direction::SOUTH) | TripWireSourceTile::MASK_ATTACHED, 7, -3, 5, chunkBB); 576 placeBlock(level, Tile::tripWire_Id, TripWireTile::MASK_ATTACHED, 7, -3, 2, chunkBB); 577 placeBlock(level, Tile::tripWire_Id, TripWireTile::MASK_ATTACHED, 7, -3, 3, chunkBB); 578 placeBlock(level, Tile::tripWire_Id, TripWireTile::MASK_ATTACHED, 7, -3, 4, chunkBB); 579 placeBlock(level, Tile::redStoneDust_Id, 0, 8, -3, 6, chunkBB); 580 placeBlock(level, Tile::redStoneDust_Id, 0, 9, -3, 6, chunkBB); 581 placeBlock(level, Tile::redStoneDust_Id, 0, 9, -3, 5, chunkBB); 582 placeBlock(level, Tile::mossyCobblestone_Id, 0, 9, -3, 4, chunkBB); 583 placeBlock(level, Tile::redStoneDust_Id, 0, 9, -2, 4, chunkBB); 584 if (!placedTrap2) 585 { 586 placedTrap2 = createDispenser(level, chunkBB, random, 9, -2, 3, Facing::WEST, WeighedTreasureArray(dispenserItems,DISPENSER_ITEMS_COUNT), 2); 587 } 588 placeBlock(level, Tile::vine_Id, 0xf, 8, -1, 3, chunkBB); 589 placeBlock(level, Tile::vine_Id, 0xf, 8, -2, 3, chunkBB); 590 if (!placedMainChest) 591 { 592 placedMainChest = createChest(level, chunkBB, random, 8, -3, 3, WeighedTreasure::addToTreasure(WeighedTreasureArray(treasureItems,TREASURE_ITEMS_COUNT), Item::enchantedBook->createForRandomTreasure(random)), 2 + random->nextInt(5)); 593 } 594 placeBlock(level, Tile::mossyCobblestone_Id, 0, 9, -3, 2, chunkBB); 595 placeBlock(level, Tile::mossyCobblestone_Id, 0, 8, -3, 1, chunkBB); 596 placeBlock(level, Tile::mossyCobblestone_Id, 0, 4, -3, 5, chunkBB); 597 placeBlock(level, Tile::mossyCobblestone_Id, 0, 5, -2, 5, chunkBB); 598 placeBlock(level, Tile::mossyCobblestone_Id, 0, 5, -1, 5, chunkBB); 599 placeBlock(level, Tile::mossyCobblestone_Id, 0, 6, -3, 5, chunkBB); 600 placeBlock(level, Tile::mossyCobblestone_Id, 0, 7, -2, 5, chunkBB); 601 placeBlock(level, Tile::mossyCobblestone_Id, 0, 7, -1, 5, chunkBB); 602 placeBlock(level, Tile::mossyCobblestone_Id, 0, 8, -3, 5, chunkBB); 603 generateBox(level, chunkBB, 9, -1, 1, 9, -1, 5, false, random, &stoneSelector); 604 605 // hidden room 606 generateAirBox(level, chunkBB, 8, -3, 8, 10, -1, 10); 607 placeBlock(level, Tile::stoneBrick_Id, SmoothStoneBrickTile::TYPE_DETAIL, 8, -2, 11, chunkBB); 608 placeBlock(level, Tile::stoneBrick_Id, SmoothStoneBrickTile::TYPE_DETAIL, 9, -2, 11, chunkBB); 609 placeBlock(level, Tile::stoneBrick_Id, SmoothStoneBrickTile::TYPE_DETAIL, 10, -2, 11, chunkBB); 610 placeBlock(level, Tile::lever_Id, LeverTile::getLeverFacing(getOrientationData(Tile::lever_Id, Facing::NORTH)), 8, -2, 12, chunkBB); 611 placeBlock(level, Tile::lever_Id, LeverTile::getLeverFacing(getOrientationData(Tile::lever_Id, Facing::NORTH)), 9, -2, 12, chunkBB); 612 placeBlock(level, Tile::lever_Id, LeverTile::getLeverFacing(getOrientationData(Tile::lever_Id, Facing::NORTH)), 10, -2, 12, chunkBB); 613 generateBox(level, chunkBB, 8, -3, 8, 8, -3, 10, false, random, &stoneSelector); 614 generateBox(level, chunkBB, 10, -3, 8, 10, -3, 10, false, random, &stoneSelector); 615 placeBlock(level, Tile::mossyCobblestone_Id, 0, 10, -2, 9, chunkBB); 616 placeBlock(level, Tile::redStoneDust_Id, 0, 8, -2, 9, chunkBB); 617 placeBlock(level, Tile::redStoneDust_Id, 0, 8, -2, 10, chunkBB); 618 placeBlock(level, Tile::redStoneDust_Id, 0, 10, -1, 9, chunkBB); 619 placeBlock(level, Tile::pistonStickyBase_Id, Facing::UP, 9, -2, 8, chunkBB); 620 placeBlock(level, Tile::pistonStickyBase_Id, getOrientationData(Tile::pistonStickyBase_Id, Facing::WEST), 10, -2, 8, chunkBB); 621 placeBlock(level, Tile::pistonStickyBase_Id, getOrientationData(Tile::pistonStickyBase_Id, Facing::WEST), 10, -1, 8, chunkBB); 622 placeBlock(level, Tile::diode_off_Id, getOrientationData(Tile::diode_off_Id, Direction::NORTH), 10, -2, 10, chunkBB); 623 if (!placedHiddenChest) 624 { 625 placedHiddenChest = createChest(level, chunkBB, random, 9, -3, 10, WeighedTreasure::addToTreasure(WeighedTreasureArray(treasureItems,TREASURE_ITEMS_COUNT), Item::enchantedBook->createForRandomTreasure(random)), 2 + random->nextInt(5)); 626 } 627 628 return true; 629} 630 631void ScatteredFeaturePieces::JunglePyramidPiece::MossStoneSelector::next(Random *random, int worldX, int worldY, int worldZ, bool isEdge) 632{ 633 if (random->nextFloat() < .4f) 634 { 635 nextId = Tile::cobblestone_Id; 636 } 637 else 638 { 639 nextId = Tile::mossyCobblestone_Id; 640 } 641} 642 643ScatteredFeaturePieces::JunglePyramidPiece::MossStoneSelector ScatteredFeaturePieces::JunglePyramidPiece::stoneSelector; 644 645ScatteredFeaturePieces::SwamplandHut::SwamplandHut() 646{ 647 spawnedWitch = false; 648 // for reflection 649} 650 651ScatteredFeaturePieces::SwamplandHut::SwamplandHut(Random *random, int west, int north) : ScatteredFeaturePiece(random, west, 64, north, 7, 5, 9) 652{ 653 spawnedWitch = false; 654} 655 656void ScatteredFeaturePieces::SwamplandHut::addAdditonalSaveData(CompoundTag *tag) 657{ 658 ScatteredFeaturePiece::addAdditonalSaveData(tag); 659 tag->putBoolean(L"Witch", spawnedWitch); 660} 661 662void ScatteredFeaturePieces::SwamplandHut::readAdditonalSaveData(CompoundTag *tag) 663{ 664 ScatteredFeaturePiece::readAdditonalSaveData(tag); 665 spawnedWitch = tag->getBoolean(L"Witch"); 666} 667 668bool ScatteredFeaturePieces::SwamplandHut::postProcess(Level *level, Random *random, BoundingBox *chunkBB) 669{ 670 if (!updateAverageGroundHeight(level, chunkBB, 0)) 671 { 672 return false; 673 } 674 675 // floor and ceiling 676 generateBox(level, chunkBB, 1, 1, 1, 5, 1, 7, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); 677 generateBox(level, chunkBB, 1, 4, 2, 5, 4, 7, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); 678 generateBox(level, chunkBB, 2, 1, 0, 4, 1, 0, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); 679 680 // walls 681 generateBox(level, chunkBB, 2, 2, 2, 3, 3, 2, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); 682 generateBox(level, chunkBB, 1, 2, 3, 1, 3, 6, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); 683 generateBox(level, chunkBB, 5, 2, 3, 5, 3, 6, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); 684 generateBox(level, chunkBB, 2, 2, 7, 4, 3, 7, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); 685 686 // pillars 687 generateBox(level, chunkBB, 1, 0, 2, 1, 3, 2, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); 688 generateBox(level, chunkBB, 5, 0, 2, 5, 3, 2, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); 689 generateBox(level, chunkBB, 1, 0, 7, 1, 3, 7, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); 690 generateBox(level, chunkBB, 5, 0, 7, 5, 3, 7, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); 691 692 // windows 693 placeBlock(level, Tile::fence_Id, 0, 2, 3, 2, chunkBB); 694 placeBlock(level, Tile::fence_Id, 0, 3, 3, 7, chunkBB); 695 placeBlock(level, 0, 0, 1, 3, 4, chunkBB); 696 placeBlock(level, 0, 0, 5, 3, 4, chunkBB); 697 placeBlock(level, 0, 0, 5, 3, 5, chunkBB); 698 placeBlock(level, Tile::flowerPot_Id, FlowerPotTile::TYPE_MUSHROOM_RED, 1, 3, 5, chunkBB); 699 700 // decoration 701 placeBlock(level, Tile::workBench_Id, 0, 3, 2, 6, chunkBB); 702 placeBlock(level, Tile::cauldron_Id, 0, 4, 2, 6, chunkBB); 703 704 // front railings 705 placeBlock(level, Tile::fence_Id, 0, 1, 2, 1, chunkBB); 706 placeBlock(level, Tile::fence_Id, 0, 5, 2, 1, chunkBB); 707 // placeBlock(level, Tile.torch.id, 0, 1, 3, 1, chunkBB); 708 // placeBlock(level, Tile.torch.id, 0, 5, 3, 1, chunkBB); 709 710 // ceiling edges 711 int south = getOrientationData(Tile::stairs_wood_Id, StairTile::DIR_NORTH); 712 int east = getOrientationData(Tile::stairs_wood_Id, StairTile::DIR_WEST); 713 int west = getOrientationData(Tile::stairs_wood_Id, StairTile::DIR_EAST); 714 int north = getOrientationData(Tile::stairs_wood_Id, StairTile::DIR_SOUTH); 715 716 generateBox(level, chunkBB, 0, 4, 1, 6, 4, 1, Tile::stairs_sprucewood_Id, south, Tile::stairs_sprucewood_Id, south, false); 717 generateBox(level, chunkBB, 0, 4, 2, 0, 4, 7, Tile::stairs_sprucewood_Id, west, Tile::stairs_sprucewood_Id, west, false); 718 generateBox(level, chunkBB, 6, 4, 2, 6, 4, 7, Tile::stairs_sprucewood_Id, east, Tile::stairs_sprucewood_Id, east, false); 719 generateBox(level, chunkBB, 0, 4, 8, 6, 4, 8, Tile::stairs_sprucewood_Id, north, Tile::stairs_sprucewood_Id, north, false); 720 721 // fill pillars down to solid ground 722 for (int z = 2; z <= 7; z += 5) 723 { 724 for (int x = 1; x <= 5; x += 4) 725 { 726 fillColumnDown(level, Tile::treeTrunk_Id, 0, x, -1, z, chunkBB); 727 } 728 } 729 730 if (!spawnedWitch) 731 { 732 int wx = getWorldX(2, 5); 733 int wy = getWorldY(2); 734 int wz = getWorldZ(2, 5); 735 736 if (chunkBB->isInside(wx, wy, wz)) 737 { 738 spawnedWitch = true; 739 740 shared_ptr<Witch> witch = shared_ptr<Witch>( new Witch(level) ); 741 witch->moveTo(wx + .5, wy, wz + .5, 0, 0); 742 witch->finalizeMobSpawn(NULL); 743 level->addEntity(witch); 744 } 745 } 746 747 return true; 748}