summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
authorQUSpilPrgm <QUSpilPrgm@users.noreply.github.com>2016-05-29 22:10:35 +0200
committerQUSpilPrgm <QUSpilPrgm@users.noreply.github.com>2016-06-03 15:45:49 +0200
commitf1192c6860fc209509a414beaa4bbeaf87cfcb8d (patch)
treed299b6e8cd24f087f8bf5047cde858d4bcedbcf5 /src/Chunk.cpp
parentUpdate Dispensers and let them act more like in Vanilla (diff)
downloadcuberite-f1192c6860fc209509a414beaa4bbeaf87cfcb8d.tar
cuberite-f1192c6860fc209509a414beaa4bbeaf87cfcb8d.tar.gz
cuberite-f1192c6860fc209509a414beaa4bbeaf87cfcb8d.tar.bz2
cuberite-f1192c6860fc209509a414beaa4bbeaf87cfcb8d.tar.lz
cuberite-f1192c6860fc209509a414beaa4bbeaf87cfcb8d.tar.xz
cuberite-f1192c6860fc209509a414beaa4bbeaf87cfcb8d.tar.zst
cuberite-f1192c6860fc209509a414beaa4bbeaf87cfcb8d.zip
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r--src/Chunk.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index c65c043da..06d5eb319 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -1105,6 +1105,37 @@ int cChunk::GrowCactus(int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks)
+bool cChunk::GrowTallGrass(int a_RelX, int a_RelY, int a_RelZ)
+{
+ if (a_RelY > (cChunkDef::Height - 2))
+ {
+ return false;
+ }
+ BLOCKTYPE BlockType;
+ NIBBLETYPE BlockMeta;
+ if (!UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ, BlockType, BlockMeta))
+ {
+ return false;
+ }
+ if (BlockType != E_BLOCK_TALL_GRASS)
+ {
+ return false;
+ }
+ NIBBLETYPE LargeFlowerMeta;
+ switch (BlockMeta)
+ {
+ case E_META_TALL_GRASS_GRASS: LargeFlowerMeta = E_META_BIG_FLOWER_DOUBLE_TALL_GRASS; break;
+ case E_META_TALL_GRASS_FERN: LargeFlowerMeta = E_META_BIG_FLOWER_LARGE_FERN; break;
+ default: return false;
+ }
+ return UnboundedRelFastSetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_BIG_FLOWER, LargeFlowerMeta) &&
+ UnboundedRelFastSetBlock(a_RelX, a_RelY + 1, a_RelZ, E_BLOCK_BIG_FLOWER, 8);
+}
+
+
+
+
+
bool cChunk::UnboundedRelGetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const
{
if (!cChunkDef::IsValidHeight(a_RelY))