Class Node
java.lang.Object
net.minecraft.world.level.pathfinder.Node
- Direct Known Subclasses:
Target
-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
float
The additional cost of the path point.float
The total cost of the path containing this path point.float
The total cost of all path points up to this one.float
The estimated cost from this path point to the target.private final int
int
The index in the PathHeap.float
final int
final int
final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasVec3()
cloneAndMove
(int x, int y, int z) static Node
createFromStream
(FriendlyByteBuf buffer) static int
createHash
(int x, int y, int z) float
float
distanceManhattan
(Node point) float
distanceTo
(BlockPos pos) float
distanceTo
(Node point) Returns the linear distance to another path pointfloat
distanceToSqr
(BlockPos pos) float
distanceToSqr
(Node point) Returns the squared distance to another path pointfloat
distanceToXZ
(Node point) boolean
int
hashCode()
boolean
protected static void
readContents
(FriendlyByteBuf buffer, Node node) toString()
void
writeToStream
(FriendlyByteBuf buffer)
-
Field Details
-
x
public final int x -
y
public final int y -
z
public final int z -
hash
private final int hash -
heapIdx
public int heapIdxThe index in the PathHeap. -1 if not assigned. -
g
public float gThe total cost of all path points up to this one. Corresponds to the A* g-score. -
h
public float hThe estimated cost from this path point to the target. Corresponds to the A* h-score. -
f
public float fThe total cost of the path containing this path point. Used as sort criteria in PathHeap. Corresponds to the A* f-score. -
cameFrom
-
closed
public boolean closed -
walkedDistance
public float walkedDistance -
costMalus
public float costMalusThe additional cost of the path point. If negative, the path point will be sorted out by NodeProcessors. -
type
-
-
Constructor Details
-
Node
public Node(int x, int y, int z)
-
-
Method Details
-
cloneAndMove
-
createHash
public static int createHash(int x, int y, int z) -
distanceTo
Returns the linear distance to another path point -
distanceToXZ
-
distanceTo
-
distanceToSqr
Returns the squared distance to another path point -
distanceToSqr
-
distanceManhattan
-
distanceManhattan
-
asBlockPos
-
asVec3
-
equals
-
hashCode
public int hashCode() -
inOpenSet
public boolean inOpenSet() -
toString
-
writeToStream
-
createFromStream
-
readContents
-