diff options
author | Trumeet <yuuta@yuuta.moe> | 2022-07-29 12:17:56 -0700 |
---|---|---|
committer | Trumeet <yuuta@yuuta.moe> | 2022-07-29 12:17:56 -0700 |
commit | 26765d586e187ebd088cdb2f7451768a637968c8 (patch) | |
tree | 3abef1c89154ddc6964e82c43ee1c9c73f6d2c2a /mod/src/main/java/moe/ymc/acron/s2c/Entity.java | |
parent | ff769a117046448dec8f09d86dfc661cda0bbc3b (diff) | |
download | acron-26765d586e187ebd088cdb2f7451768a637968c8.tar acron-26765d586e187ebd088cdb2f7451768a637968c8.tar.gz acron-26765d586e187ebd088cdb2f7451768a637968c8.tar.bz2 acron-26765d586e187ebd088cdb2f7451768a637968c8.zip |
feat(mod/libacron): provide entity type to clients
API:ADD
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 | 5 |
1 files changed, 4 insertions, 1 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 index 3e0add1..b10c041 100644 --- a/mod/src/main/java/moe/ymc/acron/s2c/Entity.java +++ b/mod/src/main/java/moe/ymc/acron/s2c/Entity.java @@ -4,6 +4,7 @@ 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; @@ -11,16 +12,18 @@ 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(), null, null); + this(profile.getName(), profile.getId(), "minecraft:player", null, null); } } |