diff options
author | Kiryu144 <123davidLP@gmail.com> | 2021-07-23 11:14:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-23 11:14:01 +0200 |
commit | 36a97d441bbb164c59d095aef1ef73f41fa38247 (patch) | |
tree | 76145c1abfc0093ab60da41077084383be8f09f4 /src/Entities | |
parent | Setting command-block's command requires a permission. (#5270) (diff) | |
download | cuberite-36a97d441bbb164c59d095aef1ef73f41fa38247.tar cuberite-36a97d441bbb164c59d095aef1ef73f41fa38247.tar.gz cuberite-36a97d441bbb164c59d095aef1ef73f41fa38247.tar.bz2 cuberite-36a97d441bbb164c59d095aef1ef73f41fa38247.tar.lz cuberite-36a97d441bbb164c59d095aef1ef73f41fa38247.tar.xz cuberite-36a97d441bbb164c59d095aef1ef73f41fa38247.tar.zst cuberite-36a97d441bbb164c59d095aef1ef73f41fa38247.zip |
Diffstat (limited to 'src/Entities')
-rw-r--r-- | src/Entities/Player.cpp | 18 | ||||
-rw-r--r-- | src/Entities/Player.h | 15 |
2 files changed, 14 insertions, 19 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index db64d2e1d..ad8d79fbb 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -2333,15 +2333,6 @@ void cPlayer::LoadRank(void) -bool cPlayer::PlaceBlock(const Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - return PlaceBlocks({ { a_Position, a_BlockType, a_BlockMeta } }); -} - - - - - void cPlayer::SendBlocksAround(int a_BlockX, int a_BlockY, int a_BlockZ, int a_Range) { // Collect the coords of all the blocks to send: @@ -2457,6 +2448,15 @@ const cUUID & cPlayer::GetUUID(void) const +bool cPlayer::PlaceBlock(const Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + return PlaceBlocks({ { a_Position, a_BlockType, a_BlockMeta } }); +} + + + + + bool cPlayer::PlaceBlocks(const std::initializer_list<sSetBlock> a_Blocks) { if (DoesPlacingBlocksIntersectEntity(a_Blocks)) diff --git a/src/Entities/Player.h b/src/Entities/Player.h index dc30fca30..d2d2fa60c 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -548,12 +548,6 @@ public: Loads the m_Rank, m_Permissions, m_MsgPrefix, m_MsgSuffix and m_MsgNameColorCode members. */ void LoadRank(void); - /** Calls the block-placement hook and places the block in the world, unless refused by the hook. - If the hook prevents the placement, sends the current block at the specified coords back to the client. - Assumes that the block is in a currently loaded chunk. - Returns true if the block is successfully placed. */ - bool PlaceBlock(Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); - /** Sends the block in the specified range around the specified coord to the client as a block change packet. The blocks in range (a_BlockX - a_Range, a_BlockX + a_Range) are sent (NY-metric). */ @@ -565,12 +559,13 @@ public: // tolua_end + /** Attempts to place the block in the world with a call to PlaceBlocks. */ + bool PlaceBlock(Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); + /** Calls the block placement hooks and places the blocks in the world. - First the "placing" hooks for all the blocks are called, then the blocks are placed, and finally - the "placed" hooks are called. + First the "placing" hooks for all the blocks are called, then the blocks are placed, and finally the "placed" hooks are called. If the any of the "placing" hooks aborts, none of the blocks are placed and the function returns false. - Returns true if all the blocks are placed. - Assumes that all the blocks are in currently loaded chunks. */ + Returns true if all the blocks are placed. */ bool PlaceBlocks(std::initializer_list<sSetBlock> a_Blocks); /** Notify nearby wolves that the player or one of the player's wolves took damage or did damage to an entity |