summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-06 19:03:28 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-06 19:03:28 +0200
commit98afdb03a8ed5fa164af948dc7c882f0eb80b97b (patch)
treec5ee4b98dbf168b30e6959f516d7080641ca91c7
parentMineShafts: made cobwebs less thick (diff)
downloadcuberite-98afdb03a8ed5fa164af948dc7c882f0eb80b97b.tar
cuberite-98afdb03a8ed5fa164af948dc7c882f0eb80b97b.tar.gz
cuberite-98afdb03a8ed5fa164af948dc7c882f0eb80b97b.tar.bz2
cuberite-98afdb03a8ed5fa164af948dc7c882f0eb80b97b.tar.lz
cuberite-98afdb03a8ed5fa164af948dc7c882f0eb80b97b.tar.xz
cuberite-98afdb03a8ed5fa164af948dc7c882f0eb80b97b.tar.zst
cuberite-98afdb03a8ed5fa164af948dc7c882f0eb80b97b.zip
Diffstat (limited to '')
-rw-r--r--source/Generating/MineShafts.cpp45
1 files changed, 44 insertions, 1 deletions
diff --git a/source/Generating/MineShafts.cpp b/source/Generating/MineShafts.cpp
index 3652e58b8..330a87576 100644
--- a/source/Generating/MineShafts.cpp
+++ b/source/Generating/MineShafts.cpp
@@ -149,6 +149,9 @@ protected:
/// If this corridor has tracks, places them randomly
void PlaceTracks(cChunkDesc & a_ChunkDesc);
+ /// If this corridor has a spawner, places the spawner
+ void PlaceSpawner(cChunkDesc & a_ChunkDesc);
+
/// Randomly places torches around the central beam block
void PlaceTorches(cChunkDesc & a_ChunkDesc);
} ;
@@ -651,9 +654,11 @@ void cMineShaftCorridor::ProcessChunk(cChunkDesc & a_ChunkDesc)
a_ChunkDesc.RandomFillRelCuboid(Top, E_BLOCK_AIR, 0, BlockX ^ BlockZ + BlockX, 8000);
if (m_SpawnerPosition >= 0)
{
+ // Cobwebs around the spider spawner
a_ChunkDesc.RandomFillRelCuboid(RelBoundingBox, E_BLOCK_COBWEB, 0, BlockX ^ BlockZ + BlockZ, 8000);
a_ChunkDesc.RandomFillRelCuboid(Top, E_BLOCK_COBWEB, 0, BlockX ^ BlockZ + BlockX, 5000);
}
+ a_ChunkDesc.RandomFillRelCuboid(Top, E_BLOCK_COBWEB, 0, BlockX ^ BlockZ + BlockX + 10, 500);
RelBoundingBox.p1.y = m_BoundingBox.p1.y;
RelBoundingBox.p2.y = m_BoundingBox.p1.y;
a_ChunkDesc.FloorRelCuboid(RelBoundingBox, E_BLOCK_PLANKS, 0);
@@ -732,7 +737,7 @@ void cMineShaftCorridor::ProcessChunk(cChunkDesc & a_ChunkDesc)
PlaceChest(a_ChunkDesc);
PlaceTracks(a_ChunkDesc);
- // TODO: Place spawner (must be after Tracks!
+ PlaceSpawner(a_ChunkDesc); // (must be after Tracks!)
PlaceTorches(a_ChunkDesc);
}
@@ -826,6 +831,44 @@ void cMineShaftCorridor::PlaceTracks(cChunkDesc & a_ChunkDesc)
+void cMineShaftCorridor::PlaceSpawner(cChunkDesc & a_ChunkDesc)
+{
+ if (m_SpawnerPosition < 0)
+ {
+ // No spawner in this corridor
+ return;
+ }
+ int SpawnerRelX = m_BoundingBox.p1.x + 1 - a_ChunkDesc.GetChunkX() * cChunkDef::Width;
+ int SpawnerRelZ = m_BoundingBox.p1.z + 1 - a_ChunkDesc.GetChunkZ() * cChunkDef::Width;
+ switch (m_Direction)
+ {
+ case dirXM:
+ case dirXP:
+ {
+ SpawnerRelX += m_SpawnerPosition - 1;
+ break;
+ }
+ case dirZM:
+ case dirZP:
+ {
+ SpawnerRelZ += m_SpawnerPosition - 1;
+ break;
+ }
+ }
+ if (
+ (SpawnerRelX >= 0) && (SpawnerRelX < cChunkDef::Width) &&
+ (SpawnerRelZ >= 0) && (SpawnerRelZ < cChunkDef::Width)
+ )
+ {
+ a_ChunkDesc.SetBlockTypeMeta(SpawnerRelX, m_BoundingBox.p1.y + 1, SpawnerRelZ, E_BLOCK_MOB_SPAWNER, 0);
+ // TODO: The spawner needs its accompanying cMobSpawnerEntity, when implemented
+ }
+}
+
+
+
+
+
void cMineShaftCorridor::PlaceTorches(cChunkDesc & a_ChunkDesc)
{
cNoise Noise(m_BoundingBox.p1.x);