aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/utils/waypoint/ProfileAwareWaypoint.java
blob: 7aa99d14e5989238a20a2a51a3e983e8378dba12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package de.hysky.skyblocker.utils.waypoint;

import de.hysky.skyblocker.utils.Utils;
import net.minecraft.util.math.BlockPos;

import java.util.HashSet;
import java.util.Set;
import java.util.function.Supplier;

public class ProfileAwareWaypoint extends Waypoint {
    public final Set<String> foundProfiles = new HashSet<>();
    private final float[] missingColor;
    private final float[] foundColor;

    public ProfileAwareWaypoint(BlockPos pos, Supplier<Type> typeSupplier, float[] missingColor, float[] foundColor) {
        super(pos, typeSupplier, null);
        this.missingColor = missingColor;
        this.foundColor = foundColor;
    }

    @Override
    public boolean shouldRender() {
        return !foundProfiles.contains(Utils.getProfile());
    }

    @Override
    public void setFound() {
        foundProfiles.add(Utils.getProfile());
    }

    public void setFound(String profile) {
        foundProfiles.add(profile);
    }

    @Override
    public void setMissing() {
        foundProfiles.remove(Utils.getProfile());
    }

    @Override
    protected float[] getColorComponents() {
        return foundProfiles.contains(Utils.getProfile()) ? foundColor : missingColor;
    }
}