summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/World.cpp37
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);