diff options
Diffstat (limited to 'mod/src/main/java/moe/ymc/acron/s2c/Entity.java')
-rw-r--r-- | mod/src/main/java/moe/ymc/acron/s2c/Entity.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mod/src/main/java/moe/ymc/acron/s2c/Entity.java b/mod/src/main/java/moe/ymc/acron/s2c/Entity.java new file mode 100644 index 0000000..3e0add1 --- /dev/null +++ b/mod/src/main/java/moe/ymc/acron/s2c/Entity.java @@ -0,0 +1,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); + } +} |