Target .java

net.minecraft.world.level.pathfinder.Target (class, 39 lines): members: bestHeuristic, getBestNode, setReached, updateBest, isReached, bestNode, reached.

net.minecraft.world.level.pathfinderclass39 linescommonextends Node863 B

API Surface (4)

void updateBest(final float heuristic, final Node node)
Node getBestNode()
void setReached()
boolean isReached()

Fields & Constants (4)

DEBUG_STREAM_CODEC
bestHeuristic
bestNode
reached

Code Graph: Dependencies (2)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

Target.java39 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.pathfinder;
2
3
import io.netty.buffer.ByteBuf;
4
import net.minecraft.network.codec.StreamCodec;
5
6
public class Target extends Node {
7
	public static final StreamCodec<ByteBuf, Target> DEBUG_STREAM_CODEC = createDebugStreamCodec(Target::new);
8
	private float bestHeuristic = Float.MAX_VALUE;
9
	private Node bestNode;
10
	private boolean reached;
11
12
	public Target(final Node node) {
13
		super(node.x, node.y, node.z);
14
	}
15
16
	public Target(final int x, final int y, final int z) {
17
		super(x, y, z);
18
	}
19
20
	public void updateBest(final float heuristic, final Node node) {
21
		if (heuristic < this.bestHeuristic) {
22
			this.bestHeuristic = heuristic;
23
			this.bestNode = node;
24
		}
25
	}
26
27
	public Node getBestNode() {
28
		return this.bestNode;
29
	}
30
31
	public void setReached() {
32
		this.reached = true;
33
	}
34
35
	public boolean isReached() {
36
		return this.reached;
37
	}
38
}
39

Decompiled Minecraft 26.3 source of Target (net/minecraft/world/level/pathfinder/Target.java) with Mojang official mappings, stored verbatim on the site.