Class Node
java.lang.Object
net.minecraft.world.level.pathfinder.Node
- Direct Known Subclasses:
Target
-
Field Summary
FieldsModifier and TypeFieldDescription@Nullable NodebooleanfloatThe additional cost of the node.floatThe total cost of the path containing this node.floatThe total cost of all nodes up to this one.floatThe estimated cost from this node to the target.private final intintThe index in the PathHeap. -1 if not assigned.floatfinal intfinal intfinal int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasVec3()cloneAndMove(int x, int y, int z) static NodecreateFromStream(FriendlyByteBuf buffer) static intcreateHash(int x, int y, int z) floatfloatdistanceManhattan(Node node) floatdistanceTo(BlockPos pos) floatdistanceTo(Node node) Returns the linear distance to another nodefloatdistanceToSqr(BlockPos pos) floatdistanceToSqr(Node node) Returns the squared distance to another nodefloatdistanceToXZ(Node node) booleaninthashCode()booleanprotected static voidreadContents(FriendlyByteBuf buffer, Node node) toString()voidwriteToStream(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 nodes up to this one. Corresponds to the A* g-score. -
h
public float hThe estimated cost from this node to the target. Corresponds to the A* h-score. -
f
public float fThe total cost of the path containing this node. 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 node. If negative, the node 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 node -
distanceToXZ
-
distanceTo
-
distanceToSqr
Returns the squared distance to another node -
distanceToSqr
-
distanceManhattan
-
distanceManhattan
-
asBlockPos
-
asVec3
-
equals
-
hashCode
public int hashCode() -
inOpenSet
public boolean inOpenSet() -
toString
-
writeToStream
-
createFromStream
-
readContents
-