diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2022-07-11 00:56:25 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2022-07-19 23:33:09 +0200 |
commit | 284f54ed81186d3122b994db7395e870703efb4f (patch) | |
tree | 51a4b5c4a7e9fdde460c84117ea8f9ea6ed97393 /src/Items | |
parent | Move LineBlockTracer into Physics (diff) | |
download | cuberite-284f54ed81186d3122b994db7395e870703efb4f.tar cuberite-284f54ed81186d3122b994db7395e870703efb4f.tar.gz cuberite-284f54ed81186d3122b994db7395e870703efb4f.tar.bz2 cuberite-284f54ed81186d3122b994db7395e870703efb4f.tar.lz cuberite-284f54ed81186d3122b994db7395e870703efb4f.tar.xz cuberite-284f54ed81186d3122b994db7395e870703efb4f.tar.zst cuberite-284f54ed81186d3122b994db7395e870703efb4f.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Items/ItemBoat.h | 6 | ||||
-rw-r--r-- | src/Items/ItemBottle.h | 4 | ||||
-rw-r--r-- | src/Items/ItemBucket.h | 14 | ||||
-rw-r--r-- | src/Items/ItemLilypad.h | 6 |
4 files changed, 14 insertions, 16 deletions
diff --git a/src/Items/ItemBoat.h b/src/Items/ItemBoat.h index 4fc041787..62d6f546e 100644 --- a/src/Items/ItemBoat.h +++ b/src/Items/ItemBoat.h @@ -2,7 +2,7 @@ #pragma once #include "../Entities/Boat.h" -#include "../LineBlockTracer.h" +#include "../Physics/Tracers/LineBlockTracer.h" @@ -38,7 +38,7 @@ public: // Find the actual placement position by tracing line of sight until non-air block: class cCallbacks: - public cBlockTracer::cCallbacks + public BlockTracerCallbacks { public: Vector3d m_Pos; @@ -62,7 +62,7 @@ public: } Callbacks; auto Start = a_Player->GetEyePosition() + a_Player->GetLookVector(); auto End = a_Player->GetEyePosition() + a_Player->GetLookVector() * 5; - cLineBlockTracer::Trace(*a_World, Callbacks, Start, End); + LineBlockTracer::Trace(*a_World, Callbacks, Start, End); if (!Callbacks.m_HasFound) { return false; diff --git a/src/Items/ItemBottle.h b/src/Items/ItemBottle.h index a324eb101..748dc0860 100644 --- a/src/Items/ItemBottle.h +++ b/src/Items/ItemBottle.h @@ -28,7 +28,7 @@ public: bool GetBlockFromTrace(cWorld * a_World, cPlayer * a_Player, Vector3i & a_BlockPos) const { class cCallbacks: - public cBlockTracer::cCallbacks + public BlockTracerCallbacks { public: Vector3i m_Pos; @@ -57,7 +57,7 @@ public: } Callbacks; auto Start = a_Player->GetEyePosition() + a_Player->GetLookVector(); auto End = a_Player->GetEyePosition() + a_Player->GetLookVector() * 5; - cLineBlockTracer::Trace(*a_World, Callbacks, Start, End); + LineBlockTracer::Trace(*a_World, Callbacks, Start, End); if (!Callbacks.m_HasHitFluid) { return false; diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h index e7fa0fe38..4403342f8 100644 --- a/src/Items/ItemBucket.h +++ b/src/Items/ItemBucket.h @@ -6,7 +6,7 @@ #include "../World.h" #include "../Simulator/FluidSimulator.h" #include "../Blocks/BlockHandler.h" -#include "../LineBlockTracer.h" +#include "../Physics/Tracers/LineBlockTracer.h" #include "../Blocks/ChunkInterface.h" @@ -185,7 +185,7 @@ public: bool GetBlockFromTrace(cWorld * a_World, cPlayer * a_Player, Vector3i & a_BlockPos) const { class cCallbacks : - public cBlockTracer::cCallbacks + public BlockTracerCallbacks { public: Vector3i m_Pos; @@ -213,11 +213,10 @@ public: } } 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, End); + LineBlockTracer::Trace(*a_World, Callbacks, Start, End); if (!Callbacks.m_HasHitFluid) { @@ -236,7 +235,7 @@ public: bool GetPlacementCoordsFromTrace(cWorld * a_World, cPlayer * a_Player, Vector3i & a_BlockPos, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta, eBlockFace & a_BlockFace) const { class cCallbacks : - public cBlockTracer::cCallbacks + public BlockTracerCallbacks { public: Vector3i m_Pos; @@ -262,14 +261,13 @@ public: } } Callbacks; - cLineBlockTracer Tracer(*a_World, Callbacks); Vector3d Start(a_Player->GetEyePosition()); Vector3d End(a_Player->GetEyePosition() + a_Player->GetLookVector() * 5); - // cLineBlockTracer::Trace() returns true when whole line was traversed. By returning true from the callback when we hit something, + // LineBlockTracer::Trace() returns true when whole line was traversed. By returning true from the callback when we hit something, // we ensure that this never happens if liquid could be placed // Use this to judge whether the position is valid - if (!Tracer.Trace(Start, End)) + if (!LineBlockTracer::Trace(*a_World, Callbacks, Start, End)) { a_BlockPos = Callbacks.m_Pos; a_BlockType = Callbacks.m_ReplacedBlockType; diff --git a/src/Items/ItemLilypad.h b/src/Items/ItemLilypad.h index f13212b07..10bc5f75a 100644 --- a/src/Items/ItemLilypad.h +++ b/src/Items/ItemLilypad.h @@ -3,7 +3,7 @@ #include "ItemHandler.h" #include "../Entities/Player.h" -#include "../LineBlockTracer.h" +#include "../Physics/Tracers/LineBlockTracer.h" @@ -89,7 +89,7 @@ public: } class cCallbacks: - public cBlockTracer::cCallbacks + public BlockTracerCallbacks { public: @@ -118,7 +118,7 @@ public: const auto EyePosition = a_Player->GetEyePosition(); const auto End = EyePosition + a_Player->GetLookVector() * 5; - if (cLineBlockTracer::Trace(*a_Player->GetWorld(), Callbacks, EyePosition, End)) + if (LineBlockTracer::Trace(*a_Player->GetWorld(), Callbacks, EyePosition, End)) { // The line traced to completion; no suitable water was found: return false; |