Skip to content
LeviLamina
Loading...
Searching...
No Matches
PathFinder.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/world/level/BlockPos.h"
7#include "mc/world/level/CachedChunkBlockSource.h"
8#include "mc/world/level/block/BlockProperty.h"
9#include "mc/world/level/pathfinder/BinaryHeap.h"
10#include "mc/world/level/pathfinder/CanClimbIntoNode.h"
11#include "mc/world/level/pathfinder/CanJumpIntoNode.h"
12#include "mc/world/level/pathfinder/NodeType.h"
13#include "mc/world/level/pathfinder/PathCompletionType.h"
14
15// auto generated forward declare list
16// clang-format off
17class AABB;
18class Actor;
19class Block;
20class BlockSource;
23class Path;
24class PathfinderNode;
25class Vec3;
26struct ActorPathingData;
27struct ActorUniqueID;
29// clang-format on
30
31class PathFinder {
32public:
33 // PathFinder inner types define
34 enum class ExtractionPurpose : uchar {
35 Pathing = 0,
36 IsFree = 1,
37 };
38
39 enum class NeighborDiagonalType : int {
40 Default = 0,
41 Liquid = 1,
42 };
43
44public:
45 // member variables
46 // NOLINTBEGIN
47 ::ll::TypedStorage<8, 48, ::CachedChunkBlockSource> mRegion;
48 ::ll::TypedStorage<8, 32, ::BinaryHeap> mOpenSet;
49 ::ll::TypedStorage<8, 64, ::std::unordered_map<::BlockPos, ::PathfinderNode>> mNodes;
50 ::ll::TypedStorage<8, 256, ::std::array<::PathfinderNode*, 32>> mNeighbors;
51 bool mCanPassDoors : 1;
52 bool mCanOpenDoors : 1;
53 bool mCanOpenIronDoors : 1;
54 bool mAvoidWater : 1;
55 bool mAvoidDamageBlocks : 1;
56 bool mCanFloat : 1;
57 bool mCanPathOverLava : 1;
58 bool mCanWalkInLava : 1;
59 bool mIsAmphibious : 1;
60 bool mAvoidPortals : 1;
61 bool mCanBreach : 1;
62 bool mCanJump : 1;
63 // NOLINTEND
64
65public:
66 // prevent constructor by default
67 PathFinder();
68
69public:
70 // member functions
71 // NOLINTBEGIN
72 MCNAPI PathFinder(::BlockSource& region, ::NavigationComponent const& navigation);
73
75 ::ActorPathingData const& data,
76 ::BlockPos const& pos,
77 ::Block const& block,
78 ::BlockProperty testProperty,
79 int radius,
80 ::BreakBlocksComponent const* breakBlocksComponent,
81 ::std::function<bool(::Block const&, ::BlockPos const&)> extraCondition
82 );
83
84 MCNAPI ::NodeType _classifyDoorNode(
85 ::ActorPathingData const& data,
86 ::Block const& testBlock,
87 ::BlockPos const& testPos,
88 ::BlockPos const& lastPathPos
89 );
90
91 MCNAPI ::NodeType _classifyNode(
92 ::ActorPathingData const& data,
93 ::BlockPos const& lastPathPos,
94 ::Block const& testBlock,
95 ::BlockPos const& testPos,
96 ::CanJumpIntoNode jumpIntoNode,
97 ::CanClimbIntoNode climbIntoNode
98 );
99
100 MCNAPI bool
102
103 MCNAPI ::std::unique_ptr<::Path>
104 _findPath(::ActorPathingData const& actorData, float xt, float yt, float zt, float maxDist);
105
106 MCNAPI ::std::unique_ptr<::Path> _findPath(
107 ::ActorPathingData const& data,
108 ::PathfinderNode* from,
110 ::PathfinderNode const& size,
111 float maxDist
112 );
113
114 MCNAPI ::AABB _getAABBForHeightComputation(::BlockPos const& pos, ::Block const& block) const;
115
116 MCNAPI float _getHeightAboveBlock(::BlockPos const& blockPos, float const mobHeight) const;
117
118 MCNAPI float _getHeightBelowBlock(::BlockPos const& blockPos, float const mobHeight) const;
119
120 MCNAPI ::PathfinderNode* _getNode(::BlockPos const& pos, ::NodeType nodeType);
121
122 MCNAPI ::PathfinderNode* _getNode(
123 ::ActorPathingData const& data,
124 ::BlockPos const& fromPos,
125 ::BlockPos const& blockPos,
126 ::PathfinderNode const& size,
127 float jumpHeight,
128 ::CanClimbIntoNode climbIntoNode
129 );
130
131 MCNAPI ::std::optional<::NodeType> _getPartialBlockNodeType(
132 ::BlockPos const& currentBlockPos,
133 ::BlockPos const& lastBlockPos,
134 ::ActorPathingData const& data
135 );
136
137 MCNAPI float _getPathfindingMalus(::ActorPathingData const& data, ::NodeType nodeType, ::BlockPos const& blockPos);
138
139 MCNAPI ::PathfinderNode*
140 _getWaterNode(::ActorPathingData const& data, ::BlockPos const& lastPos, ::BlockPos const& blockPos);
141
142 MCNAPI ::NodeType _isFreeStartNode(
143 ::ActorPathingData const& data,
144 ::AABB const& entityAABB,
145 ::BlockPos const& testPos,
146 ::BlockPos const& size
147 );
148
150 ::PathfinderNode const& node,
151 ::PathfinderNode const& target,
152 ::BlockPos const& offset,
153 uint maxDistSqr
154 );
155
156 MCNAPI ::std::unique_ptr<::Path>
157 _reconstructPath(::PathfinderNode* to, ::PathCompletionType const completionType, ::ActorUniqueID const actorId);
158
159 MCNAPI ::std::unique_ptr<::Path> findPath(::Actor& from, ::Actor const& to, float maxDist);
160
161 MCNAPI ::NodeType isFree(
162 ::ActorPathingData const& data,
163 ::BlockPos const& lastPathPos,
164 ::BlockPos const& testPos,
165 ::BlockPos const& size,
166 ::CanJumpIntoNode jumpIntoNode,
167 ::CanClimbIntoNode climbIntoNode
168 );
169
170 MCNAPI ~PathFinder();
171 // NOLINTEND
172
173public:
174 // static functions
175 // NOLINTBEGIN
176 MCNAPI static ::ActorPathingData extractPathingData(
177 ::Actor& mutableActor,
178 ::PathFinder::ExtractionPurpose purpose,
179 ::std::optional<::Vec3> targetPos
180 );
181 // NOLINTEND
182
183public:
184 // static variables
185 // NOLINTBEGIN
186 MCNAPI static ::PreferredPathComponent const& DEFAULT_DESC();
187 // NOLINTEND
188
189public:
190 // constructor thunks
191 // NOLINTBEGIN
192 MCNAPI void* $ctor(::BlockSource& region, ::NavigationComponent const& navigation);
193 // NOLINTEND
194
195public:
196 // destructor thunk
197 // NOLINTBEGIN
198 MCNAPI void $dtor();
199 // NOLINTEND
200};
Definition AABB.h:18
Definition Actor.h:113
Definition BlockPos.h:17
Definition BlockSource.h:71
Definition Block.h:41
Definition BreakBlocksComponent.h:12
Definition NavigationComponent.h:18
MCAPI::PathfinderNode * _getNode(::ActorPathingData const &data, ::BlockPos const &fromPos, ::BlockPos const &blockPos, ::PathfinderNode const &size, float jumpHeight, ::CanClimbIntoNode climbIntoNode)
MCAPI::PathfinderNode * _getWaterNode(::ActorPathingData const &data, ::BlockPos const &lastPos, ::BlockPos const &blockPos)
MCAPI bool _findNearestPathableNeighbor(::BlockPos &outPos, ::ActorPathingData const &data, ::BlockPos const &testPos)
static MCAPI ::ActorPathingData extractPathingData(::Actor &mutableActor, ::PathFinder::ExtractionPurpose purpose, ::std::optional<::Vec3 > targetPos)
MCAPI ~PathFinder()
MCAPI float _getHeightAboveBlock(::BlockPos const &blockPos, float const mobHeight) const
MCAPI::NodeType _isFreeStartNode(::ActorPathingData const &data, ::AABB const &entityAABB, ::BlockPos const &testPos, ::BlockPos const &size)
MCAPI ::std::unique_ptr<::Path > _reconstructPath(::PathfinderNode *to, ::PathCompletionType const completionType, ::ActorUniqueID const actorId)
MCAPI bool _isNeighborPotentiallyValid(::PathfinderNode const &node, ::PathfinderNode const &target, ::BlockPos const &offset, uint maxDistSqr)
MCAPI void $dtor()
MCAPI::NodeType _classifyNode(::ActorPathingData const &data, ::BlockPos const &lastPathPos, ::Block const &testBlock, ::BlockPos const &testPos, ::CanJumpIntoNode jumpIntoNode, ::CanClimbIntoNode climbIntoNode)
MCAPI::NodeType _classifyDoorNode(::ActorPathingData const &data, ::Block const &testBlock, ::BlockPos const &testPos, ::BlockPos const &lastPathPos)
MCAPI::AABB _getAABBForHeightComputation(::BlockPos const &pos, ::Block const &block) const
MCAPI ::std::optional<::NodeType > _getPartialBlockNodeType(::BlockPos const &currentBlockPos, ::BlockPos const &lastBlockPos, ::ActorPathingData const &data)
MCAPI ::std::unique_ptr<::Path > findPath(::Actor &from, ::Actor const &to, float maxDist)
MCAPI::PathfinderNode * _getNode(::BlockPos const &pos, ::NodeType nodeType)
MCAPI ::std::unique_ptr<::Path > _findPath(::ActorPathingData const &data, ::PathfinderNode *from, ::PathfinderNode *to, ::PathfinderNode const &size, float maxDist)
static MCAPI ::PreferredPathComponent const & DEFAULT_DESC()
MCAPI void * $ctor(::BlockSource &region, ::NavigationComponent const &navigation)
MCAPI bool _checkBlockAndNeighborsProperty(::ActorPathingData const &data, ::BlockPos const &pos, ::Block const &block, ::BlockProperty testProperty, int radius, ::BreakBlocksComponent const *breakBlocksComponent, ::std::function< bool(::Block const &, ::BlockPos const &)> extraCondition)
MCAPI float _getHeightBelowBlock(::BlockPos const &blockPos, float const mobHeight) const
MCAPI PathFinder(::BlockSource &region, ::NavigationComponent const &navigation)
MCAPI::NodeType isFree(::ActorPathingData const &data, ::BlockPos const &lastPathPos, ::BlockPos const &testPos, ::BlockPos const &size, ::CanJumpIntoNode jumpIntoNode, ::CanClimbIntoNode climbIntoNode)
MCAPI float _getPathfindingMalus(::ActorPathingData const &data, ::NodeType nodeType, ::BlockPos const &blockPos)
MCAPI ::std::unique_ptr<::Path > _findPath(::ActorPathingData const &actorData, float xt, float yt, float zt, float maxDist)
Definition Path.h:16
Definition PathfinderNode.h:5
Definition Vec3.h:10
Definition ActorPathingData.h:5
Definition ActorUniqueID.h:5
Definition PreferredPathComponent.h:11