mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-25 08:36:07 +00:00
TU19: merge Minecraft.World/WorldGen
This commit is contained in:
@@ -1,12 +1,31 @@
|
||||
#include "../../Platform/stdafx.h"
|
||||
#include "../../Headers/net.minecraft.h"
|
||||
#include "../../Headers/net.minecraft.world.entity.monster.h"
|
||||
#include "../../Headers/net.minecraft.world.item.h"
|
||||
#include "../../Headers/net.minecraft.world.level.dimension.h"
|
||||
#include "../../Headers/net.minecraft.world.level.h"
|
||||
#include "../../Headers/net.minecraft.world.level.tile.h"
|
||||
#include "../../Headers/net.minecraft.world.level.levelgen.structure.h"
|
||||
#include "../../Util/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)
|
||||
@@ -18,6 +37,16 @@ ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece(
|
||||
|
||||
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:
|
||||
case Direction::SOUTH:
|
||||
@@ -33,6 +62,22 @@ ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece(
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -67,8 +112,22 @@ WeighedTreasure* ScatteredFeaturePieces::DesertPyramidPiece::treasureItems
|
||||
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)
|
||||
@@ -79,6 +138,24 @@ ScatteredFeaturePieces::DesertPyramidPiece::DesertPyramidPiece(Random* random,
|
||||
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
|
||||
@@ -232,48 +309,48 @@ bool ScatteredFeaturePieces::DesertPyramidPiece::postProcess(
|
||||
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,
|
||||
@@ -284,30 +361,30 @@ bool ScatteredFeaturePieces::DesertPyramidPiece::postProcess(
|
||||
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,
|
||||
@@ -320,10 +397,10 @@ bool ScatteredFeaturePieces::DesertPyramidPiece::postProcess(
|
||||
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,
|
||||
@@ -390,6 +467,12 @@ WeighedTreasure* ScatteredFeaturePieces::JunglePyramidPiece::treasureItems
|
||||
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),
|
||||
// ...
|
||||
};
|
||||
|
||||
WeighedTreasure* ScatteredFeaturePieces::JunglePyramidPiece::dispenserItems
|
||||
@@ -398,6 +481,10 @@ WeighedTreasure* ScatteredFeaturePieces::JunglePyramidPiece::dispenserItems
|
||||
// new WeighedTreasure(Item.fireball.id, 0, 1, 1, 10),
|
||||
};
|
||||
|
||||
ScatteredFeaturePieces::JunglePyramidPiece::JunglePyramidPiece() {
|
||||
// for reflection
|
||||
}
|
||||
|
||||
ScatteredFeaturePieces::JunglePyramidPiece::JunglePyramidPiece(Random* random,
|
||||
int west,
|
||||
int north)
|
||||
@@ -408,6 +495,24 @@ ScatteredFeaturePieces::JunglePyramidPiece::JunglePyramidPiece(Random* random,
|
||||
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)) {
|
||||
@@ -593,7 +698,7 @@ bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(
|
||||
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,
|
||||
@@ -619,7 +724,7 @@ bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(
|
||||
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) {
|
||||
placedTrap2 = createDispenser(
|
||||
@@ -636,26 +741,26 @@ bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(
|
||||
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)),
|
||||
@@ -672,7 +777,7 @@ bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(
|
||||
&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);
|
||||
@@ -701,11 +806,136 @@ bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(
|
||||
void ScatteredFeaturePieces::JunglePyramidPiece::MossStoneSelector::next(
|
||||
Random* random, int worldX, int worldY, int worldZ, bool isEdge) {
|
||||
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;
|
||||
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;
|
||||
|
||||
std::shared_ptr<Witch> witch =
|
||||
std::shared_ptr<Witch>(new Witch(level));
|
||||
witch->moveTo(wx + .5, wy, wz + .5, 0, 0);
|
||||
witch->finalizeMobSpawn(NULL);
|
||||
level->addEntity(witch);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user