diff options
author | Mattes D <github@xoft.cz> | 2014-05-10 17:24:35 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-05-10 17:24:35 +0200 |
commit | ba847421bb1f00ace5e6ecd9e6b9e48b125511d1 (patch) | |
tree | 6919ab334a8830af252e9b3046fe623d46a9dd62 /src | |
parent | Merge pull request #992 from mc-server/coverity_fixes (diff) | |
parent | Fixed compile problem. (diff) | |
download | cuberite-ba847421bb1f00ace5e6ecd9e6b9e48b125511d1.tar cuberite-ba847421bb1f00ace5e6ecd9e6b9e48b125511d1.tar.gz cuberite-ba847421bb1f00ace5e6ecd9e6b9e48b125511d1.tar.bz2 cuberite-ba847421bb1f00ace5e6ecd9e6b9e48b125511d1.tar.lz cuberite-ba847421bb1f00ace5e6ecd9e6b9e48b125511d1.tar.xz cuberite-ba847421bb1f00ace5e6ecd9e6b9e48b125511d1.tar.zst cuberite-ba847421bb1f00ace5e6ecd9e6b9e48b125511d1.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Blocks/BlockPortal.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Blocks/BlockPortal.h b/src/Blocks/BlockPortal.h index 21bcbdeea..3b8030028 100644 --- a/src/Blocks/BlockPortal.h +++ b/src/Blocks/BlockPortal.h @@ -2,6 +2,7 @@ #pragma once #include "BlockHandler.h" +#include "../Mobs/Monster.h" @@ -38,6 +39,19 @@ public: return; // No pickups } + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + { + cFastRandom Random; + if (Random.NextInt(2000) != 0) + { + return; + } + + int PosX = a_Chunk.GetPosX() * 16 + a_RelX; + int PosZ = a_Chunk.GetPosZ() * 16 + a_RelZ; + + a_WorldInterface.SpawnMob(PosX, a_RelY, PosZ, cMonster::mtZombiePigman); + } virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { |