summaryrefslogtreecommitdiffstats
path: root/source/Blocks/BlockHandler.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-09-19 22:46:39 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-09-19 22:46:39 +0200
commit0c58adb2b440a68ffdfd2967d21019912d390108 (patch)
tree35bc3e70fbd57663e49242d33c60397cb66fa8e9 /source/Blocks/BlockHandler.cpp
parentImplemented xoft's suggestions (diff)
downloadcuberite-0c58adb2b440a68ffdfd2967d21019912d390108.tar
cuberite-0c58adb2b440a68ffdfd2967d21019912d390108.tar.gz
cuberite-0c58adb2b440a68ffdfd2967d21019912d390108.tar.bz2
cuberite-0c58adb2b440a68ffdfd2967d21019912d390108.tar.lz
cuberite-0c58adb2b440a68ffdfd2967d21019912d390108.tar.xz
cuberite-0c58adb2b440a68ffdfd2967d21019912d390108.tar.zst
cuberite-0c58adb2b440a68ffdfd2967d21019912d390108.zip
Diffstat (limited to 'source/Blocks/BlockHandler.cpp')
-rw-r--r--source/Blocks/BlockHandler.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp
index 7d896f1b6..b06171119 100644
--- a/source/Blocks/BlockHandler.cpp
+++ b/source/Blocks/BlockHandler.cpp
@@ -361,16 +361,17 @@ void cBlockHandler::DropBlock(cWorld * a_World, cEntity * a_Digger, int a_BlockX
MTRand r1;
// Mid-block position first
- int MicroX = (int)(floor(a_BlockX) * 32) + 16;
- int MicroY = (int)(floor(a_BlockY) * 32) + 16;
- int MicroZ = (int)(floor(a_BlockZ) * 32) + 16;
+ double MicroX, MicroY, MicroZ;
+ MicroX = a_BlockX + 0.5;
+ MicroY = a_BlockY + 0.5;
+ MicroZ = a_BlockZ + 0.5;
- // Add random offset second
- MicroX = (int)(a_BlockX * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
- MicroY = (int)(a_BlockY * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
- MicroZ = (int)(a_BlockZ * 32) + (r1.randInt(16) + r1.randInt(16) - 16);
+ // Add random offset second (this causes pickups to spawn inside blocks most times, it's a little buggy)
+ //MicroX += (int)(r1.randInt(16) + r1.randInt(16) - 16);
+ //MicroY += (int)(r1.randInt(16) + r1.randInt(16) - 16);
+ //MicroZ += (int)(r1.randInt(16) + r1.randInt(16) - 16);
- a_World->SpawnItemPickups(Pickups, a_BlockX, a_BlockY, a_BlockZ);
+ a_World->SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ);
}
}