summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemBottle.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-04-21 22:19:22 +0200
committerGitHub <noreply@github.com>2020-04-21 22:19:22 +0200
commit487f9a2aa9b5497495cef1ac3b9c7a603e69f862 (patch)
tree054a846942f414060e29c72f4a717c8a89e70893 /src/Items/ItemBottle.h
parentDelet SpawnObject params (diff)
downloadcuberite-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/ItemBottle.h44
1 files changed, 27 insertions, 17 deletions
diff --git a/src/Items/ItemBottle.h b/src/Items/ItemBottle.h
index 319bc708f..2f4d8f93f 100644
--- a/src/Items/ItemBottle.h
+++ b/src/Items/ItemBottle.h
@@ -9,19 +9,28 @@
-class cItemBottleHandler :
+class cItemBottleHandler:
public cItemHandler
{
+ using Super = cItemHandler;
+
public:
- cItemBottleHandler() :
- cItemHandler(E_ITEM_GLASS_BOTTLE)
+
+ cItemBottleHandler():
+ Super(E_ITEM_GLASS_BOTTLE)
{
}
+
+
+
+ /** Searches for a water source block in the line of sight.
+ Returns true and sets a_BlockPos if a water source block is found within line-of-sight.
+ Returns false if not. */
bool GetBlockFromTrace(cWorld * a_World, cPlayer * a_Player, Vector3i & a_BlockPos)
{
- class cCallbacks :
+ class cCallbacks:
public cBlockTracer::cCallbacks
{
public:
@@ -29,7 +38,7 @@ public:
bool m_HasHitFluid;
- cCallbacks(void) :
+ cCallbacks():
m_HasHitFluid(false)
{
}
@@ -49,31 +58,32 @@ public:
return false;
}
} Callbacks;
-
- cLineBlockTracer Tracer(*a_World, Callbacks);
- Vector3d Start(a_Player->GetEyePosition() + a_Player->GetLookVector());
- Vector3d End(a_Player->GetEyePosition() + a_Player->GetLookVector() * 5);
-
- Tracer.Trace(Start.x, Start.y, Start.z, End.x, End.y, End.z);
-
+ auto Start = a_Player->GetEyePosition() + a_Player->GetLookVector();
+ auto End = a_Player->GetEyePosition() + a_Player->GetLookVector() * 5;
+ cLineBlockTracer::Trace(*a_World, Callbacks, Start, End);
if (!Callbacks.m_HasHitFluid)
{
return false;
}
-
a_BlockPos = Callbacks.m_Pos;
return true;
}
+
+
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
- ) override
+ cWorld * a_World,
+ cPlayer * a_Player,
+ cBlockPluginInterface & a_PluginInterface,
+ const cItem & a_HeldItem,
+ const Vector3i a_ClickedBlockPos,
+ eBlockFace a_ClickedBlockFace
+ ) override
{
- if (a_BlockFace != BLOCK_FACE_NONE)
+ if (a_ClickedBlockFace != BLOCK_FACE_NONE)
{
return false;
}