diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-05-10 18:55:43 +0200 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-05-10 18:55:43 +0200 |
commit | 43fc1471a15e0f8b3da75c7adade84daf70641b6 (patch) | |
tree | 14b42982f47588291a4d4b8cf387586a30c612d5 /src/Blocks/BlockPortal.h | |
parent | Fail build on error (diff) | |
parent | Fixed the console saying no plugins are loaded. (diff) | |
download | cuberite-43fc1471a15e0f8b3da75c7adade84daf70641b6.tar cuberite-43fc1471a15e0f8b3da75c7adade84daf70641b6.tar.gz cuberite-43fc1471a15e0f8b3da75c7adade84daf70641b6.tar.bz2 cuberite-43fc1471a15e0f8b3da75c7adade84daf70641b6.tar.lz cuberite-43fc1471a15e0f8b3da75c7adade84daf70641b6.tar.xz cuberite-43fc1471a15e0f8b3da75c7adade84daf70641b6.tar.zst cuberite-43fc1471a15e0f8b3da75c7adade84daf70641b6.zip |
Diffstat (limited to 'src/Blocks/BlockPortal.h')
-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 { |