summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockSnow.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-30 01:31:21 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-11-30 01:31:21 +0100
commit0e0baa940a967b34806891c5d5e9d520b3a558db (patch)
treec577d365de68af7e3fa9b27f751852bee06f95ab /src/Blocks/BlockSnow.h
parentImproved redstone speed and fixed a wire bug (diff)
downloadcuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.tar
cuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.tar.gz
cuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.tar.bz2
cuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.tar.lz
cuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.tar.xz
cuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.tar.zst
cuberite-0e0baa940a967b34806891c5d5e9d520b3a558db.zip
Diffstat (limited to 'src/Blocks/BlockSnow.h')
-rw-r--r--src/Blocks/BlockSnow.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/Blocks/BlockSnow.h b/src/Blocks/BlockSnow.h
index b8d48362c..dd4c49fb2 100644
--- a/src/Blocks/BlockSnow.h
+++ b/src/Blocks/BlockSnow.h
@@ -25,21 +25,37 @@ public:
) override
{
a_BlockType = m_BlockType;
- NIBBLETYPE Meta = a_World->GetBlockMeta(Vector3i(a_BlockX, a_BlockY, a_BlockZ));
- if ((Meta < 7) && (Meta != 0)) // Is height at maximum (7) or at mininum (0)? Don't do anything if so
+ BLOCKTYPE BlockBeforePlacement;
+ NIBBLETYPE MetaBeforePlacement;
+ a_World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockBeforePlacement, MetaBeforePlacement);
+
+ if ((BlockBeforePlacement == E_BLOCK_SNOW) && (MetaBeforePlacement < 7))
{
- Meta++;
+ // Only increment if:
+ // A snow block was already there (not first time placement) AND
+ // Height is smaller than 7, the maximum possible height
+ MetaBeforePlacement++;
}
- a_BlockMeta = Meta;
+ a_BlockMeta = MetaBeforePlacement;
return true;
}
- virtual bool DoesIgnoreBuildCollision(void) override
+ virtual bool DoesIgnoreBuildCollision(cPlayer * a_Player, NIBBLETYPE a_Meta) override
{
- return true;
+ if ((a_Player->GetEquippedItem().m_ItemType == E_BLOCK_SNOW) && (a_Meta < 7))
+ {
+ return true; // If a player is holding a (thin) snow block and it's size can be increased, return collision ignored
+ }
+
+ if (a_Meta == 0)
+ {
+ return true; // If at normal snowfall height (lowest), we ignore collision
+ }
+
+ return false;
}