diff options
author | Mattes D <github@xoft.cz> | 2015-04-14 10:55:48 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-04-14 10:55:48 +0200 |
commit | d421befece1b9ffecea3cd25243393713f62c6f0 (patch) | |
tree | 7549f4fbb51bf1d307e354f6eb478f7759407731 /src/Items | |
parent | Placing a fluid from bucket calls plugin hooks. (diff) | |
download | cuberite-d421befece1b9ffecea3cd25243393713f62c6f0.tar cuberite-d421befece1b9ffecea3cd25243393713f62c6f0.tar.gz cuberite-d421befece1b9ffecea3cd25243393713f62c6f0.tar.bz2 cuberite-d421befece1b9ffecea3cd25243393713f62c6f0.tar.lz cuberite-d421befece1b9ffecea3cd25243393713f62c6f0.tar.xz cuberite-d421befece1b9ffecea3cd25243393713f62c6f0.tar.zst cuberite-d421befece1b9ffecea3cd25243393713f62c6f0.zip |
Diffstat (limited to 'src/Items')
-rw-r--r-- | src/Items/ItemBucket.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h index df6534241..015720415 100644 --- a/src/Items/ItemBucket.h +++ b/src/Items/ItemBucket.h @@ -45,7 +45,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) + bool ScoopUpFluid(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) { if (a_BlockFace != BLOCK_FACE_NONE) { @@ -80,6 +80,12 @@ public: return false; } + // Remove water / lava block (unless plugins disagree) + if (!a_Player->PlaceBlock(BlockPos.x, BlockPos.y, BlockPos.z, E_BLOCK_AIR, 0)) + { + return false; + } + // Give new bucket, filled with fluid when the gamemode is not creative: if (!a_Player->IsGameModeCreative()) { @@ -90,11 +96,13 @@ public: ASSERT(!"Inventory bucket mismatch"); return true; } - a_Player->GetInventory().AddItem(cItem(NewItem), true, true); + if (a_Player->GetInventory().AddItem(cItem(NewItem), true, true) != 1) + { + // The bucket didn't fit, toss it as a pickup: + a_Player->TossPickup(cItem(NewItem)); + } } - // Remove water / lava block - a_Player->GetWorld()->SetBlock(BlockPos.x, BlockPos.y, BlockPos.z, E_BLOCK_AIR, 0); return true; } |