summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockVine.h
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-03-12 07:39:39 +0100
committermadmaxoft <github@xoft.cz>2014-03-12 07:39:39 +0100
commit3e9f265a368fad0f8097ec68681853e0859ea240 (patch)
treecd24727b0ff02d104eee23f44e92174aec977054 /src/Blocks/BlockVine.h
parentFixed APIDump (diff)
parentMerge pull request #791 from mc-server/PieceGenerator (diff)
downloadcuberite-3e9f265a368fad0f8097ec68681853e0859ea240.tar
cuberite-3e9f265a368fad0f8097ec68681853e0859ea240.tar.gz
cuberite-3e9f265a368fad0f8097ec68681853e0859ea240.tar.bz2
cuberite-3e9f265a368fad0f8097ec68681853e0859ea240.tar.lz
cuberite-3e9f265a368fad0f8097ec68681853e0859ea240.tar.xz
cuberite-3e9f265a368fad0f8097ec68681853e0859ea240.tar.zst
cuberite-3e9f265a368fad0f8097ec68681853e0859ea240.zip
Diffstat (limited to 'src/Blocks/BlockVine.h')
-rw-r--r--src/Blocks/BlockVine.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/Blocks/BlockVine.h b/src/Blocks/BlockVine.h
index d8c114284..708583e70 100644
--- a/src/Blocks/BlockVine.h
+++ b/src/Blocks/BlockVine.h
@@ -1,8 +1,7 @@
-
#pragma once
#include "BlockHandler.h"
-
+#include "MetaRotater.h"
@@ -24,6 +23,10 @@ public:
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override
{
+ UNUSED(a_Player);
+ UNUSED(a_CursorX);
+ UNUSED(a_CursorY);
+ UNUSED(a_CursorZ);
// TODO: Disallow placement where the vine doesn't attach to something properly
BLOCKTYPE BlockType = 0;
NIBBLETYPE BlockMeta;
@@ -162,11 +165,17 @@ public:
return false;
}
- virtual void OnUpdate(cWorld * a_World, int X, int Y, int Z)
+ virtual void OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ)
{
- if (a_World->GetBlock(X, Y - 1, Z) == E_BLOCK_AIR)
+ UNUSED(a_ChunkInterface);
+ UNUSED(a_WorldInterface);
+ UNUSED(a_BlockPluginInterface);
+
+ BLOCKTYPE Block;
+ a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY - 1, a_RelZ, Block);
+ if (Block == E_BLOCK_AIR)
{
- a_World->SetBlock(X, Y - 1, Z, E_BLOCK_VINES, a_World->GetBlockMeta(X, Y, Z));
+ a_Chunk.UnboundedRelSetBlock(a_RelX, a_RelY - 1, a_RelZ, E_BLOCK_VINES, a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ));
}
}
@@ -180,8 +189,8 @@ public:
{
return ((a_Meta << 1) | (a_Meta >> 3)) & 0x0f; // Rotate bits to the left
}
-
-
+
+
virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override
{
// Bits 2 and 4 stay, bits 1 and 3 swap
@@ -194,6 +203,7 @@ public:
// Bits 1 and 3 stay, bits 2 and 4 swap
return ((a_Meta & 0x05) | ((a_Meta & 0x02) << 2) | ((a_Meta & 0x08) >> 2));
}
+
} ;