diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-03-02 16:01:37 +0100 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-03-02 16:01:37 +0100 |
commit | e4b2502896febbbf1d53fee1970e973bc6afde04 (patch) | |
tree | caa595d1275ec844c8d89ae037a95991f465d5a6 /src/World.cpp | |
parent | Use switch in GetStepSound (diff) | |
download | cuberite-e4b2502896febbbf1d53fee1970e973bc6afde04.tar cuberite-e4b2502896febbbf1d53fee1970e973bc6afde04.tar.gz cuberite-e4b2502896febbbf1d53fee1970e973bc6afde04.tar.bz2 cuberite-e4b2502896febbbf1d53fee1970e973bc6afde04.tar.lz cuberite-e4b2502896febbbf1d53fee1970e973bc6afde04.tar.xz cuberite-e4b2502896febbbf1d53fee1970e973bc6afde04.tar.zst cuberite-e4b2502896febbbf1d53fee1970e973bc6afde04.zip |
Diffstat (limited to 'src/World.cpp')
-rw-r--r-- | src/World.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/World.cpp b/src/World.cpp index ffdae2a37..ca72d2e20 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2647,6 +2647,43 @@ bool cWorld::SetCommandBlockCommand(int a_BlockX, int a_BlockY, int a_BlockZ, co +bool cWorld::IsTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + if (GetBlock(a_BlockX, a_BlockY, a_BlockZ) != E_BLOCK_TRAPDOOR) + { + return false; + } + + NIBBLETYPE Meta = GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); + return (Meta & 0x4) > 0; +} + + + + + +bool cWorld::SetTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Open) +{ + if (GetBlock(a_BlockX, a_BlockY, a_BlockZ) != E_BLOCK_TRAPDOOR) + { + return false; + } + + NIBBLETYPE Meta = GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); + bool IsOpen = (Meta & 0x4) > 0; + if (a_Open != IsOpen) + { + SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta ^ 0x4); + BroadcastSoundParticleEffect(1003, a_BlockX, a_BlockY, a_BlockZ, 0); + return true; + } + return false; +} + + + + + void cWorld::RegenerateChunk(int a_ChunkX, int a_ChunkZ) { m_ChunkMap->MarkChunkRegenerating(a_ChunkX, a_ChunkZ); |