java.lang.Object
net.minecraft.world.level.pathfinder.Node
Direct Known Subclasses:
Target

public class Node extends Object
  • 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 heapIdx
      The index in the PathHeap. -1 if not assigned.
    • g

      public float g
      The total cost of all path points up to this one. Corresponds to the A* g-score.
    • h

      public float h
      The estimated cost from this path point to the target. Corresponds to the A* h-score.
    • f

      public float f
      The total cost of the path containing this path point. Used as sort criteria in PathHeap. Corresponds to the A* f-score.
    • cameFrom

      @Nullable public Node cameFrom
    • closed

      public boolean closed
    • walkedDistance

      public float walkedDistance
    • costMalus

      public float costMalus
      The additional cost of the path point. If negative, the path point will be sorted out by NodeProcessors.
    • type

      public PathType type
  • Constructor Details

    • Node

      public Node(int pX, int pY, int pZ)
  • Method Details

    • cloneAndMove

      public Node cloneAndMove(int pX, int pY, int pZ)
    • createHash

      public static int createHash(int pX, int pY, int pZ)
    • distanceTo

      public float distanceTo(Node pPoint)
      Returns the linear distance to another path point
    • distanceToXZ

      public float distanceToXZ(Node pPoint)
    • distanceTo

      public float distanceTo(BlockPos pPos)
    • distanceToSqr

      public float distanceToSqr(Node pPoint)
      Returns the squared distance to another path point
    • distanceToSqr

      public float distanceToSqr(BlockPos pPos)
    • distanceManhattan

      public float distanceManhattan(Node pPoint)
    • distanceManhattan

      public float distanceManhattan(BlockPos pPos)
    • asBlockPos

      public BlockPos asBlockPos()
    • asVec3

      public Vec3 asVec3()
    • equals

      public boolean equals(Object pOther)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • inOpenSet

      public boolean inOpenSet()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • writeToStream

      public void writeToStream(FriendlyByteBuf pBuffer)
    • createFromStream

      public static Node createFromStream(FriendlyByteBuf pBuffer)
    • readContents

      protected static void readContents(FriendlyByteBuf pBuffer, Node pNode)