Fix entity handling crash (#1241)

Fix #1237
* Fix crash
* Update Entity.cs
* Update Entitycmd.cs
* Update McClient.cs
This commit is contained in:
Рома Данилов 2020-08-27 22:33:45 +05:00 committed by GitHub
parent 2649e61a88
commit 02e294e3e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 8 deletions

View file

@ -144,10 +144,11 @@ namespace MinecraftClient.Commands
string customname = entity2.Value.CustomName;
EntityPose pose = entity2.Value.Pose;
EntityType type = entity2.Value.Type;
Item item = entity2.Value.Item;
string location = String.Format("X:{0}, Y:{1}, Z:{2}", Math.Round(entity2.Value.Location.X, 2), Math.Round(entity2.Value.Location.Y, 2), Math.Round(entity2.Value.Location.Y, 2));
if (type == EntityType.Item || type == EntityType.ItemFrame || type == Mapping.EntityType.EyeOfEnder || type == Mapping.EntityType.Egg || type == Mapping.EntityType.EnderPearl || type == Mapping.EntityType.Potion || type == Mapping.EntityType.Fireball || type == Mapping.EntityType.FireworkRocket)
response.Add(String.Format(" #{0}: Type: {1}, Item: {2}, Location: {3}", id, type, entity2.Value.Item.Type, location));
response.Add(String.Format(" #{0}: Type: {1}, Item: {2}, Location: {3}", id, type, item.Type, location));
else if (type == Mapping.EntityType.Player && !String.IsNullOrEmpty(nickname))
response.Add(String.Format(" #{0}: Type: {1}, Nickname: §8{2}§8, Latency: {3}, Health: {4}, Pose: {5}, Location: {6}", id, type, nickname, latency, health, pose, location));
else if (type == Mapping.EntityType.Player && !String.IsNullOrEmpty(customname))