diff options
Diffstat (limited to 'src/Blocks/BlockPortal.h')
-rw-r--r-- | src/Blocks/BlockPortal.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/Blocks/BlockPortal.h b/src/Blocks/BlockPortal.h index 852a231b6..3f5d87155 100644 --- a/src/Blocks/BlockPortal.h +++ b/src/Blocks/BlockPortal.h @@ -46,18 +46,26 @@ public: - virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate( + cChunkInterface & a_ChunkInterface, + cWorldInterface & a_WorldInterface, + cBlockPluginInterface & a_PluginInterface, + cChunk & a_Chunk, + const Vector3i a_RelPos + ) override { + // Spawn zombie pigmen with a 0.05% chance: if (GetRandomProvider().RandBool(0.9995)) { return; } + auto WorldPos = a_Chunk.RelativeToAbsolute(a_RelPos); + a_WorldInterface.SpawnMob(WorldPos.x, WorldPos.y, WorldPos.z, mtZombiePigman, false); + } + + - int PosX = a_Chunk.GetPosX() * cChunkDef::Width + a_RelX; - int PosZ = a_Chunk.GetPosZ() * cChunkDef::Width + a_RelZ; - a_WorldInterface.SpawnMob(PosX, a_RelY, PosZ, mtZombiePigman, false); - } virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { |