package net.minecraft.world.level.pathfinder;

import net.minecraft.network.FriendlyByteBuf;

public class Target extends Node {
    private float bestHeuristic;
    private Node bestNode;
    private boolean reached;
    
    public Target(final Node cqo) {
        super(cqo.x, cqo.y, cqo.z);
        this.bestHeuristic = Float.MAX_VALUE;
    }
    
    public Target(final int integer1, final int integer2, final int integer3) {
        super(integer1, integer2, integer3);
        this.bestHeuristic = Float.MAX_VALUE;
    }
    
    public void updateBest(final float float1, final Node cqo) {
        if (float1 < this.bestHeuristic) {
            this.bestHeuristic = float1;
            this.bestNode = cqo;
        }
    }
    
    public Node getBestNode() {
        return this.bestNode;
    }
    
    public void setReached() {
        this.reached = true;
    }
    
    public boolean isReached() {
        return this.reached;
    }
    
    public static Target createFromStream(final FriendlyByteBuf kv) {
        final Target cqu2 = new Target(kv.readInt(), kv.readInt(), kv.readInt());
        cqu2.walkedDistance = kv.readFloat();
        cqu2.costMalus = kv.readFloat();
        cqu2.closed = kv.readBoolean();
        cqu2.type = BlockPathTypes.values()[kv.readInt()];
        cqu2.f = kv.readFloat();
        return cqu2;
    }
}
