summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2013-12-22 20:40:07 +0100
committerSTRWarrior <niels.breuker@hotmail.nl>2013-12-22 20:40:07 +0100
commit5a9b26d3226c86bef212b080ed2ffcd2129567ba (patch)
treec67d10f006e61fcb7ada27d57ea3e99897adcbd2 /src/Mobs
parentYou can spawn snow golems with snow blocks and pumpkins. (diff)
downloadcuberite-5a9b26d3226c86bef212b080ed2ffcd2129567ba.tar
cuberite-5a9b26d3226c86bef212b080ed2ffcd2129567ba.tar.gz
cuberite-5a9b26d3226c86bef212b080ed2ffcd2129567ba.tar.bz2
cuberite-5a9b26d3226c86bef212b080ed2ffcd2129567ba.tar.lz
cuberite-5a9b26d3226c86bef212b080ed2ffcd2129567ba.tar.xz
cuberite-5a9b26d3226c86bef212b080ed2ffcd2129567ba.tar.zst
cuberite-5a9b26d3226c86bef212b080ed2ffcd2129567ba.zip
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/SnowGolem.cpp17
-rw-r--r--src/Mobs/SnowGolem.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/src/Mobs/SnowGolem.cpp b/src/Mobs/SnowGolem.cpp
index 9e199f87e..e16b526ad 100644
--- a/src/Mobs/SnowGolem.cpp
+++ b/src/Mobs/SnowGolem.cpp
@@ -2,6 +2,7 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "SnowGolem.h"
+#include "../World.h"
@@ -24,3 +25,19 @@ void cSnowGolem::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+
+void cSnowGolem::Tick(float a_Dt, cChunk & a_Chunk)
+{
+ super::Tick(a_Dt, a_Chunk);
+ if (IsBiomeNoDownfall((EMCSBiome) m_World->GetBiomeAt((int) floor(GetPosX()), (int) floor(GetPosZ())) ))
+ {
+ TakeDamage(*this);
+ }
+ else
+ {
+ if (g_BlockIsSolid[m_World->GetBlock((int) floor(GetPosX()), (int) floor(GetPosY()) - 1, (int) floor(GetPosZ()))])
+ {
+ m_World->SetBlock((int) floor(GetPosX()), (int) floor(GetPosY()), (int) floor(GetPosZ()), E_BLOCK_SNOW, 0);
+ }
+ }
+}
diff --git a/src/Mobs/SnowGolem.h b/src/Mobs/SnowGolem.h
index d1344adfd..ff5e90da8 100644
--- a/src/Mobs/SnowGolem.h
+++ b/src/Mobs/SnowGolem.h
@@ -17,6 +17,7 @@ public:
CLASS_PROTODEF(cSnowGolem);
+ virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;