diff options
author | Bond-009 <bond.009@outlook.com> | 2017-11-20 12:13:11 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2017-11-20 12:13:11 +0100 |
commit | 5badb9bccae803009bde182bf69ee0d02a36b22c (patch) | |
tree | 31fabd74fcee1138d4cacd0c437892c68c6defa9 /src/Blocks/BlockLever.h | |
parent | cItemHandler: Update max stack size of old doors. (#4072) (diff) | |
download | cuberite-5badb9bccae803009bde182bf69ee0d02a36b22c.tar cuberite-5badb9bccae803009bde182bf69ee0d02a36b22c.tar.gz cuberite-5badb9bccae803009bde182bf69ee0d02a36b22c.tar.bz2 cuberite-5badb9bccae803009bde182bf69ee0d02a36b22c.tar.lz cuberite-5badb9bccae803009bde182bf69ee0d02a36b22c.tar.xz cuberite-5badb9bccae803009bde182bf69ee0d02a36b22c.tar.zst cuberite-5badb9bccae803009bde182bf69ee0d02a36b22c.zip |
Diffstat (limited to 'src/Blocks/BlockLever.h')
-rw-r--r-- | src/Blocks/BlockLever.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h index 1ec58c534..6750649ae 100644 --- a/src/Blocks/BlockLever.h +++ b/src/Blocks/BlockLever.h @@ -19,12 +19,13 @@ public: virtual bool OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override { + Vector3i Coords(a_BlockX, a_BlockY, a_BlockZ); // Flip the ON bit on / off using the XOR bitwise operation - NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08); + NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(Coords) ^ 0x08); - a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); - a_WorldInterface.WakeUpSimulators({a_BlockX, a_BlockY, a_BlockZ}); - a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("block.lever.click", Vector3d(a_BlockX, a_BlockY, a_BlockZ), 0.5f, (Meta & 0x08) ? 0.6f : 0.5f); + a_ChunkInterface.SetBlockMeta(Coords.x, Coords.y, Coords.z, Meta); + a_WorldInterface.WakeUpSimulators(Coords); + a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("block.lever.click", Vector3d(Coords), 0.5f, (Meta & 0x08) ? 0.6f : 0.5f); return true; } |