summaryrefslogtreecommitdiffstats
path: root/source/Chunk.cpp
diff options
context:
space:
mode:
authormgueydan <gueydan.mathieuÃ@gmail.com>2013-09-08 00:11:38 +0200
committermgueydan <gueydan.mathieuÃ@gmail.com>2013-09-08 00:11:38 +0200
commitbf1fb0aa3dbd5b6b793d920c4e301e4782fe0f0f (patch)
tree9c47274f2e308991d15422dcf515710c28fc5ab7 /source/Chunk.cpp
parentAdding mob census (sorry this is a big commit as work was done before git integration i couldn't split it more) (diff)
downloadcuberite-bf1fb0aa3dbd5b6b793d920c4e301e4782fe0f0f.tar
cuberite-bf1fb0aa3dbd5b6b793d920c4e301e4782fe0f0f.tar.gz
cuberite-bf1fb0aa3dbd5b6b793d920c4e301e4782fe0f0f.tar.bz2
cuberite-bf1fb0aa3dbd5b6b793d920c4e301e4782fe0f0f.tar.lz
cuberite-bf1fb0aa3dbd5b6b793d920c4e301e4782fe0f0f.tar.xz
cuberite-bf1fb0aa3dbd5b6b793d920c4e301e4782fe0f0f.tar.zst
cuberite-bf1fb0aa3dbd5b6b793d920c4e301e4782fe0f0f.zip
Diffstat (limited to 'source/Chunk.cpp')
-rw-r--r--source/Chunk.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/source/Chunk.cpp b/source/Chunk.cpp
index 59a65a537..35e44363e 100644
--- a/source/Chunk.cpp
+++ b/source/Chunk.cpp
@@ -31,6 +31,7 @@
#include "Blocks/BlockHandler.h"
#include "Simulator/FluidSimulator.h"
#include "MobCensus.h"
+#include "MobSpawner.h"
#include <json/json.h>
@@ -468,6 +469,42 @@ void cChunk::CollectMobCensus(cMobCensus& toFill)
+void cChunk::getThreeRandomNumber(int& a_X, int& a_Y, int& a_Z,int a_MaxX, int a_MaxY, int a_MaxZ)
+{
+ assert(a_MaxX * a_MaxY * a_MaxZ * 8 < 0x00ffffff);
+ int Random = m_World->GetTickRandomNumber(0x00ffffff);
+ a_X = Random % (a_MaxX * 2);
+ a_Y = (Random / (a_MaxX * 2)) % (a_MaxY * 2);
+ a_Z = ((Random / (a_MaxX * 2)) / (a_MaxY * 2)) % (a_MaxZ * 2);
+ a_X /= 2;
+ a_Y /= 2;
+ a_Z /= 2;
+}
+
+
+
+
+
+void cChunk::getRandomBlock(int& a_X, int& a_Y, int& a_Z)
+{
+ // MG TODO : check if this kind of optimization (only one random call) is still needed
+ // MG TODO : if so propagate it
+
+ getThreeRandomNumber(a_X, a_Y, a_Z, Width, Height-2, Width);
+ a_Y++;
+}
+
+
+
+
+
+void cChunk::SpawnMobs(cMobSpawner& a_MobSpawner)
+{
+}
+
+
+
+
void cChunk::Tick(float a_Dt)
{