diff options
author | Mattes D <github@xoft.cz> | 2020-04-21 22:19:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-21 22:19:22 +0200 |
commit | 487f9a2aa9b5497495cef1ac3b9c7a603e69f862 (patch) | |
tree | 054a846942f414060e29c72f4a717c8a89e70893 /src/Items/ItemBucket.h | |
parent | Delet SpawnObject params (diff) | |
download | cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.gz cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.bz2 cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.lz cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.xz cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.zst cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Items/ItemBucket.h | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h index 7b837d449..d2a9b1884 100644 --- a/src/Items/ItemBucket.h +++ b/src/Items/ItemBucket.h @@ -16,25 +16,34 @@ class cItemBucketHandler : public cItemHandler { + using Super = cItemHandler; + public: - cItemBucketHandler(int a_ItemType) : - cItemHandler(a_ItemType) + + cItemBucketHandler(int a_ItemType): + Super(a_ItemType) { } + + virtual bool OnItemUse( - cWorld * a_World, cPlayer * a_Player, cBlockPluginInterface & a_PluginInterface, const cItem & a_Item, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace + cWorld * a_World, + cPlayer * a_Player, + cBlockPluginInterface & a_PluginInterface, + const cItem & a_HeldItem, + const Vector3i a_ClickedBlockPos, + eBlockFace a_ClickedBlockFace ) override { switch (m_ItemType) { - case E_ITEM_BUCKET: return ScoopUpFluid(a_World, a_Player, a_Item, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); - case E_ITEM_LAVA_BUCKET: return PlaceFluid (a_World, a_Player, a_PluginInterface, a_Item, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, E_BLOCK_LAVA); - case E_ITEM_WATER_BUCKET: return PlaceFluid (a_World, a_Player, a_PluginInterface, a_Item, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, E_BLOCK_WATER); + case E_ITEM_BUCKET: return ScoopUpFluid(a_World, a_Player, a_HeldItem, a_ClickedBlockPos, a_ClickedBlockFace); + case E_ITEM_LAVA_BUCKET: return PlaceFluid (a_World, a_Player, a_PluginInterface, a_HeldItem, a_ClickedBlockPos, a_ClickedBlockFace, E_BLOCK_LAVA); + case E_ITEM_WATER_BUCKET: return PlaceFluid (a_World, a_Player, a_PluginInterface, a_HeldItem, a_ClickedBlockPos, a_ClickedBlockFace, E_BLOCK_WATER); default: { ASSERT(!"Unhandled ItemType"); @@ -45,7 +54,9 @@ public: - bool ScoopUpFluid(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) + + + bool ScoopUpFluid(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, const Vector3i a_ClickedBlockPos, eBlockFace a_ClickedBlockFace) { // Players can't pick up fluid while in adventure mode. if (a_Player->IsGameModeAdventure()) @@ -53,7 +64,8 @@ public: return false; } - if (a_BlockFace != BLOCK_FACE_NONE) + // Needs a valid clicked block: + if (a_ClickedBlockFace != BLOCK_FACE_NONE) { return false; } @@ -114,7 +126,7 @@ public: bool PlaceFluid( cWorld * a_World, cPlayer * a_Player, cBlockPluginInterface & a_PluginInterface, const cItem & a_Item, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, BLOCKTYPE a_FluidBlock + const Vector3i a_BlockPos, eBlockFace a_BlockFace, BLOCKTYPE a_FluidBlock ) { // Players can't place fluid while in adventure mode. @@ -219,6 +231,8 @@ public: + + bool GetPlacementCoordsFromTrace(cWorld * a_World, cPlayer * a_Player, Vector3i & a_BlockPos, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta, eBlockFace & a_BlockFace) { class cCallbacks : |