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

@ -2180,14 +2180,10 @@ namespace MinecraftClient
entity.Metadata = metadata;
if (entity.Type.ContainsItem() && metadata.ContainsKey(7) && metadata[7] != null && metadata[7].GetType() == typeof(Item))
{
try
{
entity.Item = (Item)metadata[7];
}
catch
{
Item item = (Item)metadata[7];
if (item == null)
entity.Item = new Item(ItemType.Air, 0, null);
}
else entity.Item = item;
}
if (metadata.ContainsKey(6) && metadata[6] != null && metadata[6].GetType() == typeof(Int32))
{