blob: b10c0413a48b588df39e99502039929c17001bd8 (
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
29
|
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 net.minecraft.entity.EntityType;
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("type") @NotNull String type,
@SerializedName("pos") @Nullable Vec3d pos,
@SerializedName("world") @Nullable WorldKey world) {
public Entity(@NotNull net.minecraft.entity.Entity entity) {
this(entity.getName().getString(),
entity.getUuid(),
EntityType.getId(entity.getType()).toString(),
new Vec3d(entity.getPos()),
WorldKey.create(entity.world.getRegistryKey().getValue()));
}
public Entity(@NotNull GameProfile profile) {
this(profile.getName(), profile.getId(), "minecraft:player", null, null);
}
}
|