diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-05-10 16:43:06 +0200 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-05-10 16:43:06 +0200 |
commit | 3b1f11bd6abff2e146135dc000855cf1269715fd (patch) | |
tree | b8cc97dfbe4012b7139ccaa6cf2c1653f23ca820 | |
parent | Merge pull request #992 from mc-server/coverity_fixes (diff) | |
download | cuberite-3b1f11bd6abff2e146135dc000855cf1269715fd.tar cuberite-3b1f11bd6abff2e146135dc000855cf1269715fd.tar.gz cuberite-3b1f11bd6abff2e146135dc000855cf1269715fd.tar.bz2 cuberite-3b1f11bd6abff2e146135dc000855cf1269715fd.tar.lz cuberite-3b1f11bd6abff2e146135dc000855cf1269715fd.tar.xz cuberite-3b1f11bd6abff2e146135dc000855cf1269715fd.tar.zst cuberite-3b1f11bd6abff2e146135dc000855cf1269715fd.zip |
-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..9f78f230e 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(500) != 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::eType::mtZombiePigman); + } virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { |