diff options
author | QuImUfu <vo_gel_frei@yahoo.de> | 2016-12-01 15:20:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-01 15:20:03 +0100 |
commit | fb2eaaa847a6678b123e2c650a018f0ac34113f9 (patch) | |
tree | 7faee9aead6d9299dde4201edd16644fceb994a1 /src/Items/ItemSign.h | |
parent | Debuggers: Added commands to investigate item's custom Lua properties. (diff) | |
download | cuberite-fb2eaaa847a6678b123e2c650a018f0ac34113f9.tar cuberite-fb2eaaa847a6678b123e2c650a018f0ac34113f9.tar.gz cuberite-fb2eaaa847a6678b123e2c650a018f0ac34113f9.tar.bz2 cuberite-fb2eaaa847a6678b123e2c650a018f0ac34113f9.tar.lz cuberite-fb2eaaa847a6678b123e2c650a018f0ac34113f9.tar.xz cuberite-fb2eaaa847a6678b123e2c650a018f0ac34113f9.tar.zst cuberite-fb2eaaa847a6678b123e2c650a018f0ac34113f9.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Items/ItemSign.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Items/ItemSign.h b/src/Items/ItemSign.h index edc358c6e..4c417947d 100644 --- a/src/Items/ItemSign.h +++ b/src/Items/ItemSign.h @@ -28,14 +28,25 @@ public: int a_CursorX, int a_CursorY, int a_CursorZ ) override { + // Check if placing on something ignoring build collision to edit the correct sign later on: + BLOCKTYPE ClickedBlock; + NIBBLETYPE ClickedBlockMeta; + a_World.GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, ClickedBlock, ClickedBlockMeta); + bool isReplacingClickedBlock = BlockHandler(ClickedBlock)->DoesIgnoreBuildCollision() || BlockHandler(ClickedBlock)->DoesIgnoreBuildCollision(&a_Player, ClickedBlockMeta); + // If the regular placement doesn't work, do no further processing: if (!super::OnPlayerPlace(a_World, a_Player, a_EquippedItem, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ)) { return false; } + // Use isReplacingClickedBlock to make sure we will edit the right sign: + if (!isReplacingClickedBlock) + { + AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); + } + // After successfully placing the sign, open the sign editor for the player: - AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); a_Player.GetClientHandle()->SendEditSign(a_BlockX, a_BlockY, a_BlockZ); return true; } |