aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ScatteredFeaturePieces.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.World/ScatteredFeaturePieces.cpp')
-rw-r--r--Minecraft.World/ScatteredFeaturePieces.cpp319
1 files changed, 265 insertions, 54 deletions
diff --git a/Minecraft.World/ScatteredFeaturePieces.cpp b/Minecraft.World/ScatteredFeaturePieces.cpp
index 07c2e7e6..317d6d9e 100644
--- a/Minecraft.World/ScatteredFeaturePieces.cpp
+++ b/Minecraft.World/ScatteredFeaturePieces.cpp
@@ -1,12 +1,30 @@
#include "stdafx.h"
#include "net.minecraft.h"
+#include "net.minecraft.world.entity.monster.h"
#include "net.minecraft.world.item.h"
#include "net.minecraft.world.level.dimension.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.level.tile.h"
+#include "net.minecraft.world.level.levelgen.structure.h"
#include "WeighedTreasure.h"
#include "ScatteredFeaturePieces.h"
+void ScatteredFeaturePieces::loadStatic()
+{
+ StructureFeatureIO::setPieceId(eStructurePiece_DesertPyramidPiece, DesertPyramidPiece::Create, L"TeDP");
+ StructureFeatureIO::setPieceId(eStructurePiece_JunglePyramidPiece, DesertPyramidPiece::Create, L"TeJP");
+ StructureFeatureIO::setPieceId(eStructurePiece_SwamplandHut, DesertPyramidPiece::Create, L"TeSH");
+}
+
+ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece()
+{
+ width = 0;
+ height = 0;
+ depth = 0;
+ heightPosition = 0;
+ // for reflection
+}
+
ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece(Random *random, int west, int floor, int north, int width, int height, int depth) : StructurePiece(0)
{
heightPosition = -1;
@@ -16,6 +34,16 @@ ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece(Random *ran
orientation = random->nextInt(4);
+ LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions();
+ if( levelGenOptions != NULL )
+ {
+ int tempOrientation = 0;
+ if(levelGenOptions->isFeatureChunk(west>>4,north>>4,StructureFeature::eFeature_Temples, &tempOrientation) )
+ {
+ orientation = tempOrientation;
+ }
+ }
+
switch (orientation)
{
case Direction::NORTH:
@@ -28,6 +56,22 @@ ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece(Random *ran
}
}
+void ScatteredFeaturePieces::ScatteredFeaturePiece::addAdditonalSaveData(CompoundTag *tag)
+{
+ tag->putInt(L"Width", width);
+ tag->putInt(L"Height", height);
+ tag->putInt(L"Depth", depth);
+ tag->putInt(L"HPos", heightPosition);
+}
+
+void ScatteredFeaturePieces::ScatteredFeaturePiece::readAdditonalSaveData(CompoundTag *tag)
+{
+ width = tag->getInt(L"Width");
+ height = tag->getInt(L"Height");
+ depth = tag->getInt(L"Depth");
+ heightPosition = tag->getInt(L"HPos");
+}
+
bool ScatteredFeaturePieces::ScatteredFeaturePiece::updateAverageGroundHeight(Level *level, BoundingBox *chunkBB, int offset)
{
if (heightPosition >= 0)
@@ -66,8 +110,23 @@ WeighedTreasure *ScatteredFeaturePieces::DesertPyramidPiece::treasureItems[Scatt
new WeighedTreasure(Item::emerald_Id, 0, 1, 3, 2),
new WeighedTreasure(Item::bone_Id, 0, 4, 6, 20),
new WeighedTreasure(Item::rotten_flesh_Id, 0, 3, 7, 16),
+ // very rare for pyramids ...
+ new WeighedTreasure(Item::saddle_Id, 0, 1, 1, 3),
+ new WeighedTreasure(Item::horseArmorMetal_Id, 0, 1, 1, 1),
+ new WeighedTreasure(Item::horseArmorGold_Id, 0, 1, 1, 1),
+ new WeighedTreasure(Item::horseArmorDiamond_Id, 0, 1, 1, 1),
+ // ...
};
+ScatteredFeaturePieces::DesertPyramidPiece::DesertPyramidPiece()
+{
+ hasPlacedChest[0] = false;
+ hasPlacedChest[1] = false;
+ hasPlacedChest[2] = false;
+ hasPlacedChest[3] = false;
+ // for reflection
+}
+
ScatteredFeaturePieces::DesertPyramidPiece::DesertPyramidPiece(Random *random, int west, int north) : ScatteredFeaturePiece(random, west, 64, north, 21, 15, 21)
{
hasPlacedChest[0] = false;
@@ -76,6 +135,24 @@ ScatteredFeaturePieces::DesertPyramidPiece::DesertPyramidPiece(Random *random, i
hasPlacedChest[3] = false;
}
+void ScatteredFeaturePieces::DesertPyramidPiece::addAdditonalSaveData(CompoundTag *tag)
+{
+ ScatteredFeaturePiece::addAdditonalSaveData(tag);
+ tag->putBoolean(L"hasPlacedChest0", hasPlacedChest[0]);
+ tag->putBoolean(L"hasPlacedChest1", hasPlacedChest[1]);
+ tag->putBoolean(L"hasPlacedChest2", hasPlacedChest[2]);
+ tag->putBoolean(L"hasPlacedChest3", hasPlacedChest[3]);
+}
+
+void ScatteredFeaturePieces::DesertPyramidPiece::readAdditonalSaveData(CompoundTag *tag)
+{
+ ScatteredFeaturePiece::readAdditonalSaveData(tag);
+ hasPlacedChest[0] = tag->getBoolean(L"hasPlacedChest0");
+ hasPlacedChest[1] = tag->getBoolean(L"hasPlacedChest1");
+ hasPlacedChest[2] = tag->getBoolean(L"hasPlacedChest2");
+ hasPlacedChest[3] = tag->getBoolean(L"hasPlacedChest3");
+}
+
bool ScatteredFeaturePieces::DesertPyramidPiece::postProcess(Level *level, Random *random, BoundingBox *chunkBB)
{
// pyramid
@@ -181,41 +258,41 @@ bool ScatteredFeaturePieces::DesertPyramidPiece::postProcess(Level *level, Rando
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, width - 5, 1, z, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, width - 5, 2, z, chunkBB);
}
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 10, 0, 7, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 10, 0, 8, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 9, 0, 9, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 11, 0, 9, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 8, 0, 10, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 12, 0, 10, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 7, 0, 10, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 13, 0, 10, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 9, 0, 11, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 11, 0, 11, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 10, 0, 12, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 10, 0, 13, chunkBB);
- placeBlock(level, Tile::cloth_Id, blue, 10, 0, 10, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 10, 0, 7, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 10, 0, 8, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 9, 0, 9, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 11, 0, 9, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 8, 0, 10, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 12, 0, 10, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 7, 0, 10, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 13, 0, 10, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 9, 0, 11, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 11, 0, 11, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 10, 0, 12, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 10, 0, 13, chunkBB);
+ placeBlock(level, Tile::wool_Id, blue, 10, 0, 10, chunkBB);
// outdoor decoration
for (int x = 0; x <= width - 1; x += width - 1)
{
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 2, 1, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 2, 2, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 2, 2, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 2, 3, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 3, 1, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 3, 2, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 3, 2, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 3, 3, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 4, 1, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 4, 1, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, x, 4, 2, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 4, 3, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 4, 3, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 5, 1, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 5, 2, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 5, 2, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 5, 3, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 6, 1, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 6, 1, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, x, 6, 2, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 6, 3, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 7, 1, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 7, 2, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 7, 3, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 6, 3, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 7, 1, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 7, 2, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 7, 3, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 8, 1, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 8, 2, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 8, 3, chunkBB);
@@ -223,23 +300,23 @@ bool ScatteredFeaturePieces::DesertPyramidPiece::postProcess(Level *level, Rando
for (int x = 2; x <= width - 3; x += width - 3 - 2)
{
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x - 1, 2, 0, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 2, 0, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 2, 0, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x + 1, 2, 0, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x - 1, 3, 0, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 3, 0, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 3, 0, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x + 1, 3, 0, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x - 1, 4, 0, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x - 1, 4, 0, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, x, 4, 0, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x + 1, 4, 0, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x + 1, 4, 0, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x - 1, 5, 0, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 5, 0, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 5, 0, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x + 1, 5, 0, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x - 1, 6, 0, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x - 1, 6, 0, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, x, 6, 0, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x + 1, 6, 00, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x - 1, 7, 0, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x, 7, 0, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, x + 1, 7, 0, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x + 1, 6, 00, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x - 1, 7, 0, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x, 7, 0, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, x + 1, 7, 0, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x - 1, 8, 0, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 8, 0, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x + 1, 8, 0, chunkBB);
@@ -247,9 +324,9 @@ bool ScatteredFeaturePieces::DesertPyramidPiece::postProcess(Level *level, Rando
generateBox(level, chunkBB, 8, 4, 0, 12, 6, 0, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false);
placeBlock(level, 0, 0, 8, 6, 0, chunkBB);
placeBlock(level, 0, 0, 12, 6, 0, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 9, 5, 0, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 9, 5, 0, chunkBB);
placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, 10, 5, 0, chunkBB);
- placeBlock(level, Tile::cloth_Id, baseDecoColor, 11, 5, 0, chunkBB);
+ placeBlock(level, Tile::wool_Id, baseDecoColor, 11, 5, 0, chunkBB);
// tombs
generateBox(level, chunkBB, 8, -14, 8, 12, -11, 12, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false);
@@ -289,7 +366,7 @@ bool ScatteredFeaturePieces::DesertPyramidPiece::postProcess(Level *level, Rando
return true;
}
-
+
WeighedTreasure *ScatteredFeaturePieces::JunglePyramidPiece::treasureItems[ScatteredFeaturePieces::JunglePyramidPiece::TREASURE_ITEMS_COUNT] =
{
new WeighedTreasure(Item::diamond_Id, 0, 1, 3, 3),
@@ -298,6 +375,12 @@ WeighedTreasure *ScatteredFeaturePieces::JunglePyramidPiece::treasureItems[Scatt
new WeighedTreasure(Item::emerald_Id, 0, 1, 3, 2),
new WeighedTreasure(Item::bone_Id, 0, 4, 6, 20),
new WeighedTreasure(Item::rotten_flesh_Id, 0, 3, 7, 16),
+ // very rare for pyramids ...
+ new WeighedTreasure(Item::saddle_Id, 0, 1, 1, 3),
+ new WeighedTreasure(Item::horseArmorMetal_Id, 0, 1, 1, 1),
+ new WeighedTreasure(Item::horseArmorGold_Id, 0, 1, 1, 1),
+ new WeighedTreasure(Item::horseArmorDiamond_Id, 0, 1, 1, 1),
+ // ...
};
@@ -307,6 +390,11 @@ WeighedTreasure *ScatteredFeaturePieces::JunglePyramidPiece::dispenserItems[Scat
// new WeighedTreasure(Item.fireball.id, 0, 1, 1, 10),
};
+ScatteredFeaturePieces::JunglePyramidPiece::JunglePyramidPiece()
+{
+ // for reflection
+}
+
ScatteredFeaturePieces::JunglePyramidPiece::JunglePyramidPiece(Random *random, int west, int north) : ScatteredFeaturePiece(random, west, 64, north, 12, 10, 15)
{
placedMainChest = false;
@@ -315,6 +403,24 @@ ScatteredFeaturePieces::JunglePyramidPiece::JunglePyramidPiece(Random *random, i
placedTrap2 = false;
}
+void ScatteredFeaturePieces::JunglePyramidPiece::addAdditonalSaveData(CompoundTag *tag)
+{
+ ScatteredFeaturePiece::addAdditonalSaveData(tag);
+ tag->putBoolean(L"placedMainChest", placedMainChest);
+ tag->putBoolean(L"placedHiddenChest", placedHiddenChest);
+ tag->putBoolean(L"placedTrap1", placedTrap1);
+ tag->putBoolean(L"placedTrap2", placedTrap2);
+}
+
+void ScatteredFeaturePieces::JunglePyramidPiece::readAdditonalSaveData(CompoundTag *tag)
+{
+ ScatteredFeaturePiece::readAdditonalSaveData(tag);
+ placedMainChest = tag->getBoolean(L"placedMainChest");
+ placedHiddenChest = tag->getBoolean(L"placedHiddenChest");
+ placedTrap1 = tag->getBoolean(L"placedTrap1");
+ placedTrap2 = tag->getBoolean(L"placedTrap2");
+}
+
bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(Level *level, Random *random, BoundingBox *chunkBB)
{
if (!updateAverageGroundHeight(level, chunkBB, 0))
@@ -457,7 +563,7 @@ bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(Level *level, Rando
placeBlock(level, Tile::redStoneDust_Id, 0, 5, -3, 2, chunkBB);
placeBlock(level, Tile::redStoneDust_Id, 0, 5, -3, 1, chunkBB);
placeBlock(level, Tile::redStoneDust_Id, 0, 4, -3, 1, chunkBB);
- placeBlock(level, Tile::mossStone_Id, 0, 3, -3, 1, chunkBB);
+ placeBlock(level, Tile::mossyCobblestone_Id, 0, 3, -3, 1, chunkBB);
if (!placedTrap1)
{
placedTrap1 = createDispenser(level, chunkBB, random, 3, -2, 1, Facing::NORTH, WeighedTreasureArray(dispenserItems,DISPENSER_ITEMS_COUNT), 2);
@@ -473,7 +579,7 @@ bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(Level *level, Rando
placeBlock(level, Tile::redStoneDust_Id, 0, 8, -3, 6, chunkBB);
placeBlock(level, Tile::redStoneDust_Id, 0, 9, -3, 6, chunkBB);
placeBlock(level, Tile::redStoneDust_Id, 0, 9, -3, 5, chunkBB);
- placeBlock(level, Tile::mossStone_Id, 0, 9, -3, 4, chunkBB);
+ placeBlock(level, Tile::mossyCobblestone_Id, 0, 9, -3, 4, chunkBB);
placeBlock(level, Tile::redStoneDust_Id, 0, 9, -2, 4, chunkBB);
if (!placedTrap2)
{
@@ -485,28 +591,28 @@ bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(Level *level, Rando
{
placedMainChest = createChest(level, chunkBB, random, 8, -3, 3, WeighedTreasure::addToTreasure(WeighedTreasureArray(treasureItems,TREASURE_ITEMS_COUNT), Item::enchantedBook->createForRandomTreasure(random)), 2 + random->nextInt(5));
}
- placeBlock(level, Tile::mossStone_Id, 0, 9, -3, 2, chunkBB);
- placeBlock(level, Tile::mossStone_Id, 0, 8, -3, 1, chunkBB);
- placeBlock(level, Tile::mossStone_Id, 0, 4, -3, 5, chunkBB);
- placeBlock(level, Tile::mossStone_Id, 0, 5, -2, 5, chunkBB);
- placeBlock(level, Tile::mossStone_Id, 0, 5, -1, 5, chunkBB);
- placeBlock(level, Tile::mossStone_Id, 0, 6, -3, 5, chunkBB);
- placeBlock(level, Tile::mossStone_Id, 0, 7, -2, 5, chunkBB);
- placeBlock(level, Tile::mossStone_Id, 0, 7, -1, 5, chunkBB);
- placeBlock(level, Tile::mossStone_Id, 0, 8, -3, 5, chunkBB);
+ placeBlock(level, Tile::mossyCobblestone_Id, 0, 9, -3, 2, chunkBB);
+ placeBlock(level, Tile::mossyCobblestone_Id, 0, 8, -3, 1, chunkBB);
+ placeBlock(level, Tile::mossyCobblestone_Id, 0, 4, -3, 5, chunkBB);
+ placeBlock(level, Tile::mossyCobblestone_Id, 0, 5, -2, 5, chunkBB);
+ placeBlock(level, Tile::mossyCobblestone_Id, 0, 5, -1, 5, chunkBB);
+ placeBlock(level, Tile::mossyCobblestone_Id, 0, 6, -3, 5, chunkBB);
+ placeBlock(level, Tile::mossyCobblestone_Id, 0, 7, -2, 5, chunkBB);
+ placeBlock(level, Tile::mossyCobblestone_Id, 0, 7, -1, 5, chunkBB);
+ placeBlock(level, Tile::mossyCobblestone_Id, 0, 8, -3, 5, chunkBB);
generateBox(level, chunkBB, 9, -1, 1, 9, -1, 5, false, random, &stoneSelector);
// hidden room
generateAirBox(level, chunkBB, 8, -3, 8, 10, -1, 10);
- placeBlock(level, Tile::stoneBrickSmooth_Id, SmoothStoneBrickTile::TYPE_DETAIL, 8, -2, 11, chunkBB);
- placeBlock(level, Tile::stoneBrickSmooth_Id, SmoothStoneBrickTile::TYPE_DETAIL, 9, -2, 11, chunkBB);
- placeBlock(level, Tile::stoneBrickSmooth_Id, SmoothStoneBrickTile::TYPE_DETAIL, 10, -2, 11, chunkBB);
+ placeBlock(level, Tile::stoneBrick_Id, SmoothStoneBrickTile::TYPE_DETAIL, 8, -2, 11, chunkBB);
+ placeBlock(level, Tile::stoneBrick_Id, SmoothStoneBrickTile::TYPE_DETAIL, 9, -2, 11, chunkBB);
+ placeBlock(level, Tile::stoneBrick_Id, SmoothStoneBrickTile::TYPE_DETAIL, 10, -2, 11, chunkBB);
placeBlock(level, Tile::lever_Id, LeverTile::getLeverFacing(getOrientationData(Tile::lever_Id, Facing::NORTH)), 8, -2, 12, chunkBB);
placeBlock(level, Tile::lever_Id, LeverTile::getLeverFacing(getOrientationData(Tile::lever_Id, Facing::NORTH)), 9, -2, 12, chunkBB);
placeBlock(level, Tile::lever_Id, LeverTile::getLeverFacing(getOrientationData(Tile::lever_Id, Facing::NORTH)), 10, -2, 12, chunkBB);
generateBox(level, chunkBB, 8, -3, 8, 8, -3, 10, false, random, &stoneSelector);
generateBox(level, chunkBB, 10, -3, 8, 10, -3, 10, false, random, &stoneSelector);
- placeBlock(level, Tile::mossStone_Id, 0, 10, -2, 9, chunkBB);
+ placeBlock(level, Tile::mossyCobblestone_Id, 0, 10, -2, 9, chunkBB);
placeBlock(level, Tile::redStoneDust_Id, 0, 8, -2, 9, chunkBB);
placeBlock(level, Tile::redStoneDust_Id, 0, 8, -2, 10, chunkBB);
placeBlock(level, Tile::redStoneDust_Id, 0, 10, -1, 9, chunkBB);
@@ -526,12 +632,117 @@ void ScatteredFeaturePieces::JunglePyramidPiece::MossStoneSelector::next(Random
{
if (random->nextFloat() < .4f)
{
- nextId = Tile::stoneBrick_Id;
+ nextId = Tile::cobblestone_Id;
}
else
{
- nextId = Tile::mossStone_Id;
+ nextId = Tile::mossyCobblestone_Id;
}
}
-ScatteredFeaturePieces::JunglePyramidPiece::MossStoneSelector ScatteredFeaturePieces::JunglePyramidPiece::stoneSelector; \ No newline at end of file
+ScatteredFeaturePieces::JunglePyramidPiece::MossStoneSelector ScatteredFeaturePieces::JunglePyramidPiece::stoneSelector;
+
+ScatteredFeaturePieces::SwamplandHut::SwamplandHut()
+{
+ spawnedWitch = false;
+ // for reflection
+}
+
+ScatteredFeaturePieces::SwamplandHut::SwamplandHut(Random *random, int west, int north) : ScatteredFeaturePiece(random, west, 64, north, 7, 5, 9)
+{
+ spawnedWitch = false;
+}
+
+void ScatteredFeaturePieces::SwamplandHut::addAdditonalSaveData(CompoundTag *tag)
+{
+ ScatteredFeaturePiece::addAdditonalSaveData(tag);
+ tag->putBoolean(L"Witch", spawnedWitch);
+}
+
+void ScatteredFeaturePieces::SwamplandHut::readAdditonalSaveData(CompoundTag *tag)
+{
+ ScatteredFeaturePiece::readAdditonalSaveData(tag);
+ spawnedWitch = tag->getBoolean(L"Witch");
+}
+
+bool ScatteredFeaturePieces::SwamplandHut::postProcess(Level *level, Random *random, BoundingBox *chunkBB)
+{
+ if (!updateAverageGroundHeight(level, chunkBB, 0))
+ {
+ return false;
+ }
+
+ // floor and ceiling
+ generateBox(level, chunkBB, 1, 1, 1, 5, 1, 7, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false);
+ generateBox(level, chunkBB, 1, 4, 2, 5, 4, 7, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false);
+ generateBox(level, chunkBB, 2, 1, 0, 4, 1, 0, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false);
+
+ // walls
+ generateBox(level, chunkBB, 2, 2, 2, 3, 3, 2, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false);
+ generateBox(level, chunkBB, 1, 2, 3, 1, 3, 6, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false);
+ generateBox(level, chunkBB, 5, 2, 3, 5, 3, 6, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false);
+ generateBox(level, chunkBB, 2, 2, 7, 4, 3, 7, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false);
+
+ // pillars
+ generateBox(level, chunkBB, 1, 0, 2, 1, 3, 2, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false);
+ generateBox(level, chunkBB, 5, 0, 2, 5, 3, 2, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false);
+ generateBox(level, chunkBB, 1, 0, 7, 1, 3, 7, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false);
+ generateBox(level, chunkBB, 5, 0, 7, 5, 3, 7, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false);
+
+ // windows
+ placeBlock(level, Tile::fence_Id, 0, 2, 3, 2, chunkBB);
+ placeBlock(level, Tile::fence_Id, 0, 3, 3, 7, chunkBB);
+ placeBlock(level, 0, 0, 1, 3, 4, chunkBB);
+ placeBlock(level, 0, 0, 5, 3, 4, chunkBB);
+ placeBlock(level, 0, 0, 5, 3, 5, chunkBB);
+ placeBlock(level, Tile::flowerPot_Id, FlowerPotTile::TYPE_MUSHROOM_RED, 1, 3, 5, chunkBB);
+
+ // decoration
+ placeBlock(level, Tile::workBench_Id, 0, 3, 2, 6, chunkBB);
+ placeBlock(level, Tile::cauldron_Id, 0, 4, 2, 6, chunkBB);
+
+ // front railings
+ placeBlock(level, Tile::fence_Id, 0, 1, 2, 1, chunkBB);
+ placeBlock(level, Tile::fence_Id, 0, 5, 2, 1, chunkBB);
+ // placeBlock(level, Tile.torch.id, 0, 1, 3, 1, chunkBB);
+ // placeBlock(level, Tile.torch.id, 0, 5, 3, 1, chunkBB);
+
+ // ceiling edges
+ int south = getOrientationData(Tile::stairs_wood_Id, StairTile::DIR_NORTH);
+ int east = getOrientationData(Tile::stairs_wood_Id, StairTile::DIR_WEST);
+ int west = getOrientationData(Tile::stairs_wood_Id, StairTile::DIR_EAST);
+ int north = getOrientationData(Tile::stairs_wood_Id, StairTile::DIR_SOUTH);
+
+ generateBox(level, chunkBB, 0, 4, 1, 6, 4, 1, Tile::stairs_sprucewood_Id, south, Tile::stairs_sprucewood_Id, south, false);
+ generateBox(level, chunkBB, 0, 4, 2, 0, 4, 7, Tile::stairs_sprucewood_Id, west, Tile::stairs_sprucewood_Id, west, false);
+ generateBox(level, chunkBB, 6, 4, 2, 6, 4, 7, Tile::stairs_sprucewood_Id, east, Tile::stairs_sprucewood_Id, east, false);
+ generateBox(level, chunkBB, 0, 4, 8, 6, 4, 8, Tile::stairs_sprucewood_Id, north, Tile::stairs_sprucewood_Id, north, false);
+
+ // fill pillars down to solid ground
+ for (int z = 2; z <= 7; z += 5)
+ {
+ for (int x = 1; x <= 5; x += 4)
+ {
+ fillColumnDown(level, Tile::treeTrunk_Id, 0, x, -1, z, chunkBB);
+ }
+ }
+
+ if (!spawnedWitch)
+ {
+ int wx = getWorldX(2, 5);
+ int wy = getWorldY(2);
+ int wz = getWorldZ(2, 5);
+
+ if (chunkBB->isInside(wx, wy, wz))
+ {
+ spawnedWitch = true;
+
+ shared_ptr<Witch> witch = shared_ptr<Witch>( new Witch(level) );
+ witch->moveTo(wx + .5, wy, wz + .5, 0, 0);
+ witch->finalizeMobSpawn(NULL);
+ level->addEntity(witch);
+ }
+ }
+
+ return true;
+} \ No newline at end of file