From 1c2e4ab6d819337122fe67ba5c8993e152f036f2 Mon Sep 17 00:00:00 2001 From: CarbonNeuron Date: Thu, 30 Apr 2020 16:25:10 -0500 Subject: [PATCH] Added UUID to spawning players. And UUID property to Entity.cs --- MinecraftClient/Mapping/Entity.cs | 18 ++++++++++++++++++ MinecraftClient/McTcpClient.cs | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/MinecraftClient/Mapping/Entity.cs b/MinecraftClient/Mapping/Entity.cs index f069d885..1b913dd6 100644 --- a/MinecraftClient/Mapping/Entity.cs +++ b/MinecraftClient/Mapping/Entity.cs @@ -15,6 +15,11 @@ namespace MinecraftClient.Mapping /// public int ID; + /// + /// UUID of the entity if it is a player. + /// + public Guid UUID; + /// /// Entity type determined by Minecraft Console Client /// @@ -81,6 +86,19 @@ namespace MinecraftClient.Mapping this.Type = type; this.Location = location; } + /// + /// Create a new entity based on Entity ID, Entity Type, location and UUID + /// + /// Entity ID + /// Entity Type Enum + /// Entity location + public Entity(int ID, EntityType type, Location location, Guid uuid) + { + this.ID = ID; + this.Type = type; + this.Location = location; + this.UUID = uuid; + } /// /// Return TRUE if the Entity is an hostile mob diff --git a/MinecraftClient/McTcpClient.cs b/MinecraftClient/McTcpClient.cs index 6de3afd8..a2257a03 100644 --- a/MinecraftClient/McTcpClient.cs +++ b/MinecraftClient/McTcpClient.cs @@ -1271,7 +1271,7 @@ namespace MinecraftClient public void OnSpawnPlayer(int EntityID, Guid UUID, Location location, byte Yaw, byte Pitch) { if (entities.ContainsKey(EntityID)) return; - Entity entity = new Entity(EntityID, EntityType.Player, location); + Entity entity = new Entity(EntityID, EntityType.Player, location, UUID); entities.Add(EntityID, entity); foreach (ChatBot bot in bots.ToArray()) {