summaryrefslogtreecommitdiffstats
path: root/source/Chunk.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-11-14 15:37:09 +0100
committermadmaxoft <github@xoft.cz>2013-11-14 15:37:09 +0100
commit082573771f469cfaef03d22e4281f207beef36c8 (patch)
treeac17ff48476205939d8b943eee2a7667c4b66ff1 /source/Chunk.cpp
parentMerge pull request #344 from marmot21/playerxp (diff)
downloadcuberite-082573771f469cfaef03d22e4281f207beef36c8.tar
cuberite-082573771f469cfaef03d22e4281f207beef36c8.tar.gz
cuberite-082573771f469cfaef03d22e4281f207beef36c8.tar.bz2
cuberite-082573771f469cfaef03d22e4281f207beef36c8.tar.lz
cuberite-082573771f469cfaef03d22e4281f207beef36c8.tar.xz
cuberite-082573771f469cfaef03d22e4281f207beef36c8.tar.zst
cuberite-082573771f469cfaef03d22e4281f207beef36c8.zip
Diffstat (limited to '')
-rw-r--r--source/Chunk.cpp91
1 files changed, 5 insertions, 86 deletions
diff --git a/source/Chunk.cpp b/source/Chunk.cpp
index cfdcc783c..1c937c894 100644
--- a/source/Chunk.cpp
+++ b/source/Chunk.cpp
@@ -1261,75 +1261,22 @@ void cChunk::CreateBlockEntities(void)
switch (BlockType)
{
case E_BLOCK_CHEST:
- {
- if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width))
- {
- m_BlockEntities.push_back(new cChestEntity(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World));
- }
- break;
- }
-
case E_BLOCK_DISPENSER:
- {
- if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width))
- {
- m_BlockEntities.push_back(new cDispenserEntity(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World));
- }
- break;
- }
-
case E_BLOCK_DROPPER:
- {
- if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width))
- {
- m_BlockEntities.push_back(new cDropperEntity(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World));
- }
- break;
- }
-
case E_BLOCK_LIT_FURNACE:
case E_BLOCK_FURNACE:
- {
- if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width))
- {
- NIBBLETYPE BlockMeta = cChunkDef::GetNibble(m_BlockMeta, x, y, z);
- m_BlockEntities.push_back(new cFurnaceEntity(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, BlockType, BlockMeta, m_World));
- }
- break;
- }
-
case E_BLOCK_HOPPER:
- {
- if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width))
- {
- m_BlockEntities.push_back(new cHopperEntity(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World));
- }
- }
-
case E_BLOCK_SIGN_POST:
case E_BLOCK_WALLSIGN:
- {
- if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width))
- {
- m_BlockEntities.push_back( new cSignEntity(BlockType, x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World));
- }
- break;
- }
-
case E_BLOCK_NOTE_BLOCK:
- {
- if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width))
- {
- m_BlockEntities.push_back(new cNoteEntity(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World));
- }
- break;
- }
-
case E_BLOCK_JUKEBOX:
{
if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width))
{
- m_BlockEntities.push_back(new cJukeboxEntity(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World));
+ m_BlockEntities.push_back(cBlockEntity::CreateByBlockType(
+ BlockType, GetMeta(x, y, z),
+ x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World
+ ));
}
break;
}
@@ -1426,45 +1373,17 @@ void cChunk::SetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType,
switch (a_BlockType)
{
case E_BLOCK_CHEST:
- {
- AddBlockEntity(new cChestEntity(WorldPos.x, WorldPos.y, WorldPos.z, m_World));
- break;
- }
case E_BLOCK_DISPENSER:
- {
- AddBlockEntity(new cDispenserEntity(WorldPos.x, WorldPos.y, WorldPos.z, m_World));
- break;
- }
case E_BLOCK_DROPPER:
- {
- AddBlockEntity(new cDropperEntity(WorldPos.x, WorldPos.y, WorldPos.z, m_World));
- break;
- }
case E_BLOCK_LIT_FURNACE:
case E_BLOCK_FURNACE:
- {
- AddBlockEntity(new cFurnaceEntity(WorldPos.x, WorldPos.y, WorldPos.z, a_BlockType, a_BlockMeta, m_World));
- break;
- }
case E_BLOCK_HOPPER:
- {
- AddBlockEntity(new cHopperEntity(WorldPos.x, WorldPos.y, WorldPos.z, m_World));
- break;
- }
case E_BLOCK_SIGN_POST:
case E_BLOCK_WALLSIGN:
- {
- AddBlockEntity(new cSignEntity(a_BlockType, WorldPos.x, WorldPos.y, WorldPos.z, m_World));
- break;
- }
case E_BLOCK_NOTE_BLOCK:
- {
- AddBlockEntity(new cNoteEntity(WorldPos.x, WorldPos.y, WorldPos.z, m_World));
- break;
- }
case E_BLOCK_JUKEBOX:
{
- AddBlockEntity(new cJukeboxEntity(WorldPos.x, WorldPos.y, WorldPos.z, m_World));
+ AddBlockEntity(cBlockEntity::CreateByBlockType(a_BlockType, a_BlockMeta, WorldPos.x, WorldPos.y, WorldPos.z, m_World));
break;
}
} // switch (a_BlockType)