summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemBucket.h
diff options
context:
space:
mode:
authordaniel0916 <theschokolps@gmail.com>2014-07-11 17:58:35 +0200
committerdaniel0916 <theschokolps@gmail.com>2014-07-11 17:58:35 +0200
commitca6bcacdb9216237a25c05b2887ea69c6066356b (patch)
tree4f65466f11912901f9dce1f352a7bebc9c5ecf72 /src/Items/ItemBucket.h
parentChanges (diff)
downloadcuberite-ca6bcacdb9216237a25c05b2887ea69c6066356b.tar
cuberite-ca6bcacdb9216237a25c05b2887ea69c6066356b.tar.gz
cuberite-ca6bcacdb9216237a25c05b2887ea69c6066356b.tar.bz2
cuberite-ca6bcacdb9216237a25c05b2887ea69c6066356b.tar.lz
cuberite-ca6bcacdb9216237a25c05b2887ea69c6066356b.tar.xz
cuberite-ca6bcacdb9216237a25c05b2887ea69c6066356b.tar.zst
cuberite-ca6bcacdb9216237a25c05b2887ea69c6066356b.zip
Diffstat (limited to 'src/Items/ItemBucket.h')
-rw-r--r--src/Items/ItemBucket.h40
1 files changed, 16 insertions, 24 deletions
diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h
index b31266f35..e7214d852 100644
--- a/src/Items/ItemBucket.h
+++ b/src/Items/ItemBucket.h
@@ -41,7 +41,7 @@ public:
bool ScoopUpFluid(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace)
{
- if (a_BlockFace > 0)
+ if (a_BlockFace != BLOCK_FACE_NONE)
{
return false;
}
@@ -95,38 +95,18 @@ public:
bool PlaceFluid(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, BLOCKTYPE a_FluidBlock)
{
- if (a_BlockFace > 0)
+ if (a_BlockFace != BLOCK_FACE_NONE)
{
return false;
}
BLOCKTYPE CurrentBlock;
Vector3i BlockPos;
- if (!GetPlaceableBlockFromTrace(a_World, a_Player, BlockPos, CurrentBlock))
+ if (!GetPlacementCoordsFromTrace(a_World, a_Player, BlockPos, CurrentBlock))
{
return false;
}
- bool CanWashAway = cFluidSimulator::CanWashAway(CurrentBlock);
- if (!CanWashAway)
- {
- // The block pointed at cannot be washed away, so put fluid on top of it / on its sides
- // AddFaceDirection(BlockPos.x, BlockPos.y, BlockPos.z, a_BlockFace);
- // CurrentBlock = a_World->GetBlock(BlockPos);
- }
- if (
- !CanWashAway &&
- (CurrentBlock != E_BLOCK_AIR) &&
- (CurrentBlock != E_BLOCK_WATER) &&
- (CurrentBlock != E_BLOCK_STATIONARY_WATER) &&
- (CurrentBlock != E_BLOCK_LAVA) &&
- (CurrentBlock != E_BLOCK_STATIONARY_LAVA)
- )
- {
- // Cannot place water here
- return false;
- }
-
if (a_Player->GetGameMode() != gmCreative)
{
// Remove fluid bucket, add empty bucket:
@@ -144,6 +124,7 @@ public:
}
// Wash away anything that was there prior to placing:
+ bool CanWashAway = cFluidSimulator::CanWashAway(CurrentBlock);
if (CanWashAway)
{
cBlockHandler * Handler = BlockHandler(CurrentBlock);
@@ -209,7 +190,7 @@ public:
}
- bool GetPlaceableBlockFromTrace(cWorld * a_World, cPlayer * a_Player, Vector3i & a_BlockPos, BLOCKTYPE & a_BlockType)
+ bool GetPlacementCoordsFromTrace(cWorld * a_World, cPlayer * a_Player, Vector3i & a_BlockPos, BLOCKTYPE & a_BlockType)
{
class cCallbacks :
public cBlockTracer::cCallbacks
@@ -229,6 +210,17 @@ public:
{
if (a_BlockType != E_BLOCK_AIR)
{
+ bool CanWashAway = cFluidSimulator::CanWashAway(m_LastBlock);
+ if (
+ !CanWashAway &&
+ (m_LastBlock != E_BLOCK_AIR) &&
+ !IsBlockWater(m_LastBlock) &&
+ !IsBlockLava(m_LastBlock)
+ )
+ {
+ return true;
+ }
+
m_HasHitLastBlock = true;
return true;
}