aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/ymc/acron/s2c/Entity.java
blob: 97bd567e9e20340aa97c12e409fe6247f2d73113 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package moe.ymc.acron.s2c;

import com.google.gson.annotations.SerializedName;
import com.mojang.authlib.GameProfile;
import org.jetbrains.annotations.NotNull;

import java.util.UUID;

public record Entity(@SerializedName("name") @NotNull String name,
                     @SerializedName("uuid") @NotNull UUID uuid) {
    public Entity(@NotNull net.minecraft.entity.Entity entity) {
        this(entity.getName().getString(),
                entity.getUuid());
    }

    public Entity(@NotNull GameProfile profile) {
        this(profile.getName(), profile.getId());
    }
}