blob: 3e0add1b90f4edb19de74f670bcf3939332f3946 (
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
|
package moe.ymc.acron.s2c;
import com.google.gson.annotations.SerializedName;
import com.mojang.authlib.GameProfile;
import moe.ymc.acron.common.Vec3d;
import moe.ymc.acron.common.WorldKey;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
public record Entity(@SerializedName("name") @NotNull String name,
@SerializedName("uuid") @NotNull UUID uuid,
@SerializedName("pos") @Nullable Vec3d pos,
@SerializedName("world") @Nullable WorldKey world) {
public Entity(@NotNull net.minecraft.entity.Entity entity) {
this(entity.getName().getString(),
entity.getUuid(),
new Vec3d(entity.getPos()),
WorldKey.create(entity.world.getRegistryKey().getValue()));
}
public Entity(@NotNull GameProfile profile) {
this(profile.getName(), profile.getId(), null, null);
}
}
|