aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/location/FarmingIslandHandler.java
blob: a4abaaec8a94f6c590e411e9d8398c71d7bb7c84 (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
package com.thatgravyboat.skyblockhud.location;

import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent;
import java.util.Arrays;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class FarmingIslandHandler {

    public static Locations location = Locations.NONE;
    public static int pelts;

    @SubscribeEvent
    public void onSidebarPost(SidebarPostEvent event) {
        boolean isTracking = Arrays.toString(event.arrayScores).toLowerCase().contains("tracker mob location:");
        if (isTracking && location == Locations.NONE) {
            for (int i = 0; i < event.scores.size(); i++) {
                String line = event.scores.get(i);
                if (line.toLowerCase().contains("tracker mob location:") && i > 2) {
                    location = Locations.get(event.scores.get(i - 1).toLowerCase());
                    break;
                }
            }
        }
        if (!isTracking && location != Locations.NONE) {
            location = Locations.NONE;
        }
    }
}