summaryrefslogtreecommitdiffstats
path: root/source/cWorld.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/cWorld.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/cWorld.cpp51
1 files changed, 44 insertions, 7 deletions
diff --git a/source/cWorld.cpp b/source/cWorld.cpp
index 91b7b69bc..5cb9c5f0d 100644
--- a/source/cWorld.cpp
+++ b/source/cWorld.cpp
@@ -938,6 +938,48 @@ char cWorld::GetBlockSkyLight( int a_X, int a_Y, int a_Z )
+void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_FlyAwaySpeed)
+{
+ MTRand r1;
+ a_FlyAwaySpeed /= 1000; // Pre-divide, so that we can don't have to divide each time inside the loop
+ for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr)
+ {
+ float SpeedX = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500));
+ float SpeedY = (float)(a_FlyAwaySpeed * r1.randInt(1000));
+ float SpeedZ = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500));
+ cPickup * Pickup = new cPickup(
+ (int)(a_BlockX * 32) + r1.randInt(16) + r1.randInt(16),
+ (int)(a_BlockY * 32) + r1.randInt(16) + r1.randInt(16),
+ (int)(a_BlockZ * 32) + r1.randInt(16) + r1.randInt(16),
+ *itr, SpeedX, SpeedY, SpeedZ
+ );
+ Pickup->Initialize(this);
+ }
+}
+
+
+
+
+
+void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ)
+{
+ MTRand r1;
+ for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr)
+ {
+ cPickup * Pickup = new cPickup(
+ (int)(a_BlockX * 32) + r1.randInt(16) + r1.randInt(16),
+ (int)(a_BlockY * 32) + r1.randInt(16) + r1.randInt(16),
+ (int)(a_BlockZ * 32) + r1.randInt(16) + r1.randInt(16),
+ *itr, (float)a_SpeedX, (float)a_SpeedY, (float)a_SpeedZ
+ );
+ Pickup->Initialize(this);
+ }
+}
+
+
+
+
+
void cWorld::ReplaceBlocks(const sSetBlockVector & a_Blocks, BLOCKTYPE a_FilterBlockType)
{
m_ChunkMap->ReplaceBlocks(a_Blocks, a_FilterBlockType);
@@ -956,14 +998,9 @@ bool cWorld::GetBlocks(sSetBlockVector & a_Blocks, bool a_ContinueOnFailure)
-bool cWorld::DigBlock( int a_X, int a_Y, int a_Z, cItem & a_PickupItem )
+bool cWorld::DigBlock( int a_X, int a_Y, int a_Z)
{
- bool res = m_ChunkMap->DigBlock(a_X, a_Y, a_Z, a_PickupItem);
- if (res)
- {
- GetSimulatorManager()->WakeUp(a_X, a_Y, a_Z);
- }
- return res;
+ return m_ChunkMap->DigBlock(a_X, a_Y, a_Z);
}