From bdedab15c94956cbc74045ab242fd300d25f39e7 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 9 Apr 2020 22:25:20 +0200 Subject: Falling blocks can now be spawned at any position. (#4620) * Falling blocks can now be spawned at any position. * Added a /cake command to Debuggers that throws a cake in a nice slow arc. * Fixed regular falling blocks. --- src/World.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/World.h') diff --git a/src/World.h b/src/World.h index b46440410..4b0947003 100644 --- a/src/World.h +++ b/src/World.h @@ -564,14 +564,22 @@ public: /** Spawns an falling block entity at the given position. Returns the UniqueID of the spawned falling block, or cEntity::INVALID_ID on failure. */ - UInt32 SpawnFallingBlock(Vector3i a_Pos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); + UInt32 SpawnFallingBlock(Vector3d a_Pos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); - /** OBSOLETE, use the Vector3i-based overload instead. + /** Spawns an falling block entity at the given position. + Returns the UniqueID of the spawned falling block, or cEntity::INVALID_ID on failure. */ + UInt32 SpawnFallingBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) + { + // When creating from a block position (Vector3i), move the spawn point to the middle of the block by adding (0.5, 0, 0.5) + return SpawnFallingBlock(Vector3d(0.5, 0, 0.5) + a_BlockPos, a_BlockType, a_BlockMeta); + } + + /** OBSOLETE, use the Vector3-based overload instead. Spawns an falling block entity at the given position. Returns the UniqueID of the spawned falling block, or cEntity::INVALID_ID on failure. */ UInt32 SpawnFallingBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) { - return SpawnFallingBlock({a_X, a_Y, a_Z}, a_BlockType, a_BlockMeta); + return SpawnFallingBlock(Vector3i{a_X, a_Y, a_Z}, a_BlockType, a_BlockMeta); } /** Spawns an minecart at the given coordinates. -- cgit v1.2.3