summaryrefslogtreecommitdiffstats
path: root/source/Generating/MineShafts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Generating/MineShafts.cpp')
-rw-r--r--source/Generating/MineShafts.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/Generating/MineShafts.cpp b/source/Generating/MineShafts.cpp
index 3131b5429..159e6b4ea 100644
--- a/source/Generating/MineShafts.cpp
+++ b/source/Generating/MineShafts.cpp
@@ -794,12 +794,12 @@ void cMineShaftCorridor::PlaceChest(cChunkDesc & a_ChunkDesc)
)
{
a_ChunkDesc.SetBlockTypeMeta(x, m_BoundingBox.p1.y + 1, z, E_BLOCK_CHEST, Meta);
- cChestEntity * ChestEntity = new cChestEntity(BlockX + x, m_BoundingBox.p1.y + 1, BlockZ + z);
+ cChestEntity * ChestEntity = (cChestEntity *)a_ChunkDesc.GetBlockEntity(x, m_BoundingBox.p1.y + 1, z);
+ ASSERT((ChestEntity != NULL) && (ChestEntity->GetBlockType() == E_BLOCK_CHEST));
cNoise Noise(a_ChunkDesc.GetChunkX() ^ a_ChunkDesc.GetChunkZ());
int NumSlots = 3 + ((Noise.IntNoise3DInt(x, m_BoundingBox.p1.y, z) / 11) % 4);
int Seed = Noise.IntNoise2DInt(x, z);
ChestEntity->GetContents().GenerateRandomLootWithBooks(LootProbab, ARRAYCOUNT(LootProbab), NumSlots, Seed);
- a_ChunkDesc.AddBlockEntity(ChestEntity);
}
}