summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Endermite.cpp
diff options
context:
space:
mode:
authorDebucquoy Anthony tonitch <debucquoy.anthony@gmail.com>2023-09-26 23:54:37 +0200
committerGitHub <noreply@github.com>2023-09-26 23:54:37 +0200
commit7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97 (patch)
tree62ce535a26ad0637564de14ad7b75429537162a7 /src/Mobs/Endermite.cpp
parentUpdate Core (diff)
downloadcuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.tar
cuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.tar.gz
cuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.tar.bz2
cuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.tar.lz
cuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.tar.xz
cuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.tar.zst
cuberite-7db4e20fd7ee7cf1c25d5c2c5e9e1b1cf97d4c97.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Endermite.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/Mobs/Endermite.cpp b/src/Mobs/Endermite.cpp
new file mode 100644
index 000000000..3a89de98a
--- /dev/null
+++ b/src/Mobs/Endermite.cpp
@@ -0,0 +1,41 @@
+
+#include "Globals.h"
+
+#include "Endermite.h"
+
+#include "../World.h"
+#include "../Chunk.h"
+#include "../Blocks/BlockHandler.h"
+#include "../Blocks/BlockInfested.h"
+
+
+
+
+
+cEndermite::cEndermite() :
+ Super("Endermite", mtEndermite, "entity.endermite.hurt", "entity.endermite.death", "entity.endermite.ambient", 0.4f, 0.3f),
+ m_Timer(0),
+ m_Lifetime(2 * 1000 * 60) // 2 minutes (2 * 1000 (mili to sec) * 60 (sec to min) * 2 because tick = 0.5 sec)
+{
+}
+
+
+
+
+
+void cEndermite::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
+{
+ Super::Tick(a_Dt, a_Chunk);
+
+ // Not destroying the endermite if a name is set
+ if (m_CustomName.empty())
+ {
+ m_Timer += a_Dt;
+ // Destroy the endermite after 2 minutes
+ if (m_Timer > m_Lifetime)
+ {
+ Destroy();
+ }
+
+ }
+}