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 czd) {
        super(czd.x, czd.y, czd.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 czd) {
        if (float1 < this.bestHeuristic) {
            this.bestHeuristic = float1;
            this.bestNode = czd;
        }
    }
    
    public Node getBestNode() {
        return this.bestNode;
    }
    
    public void setReached() {
        this.reached = true;
    }
    
    public static Target createFromStream(final FriendlyByteBuf mg) {
        final Target czj2 = new Target(mg.readInt(), mg.readInt(), mg.readInt());
        czj2.walkedDistance = mg.readFloat();
        czj2.costMalus = mg.readFloat();
        czj2.closed = mg.readBoolean();
        czj2.type = BlockPathTypes.values()[mg.readInt()];
        czj2.f = mg.readFloat();
        return czj2;
    }
}
