aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/SkyBlockEntity.java
blob: ee8c3a76953305d5a76ebcfeac27c2a161c373b0 (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.handlers.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);
    }
}