aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/SkyBlockEntity.java
blob: bcd1196f574c8d5d1e9f869e910fe9439ca4d917 (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
package com.thatgravyboat.skyblockhud.api.sbentities;

import java.util.function.Predicate;
import net.minecraft.entity.Entity;

public class SkyBlockEntity {

    private final String name;
    private final Predicate<Entity> predicate;

    public static SkyBlockEntity of(String name, Predicate<Entity> predicate) {
        return new SkyBlockEntity(name, predicate);
    }

    private SkyBlockEntity(String name, Predicate<Entity> predicate) {
        this.name = name;
        this.predicate = predicate;
    }

    public String getName() {
        return name;
    }

    public boolean isEntity(Entity entity) {
        return predicate.test(entity);
    }
}