Class Path

java.lang.Object
net.minecraft.world.level.pathfinder.Path

public final class Path extends Object
  • Field Details

    • STREAM_CODEC

      public static final StreamCodec<FriendlyByteBuf, Path> STREAM_CODEC
    • nodes

      private final List<Node> nodes
    • debugData

      private @Nullable Path.DebugData debugData
    • nextNodeIndex

      private int nextNodeIndex
    • target

      private final BlockPos target
    • distToTarget

      private final float distToTarget
    • reached

      private final boolean reached
  • Constructor Details

  • Method Details

    • advance

      public void advance()
    • notStarted

      public boolean notStarted()
    • isDone

      public boolean isDone()
    • getEndNode

      public @Nullable Node getEndNode()
    • getNode

      public Node getNode(int i)
      Returns the Node located at the specified index, usually the current one.
    • truncateNodes

      public void truncateNodes(int index)
    • replaceNode

      public void replaceNode(int index, Node replaceWith)
    • getNodeCount

      public int getNodeCount()
    • getNextNodeIndex

      public int getNextNodeIndex()
    • setNextNodeIndex

      public void setNextNodeIndex(int nextNodeIndex)
    • getEntityPosAtNode

      public Vec3 getEntityPosAtNode(Entity entity, int index)
      Gets the vector of the Node associated with the given index.
    • getNodePos

      public BlockPos getNodePos(int index)
    • getNextEntityPos

      public Vec3 getNextEntityPos(Entity entity)
      Returns:
      the current PathEntity target node as a Vec3D
    • getNextNodePos

      public BlockPos getNextNodePos()
    • getNextNode

      public Node getNextNode()
    • getPreviousNode

      public @Nullable Node getPreviousNode()
    • sameAs

      public boolean sameAs(@Nullable Path path)
      Returns true if the EntityPath are the same. Non instance related equals.
    • equals

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

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

      public boolean canReach()
    • setDebug

      void setDebug(Node[] openSet, Node[] closedSet, Set<Target> targets)
    • debugData

      public @Nullable Path.DebugData debugData()
    • writeToStream

      public void writeToStream(FriendlyByteBuf buffer)
    • createFromStream

      public static Path createFromStream(FriendlyByteBuf buffer)
    • toString

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

      public BlockPos getTarget()
    • getDistToTarget

      public float getDistToTarget()
    • readNodeArray

      private static Node[] readNodeArray(FriendlyByteBuf input)
    • writeNodeArray

      private static void writeNodeArray(FriendlyByteBuf output, Node[] nodes)
    • copy

      public Path copy()