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/block/BlockProperty.h"
7#include "mc/world/level/pathfinder/ActorPathingData.h"
8#include "mc/world/level/pathfinder/CanClimbIntoNode.h"
9#include "mc/world/level/pathfinder/CanJumpIntoNode.h"
10#include "mc/world/level/pathfinder/NodeType.h"
11#include "mc/world/level/pathfinder/PathCompletionType.h"
12
13// auto generated forward declare list
14// clang-format off
15class AABB;
16class Actor;
17class BinaryHeap;
18class Block;
19class BlockPos;
20class BlockSource;
25class Path;
26class PathfinderNode;
27class Vec3;
28struct ActorPathingData;
29struct ActorUniqueID;
31// clang-format on
32
34public:
35 // PathFinder inner types define
36 enum class ExtractionPurpose : uchar {
37 Pathing = 0,
38 IsFree = 1,
39 };
40
41 enum class NeighborDiagonalType : int {
42 Default = 0,
43 Liquid = 1,
44 };
45
46public:
47 // member variables
48 // NOLINTBEGIN
49 ::ll::TypedStorage<8, 48, ::CachedChunkBlockSource> mRegion;
50 ::ll::TypedStorage<8, 32, ::BinaryHeap> mOpenSet;
51 ::ll::TypedStorage<8, 64, ::std::unordered_map<::BlockPos, ::PathfinderNode>> mNodes;
52 ::ll::TypedStorage<8, 256, ::std::array<::PathfinderNode*, 32>> mNeighbors;
53 ::ll::TypedStorage<1, 1, bool> mCanPassDoors;
54 ::ll::TypedStorage<1, 1, bool> mCanOpenDoors;
55 ::ll::TypedStorage<1, 1, bool> mCanOpenIronDoors;
56 ::ll::TypedStorage<1, 1, bool> mAvoidWater;
57 ::ll::TypedStorage<1, 1, bool> mAvoidDamageBlocks;
58 ::ll::TypedStorage<1, 1, bool> mCanFloat;
59 ::ll::TypedStorage<1, 1, bool> mCanPathOverLava;
60 ::ll::TypedStorage<1, 1, bool> mIsAmphibious;
61 ::ll::TypedStorage<1, 1, bool> mAvoidPortals;
62 ::ll::TypedStorage<1, 1, bool> mCanBreach;
63 ::ll::TypedStorage<1, 1, bool> mCanJump;
64 // NOLINTEND
65
66public:
67 // member functions
68 // NOLINTBEGIN
69 MCAPI PathFinder(::BlockSource& region, ::NavigationComponent const& navigation);
70
71 MCAPI bool _checkBlockAndNeighborsProperty(
72 ::ActorPathingData const& data,
73 ::BlockPos const& pos,
74 ::Block const& block,
75 ::BlockProperty testProperty,
76 int radius,
77 ::BreakBlocksComponent const* breakBlocksComponent,
78 ::std::function<bool(::Block const&, ::BlockPos const&)> extraCondition
79 );
80
81 MCAPI bool _checkForDamagingBlock(
82 ::ActorPathingData const& data,
83 ::BlockPos const& pos,
84 ::Block const& block,
85 int radius,
86 ::BreakBlocksComponent const* breakBlocksComponent
87 );
88
89 MCAPI ::NodeType _classifyDoorNode(
90 ::ActorPathingData const& data,
91 ::Block const& testBlock,
92 ::BlockPos const& testPos,
93 ::BlockPos const& lastPathPos
94 );
95
96 MCAPI ::NodeType
97 _classifyNode(::ActorPathingData const& data, ::BlockPos const& fromPos, ::BlockPos const& testPos);
98
99 MCAPI ::NodeType _classifyNode(
100 ::ActorPathingData const& data,
101 ::BlockPos const& lastPathPos,
102 ::Block const& testBlock,
103 ::BlockPos const& testPos,
104 ::CanJumpIntoNode jumpIntoNode,
105 ::CanClimbIntoNode climbIntoNode
106 );
107
108 MCAPI bool
109 _findNearestPathableNeighbor(::BlockPos& outPos, ::ActorPathingData const& data, ::BlockPos const& testPos);
110
111 MCAPI ::std::unique_ptr<::Path>
112 _findPath(::ActorPathingData const& actorData, float xt, float yt, float zt, float maxDist);
113
114 MCAPI ::std::unique_ptr<::Path> _findPath(
115 ::ActorPathingData const& data,
116 ::PathfinderNode* from,
118 ::PathfinderNode const& size,
119 float maxDist
120 );
121
122 MCAPI float _getHeightAboveBlock(::BlockPos const& blockPos, float mobHeight) const;
123
124 MCAPI float _getHeightBelowBlock(::BlockPos const& blockPos, float mobHeight) const;
125
126 MCAPI ::std::optional<::BlockPos> _getHighestReachablePosByJumping(
127 ::BlockPos const& originalTargetPos,
128 float maxReachableHeight,
129 ::BlockPos const& actorSize
130 ) const;
131
132 MCAPI ::ActorPathingData::MinMaxHeightCacheEntry
133 _getMinAndMaxHeightAroundBlock(::ActorPathingData const& data, ::BlockPos const& blockPos, float mobHeight) const;
134
135 MCAPI int _getNeighbors(
136 ::ActorPathingData const& data,
137 ::PathfinderNode& pos,
138 ::PathfinderNode const& size,
139 ::PathfinderNode const& target,
140 uint maxDistSqr,
141 ::std::bitset<18> const& validPositions
142 );
143
144 MCAPI ::PathfinderNode* _getNode(::BlockPos const& pos, ::NodeType nodeType);
145
146 MCAPI ::PathfinderNode* _getNode(
147 ::ActorPathingData const& data,
148 ::BlockPos const& fromPos,
149 ::BlockPos const& blockPos,
150 ::PathfinderNode const& size,
151 float jumpHeight,
152 ::CanClimbIntoNode climbIntoNode
153 );
154
155 MCAPI ::std::optional<::NodeType> _getPartialBlockNodeType(
156 ::BlockPos const& currentBlockPos,
157 ::BlockPos const& lastBlockPos,
158 ::ActorPathingData const& data
159 );
160
161 MCAPI float _getPathfindingMalus(::ActorPathingData const& data, ::NodeType nodeType, ::BlockPos const& blockPos);
162
163 MCAPI ::PathfinderNode* _getUnderneathSupportedNode(
164 ::PathfinderNode* node,
165 ::ActorPathingData const& data,
166 ::BlockPos const& fromPos,
167 ::PathfinderNode const& size,
168 ::CanClimbIntoNode climbIntoNode
169 );
170
171 MCAPI ::PathfinderNode*
172 _getWaterNode(::ActorPathingData const& data, ::BlockPos const& lastPos, ::BlockPos const& blockPos);
173
174 MCAPI ::NodeType _isFreeStartNode(
175 ::ActorPathingData const& data,
176 ::AABB const& entityAABB,
177 ::BlockPos const& testPos,
178 ::BlockPos const& size
179 );
180
181 MCAPI ::NodeType
182 _isFreeWaterNode(::ActorPathingData const& data, ::BlockPos const& lastPos, ::BlockPos const& blockPos);
183
184 MCAPI bool _isNeighborPotentiallyValid(
185 ::PathfinderNode const& node,
186 ::PathfinderNode const& target,
187 ::BlockPos const& offset,
188 uint maxDistSqr
189 );
190
191 MCAPI ::std::unique_ptr<::Path>
192 _reconstructPath(::PathfinderNode* to, ::PathCompletionType completionType, ::ActorUniqueID actorId);
193
194 MCAPI ::NodeType isFree(
195 ::ActorPathingData const& data,
196 ::BlockPos const& lastPathPos,
197 ::BlockPos const& testPos,
198 ::BlockPos const& size,
199 ::CanJumpIntoNode jumpIntoNode,
200 ::CanClimbIntoNode climbIntoNode
201 );
202
203 MCAPI ~PathFinder();
204 // NOLINTEND
205
206public:
207 // static functions
208 // NOLINTBEGIN
209 MCAPI static float _calculateMoveCost(
210 ::ActorPathingData const& data,
211 ::PathfinderNode& start,
212 ::BlockPos const& fromPos,
214 );
215
216 MCAPI static ::BlockPos _getStartPositionFlyingActor(
217 ::IPathBlockSource const& pathBlockSource,
218 ::BlockPos originalStartPos,
219 bool canFloat,
220 bool canPathOverLava,
221 float yFeetPosition
222 );
223
224 MCAPI static ::ActorPathingData extractPathingData(
225 ::Actor& mutableActor,
226 ::PathFinder::ExtractionPurpose purpose,
227 ::std::optional<::Vec3> targetPos
228 );
229 // NOLINTEND
230
231public:
232 // static variables
233 // NOLINTBEGIN
234 MCAPI static ::PreferredPathDescription const& DEFAULT_DESC();
235 // NOLINTEND
236
237public:
238 // constructor thunks
239 // NOLINTBEGIN
240 MCAPI void* $ctor(::BlockSource& region, ::NavigationComponent const& navigation);
241 // NOLINTEND
242
243public:
244 // destructor thunk
245 // NOLINTBEGIN
246 MCAPI void $dtor();
247 // NOLINTEND
248};
Definition AABB.h:16
Definition Actor.h:104
Definition BinaryHeap.h:10
Definition BlockPos.h:18
Definition BlockSource.h:67
Definition Block.h:36
Definition BreakBlocksComponent.h:12
Definition CachedChunkBlockSource.h:16
Definition IPathBlockSource.h:10
Definition NavigationComponent.h:22
Definition PathFinder.h:33
Definition Path.h:16
Definition PathfinderNode.h:5
Definition Vec3.h:10
Definition ActorPathingData.h:5
Definition ActorUniqueID.h:5
Definition PreferredPathDescription.h:13