From 26ac146f41091dc070d8075f5fc9de25b5a22578 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 17 Apr 2020 11:36:37 +0200 Subject: More Vector3 in cBlockHandler (#4644) * cBlockHandler.OnUpdate uses Vector3 params. Also slightly changed how block ticking works. --- src/Blocks/BlockPlant.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/Blocks/BlockPlant.h') diff --git a/src/Blocks/BlockPlant.h b/src/Blocks/BlockPlant.h index 589619b26..b0760528c 100644 --- a/src/Blocks/BlockPlant.h +++ b/src/Blocks/BlockPlant.h @@ -26,20 +26,25 @@ public: - virtual void OnUpdate(cChunkInterface & a_ChunkInterface, 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 { - Vector3i relPos(a_RelX, a_RelY, a_RelZ); - auto action = CanGrow(a_Chunk, relPos); - switch (action) + auto Action = CanGrow(a_Chunk, a_RelPos); + switch (Action) { case paGrowth: { - Grow(a_Chunk, relPos); + Grow(a_Chunk, a_RelPos); break; } case paDeath: { - a_ChunkInterface.DigBlock(a_WorldInterface, a_Chunk.RelativeToAbsolute(relPos)); + a_ChunkInterface.DigBlock(a_WorldInterface, a_Chunk.RelativeToAbsolute(a_RelPos)); break; } case paStay: break; // do nothing -- cgit v1.2.3