summaryrefslogtreecommitdiffstats
path: root/source/cChunk.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-06 22:18:50 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-06 22:18:50 +0200
commit1cca9b13b3d320ff767cfc552413265b2ef6e0d6 (patch)
treec1227f3f4141dbf2f85767a65cb9d2102a9d4010 /source/cChunk.cpp
parentBlockIDs, ItemIDs and Metas updated, courtesy of Taugeshtu (diff)
downloadcuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar
cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.gz
cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.bz2
cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.lz
cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.xz
cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.zst
cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.zip
Diffstat (limited to '')
-rw-r--r--source/cChunk.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/source/cChunk.cpp b/source/cChunk.cpp
index c918c589e..6d260e5b1 100644
--- a/source/cChunk.cpp
+++ b/source/cChunk.cpp
@@ -419,7 +419,8 @@ void cChunk::Tick(float a_Dt, MTRand & a_TickRandom)
unsigned int index = (*itr);
Vector3i BlockPos = IndexToCoordinate( index );
- char BlockID = GetBlock( index );
+ BLOCKTYPE BlockID = GetBlock( index );
+ NIBBLETYPE BlockMeta = GetMeta(index);
switch ( BlockID )
{
case E_BLOCK_REDSTONE_REPEATER_OFF:
@@ -443,16 +444,17 @@ void cChunk::Tick(float a_Dt, MTRand & a_TickRandom)
case E_BLOCK_RED_MUSHROOM:
case E_BLOCK_BROWN_MUSHROOM: // Stuff that drops when block below is destroyed
{
- if( GetBlock( BlockPos.x, BlockPos.y-1, BlockPos.z ) == E_BLOCK_AIR )
+ if (GetBlock(BlockPos.x, BlockPos.y - 1, BlockPos.z) == E_BLOCK_AIR)
{
SetBlock( BlockPos, E_BLOCK_AIR, 0 );
Vector3i WorldPos = PositionToWorldPosition( BlockPos );
m_World->GetSimulatorManager()->WakeUp(WorldPos.x, WorldPos.y, WorldPos.z);
-
- cPickup* Pickup = new cPickup( WorldPos.x * 32 + 16, WorldPos.y * 32 + 16, WorldPos.z * 32 + 16, cItem( cBlockToPickup::ToPickup( (ENUM_ITEM_ID)BlockID, E_ITEM_EMPTY) , 1 ) );
- Pickup->Initialize( m_World );
+
+ cItems Pickups;
+ cBlockToPickup::ToPickup(BlockID, BlockMeta, E_ITEM_EMPTY, Pickups);
+ m_World->SpawnItemPickups(Pickups, WorldPos.x, WorldPos.y, WorldPos.z);
}
break;
}
@@ -477,8 +479,9 @@ void cChunk::Tick(float a_Dt, MTRand & a_TickRandom)
m_World->GetSimulatorManager()->WakeUp(WorldPos.x, WorldPos.y, WorldPos.z);
- cPickup* Pickup = new cPickup( WorldPos.x * 32 + 16, WorldPos.y * 32 + 16, WorldPos.z * 32 + 16, cItem( cBlockToPickup::ToPickup( (ENUM_ITEM_ID)BlockID, E_ITEM_EMPTY) , 1 ) );
- Pickup->Initialize( m_World );
+ cItems Pickups;
+ cBlockToPickup::ToPickup(BlockID, BlockMeta, E_ITEM_EMPTY, Pickups);
+ m_World->SpawnItemPickups(Pickups, WorldPos.x, WorldPos.y, WorldPos.z);
}
break;
}
@@ -492,8 +495,9 @@ void cChunk::Tick(float a_Dt, MTRand & a_TickRandom)
if( m_World->GetBlock( AttachedTo ) == E_BLOCK_AIR )
{
SetBlock( BlockPos, E_BLOCK_AIR, 0 );
- cPickup* Pickup = new cPickup( WorldPos.x * 32 + 16, WorldPos.y * 32 + 16, WorldPos.z * 32 + 16, cItem( (ENUM_ITEM_ID)BlockID, 1 ) );
- Pickup->Initialize( m_World );
+ cItems Pickups;
+ cBlockToPickup::ToPickup(BlockID, BlockMeta, E_ITEM_EMPTY, Pickups);
+ m_World->SpawnItemPickups(Pickups, WorldPos.x, WorldPos.y, WorldPos.z);
}
break;
}