diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-09-19 22:46:39 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-09-19 22:46:39 +0200 |
commit | 0c58adb2b440a68ffdfd2967d21019912d390108 (patch) | |
tree | 35bc3e70fbd57663e49242d33c60397cb66fa8e9 /source/Blocks | |
parent | Implemented xoft's suggestions (diff) | |
download | cuberite-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 '')
-rw-r--r-- | source/Blocks/BlockHandler.cpp | 17 |
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); } } |