mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Fix entity metadata for lower MC versions
This commit is contained in:
parent
888297dd4b
commit
85c32b9a47
2 changed files with 32 additions and 4 deletions
|
|
@ -59,6 +59,7 @@ namespace MinecraftClient
|
|||
private object lastKeepAliveLock = new object();
|
||||
private int respawnTicks = 0;
|
||||
private int gamemode = 0;
|
||||
private int protocolVersion;
|
||||
|
||||
private int playerEntityID;
|
||||
|
||||
|
|
@ -155,6 +156,7 @@ namespace MinecraftClient
|
|||
this.username = user;
|
||||
this.host = server_ip;
|
||||
this.port = port;
|
||||
this.protocolVersion = protocolversion;
|
||||
|
||||
if (!singlecommand)
|
||||
{
|
||||
|
|
@ -2122,9 +2124,19 @@ namespace MinecraftClient
|
|||
if (entities.ContainsKey(entityID))
|
||||
{
|
||||
// Get health data for an entity
|
||||
if (metadata.ContainsKey(8) && metadata[8].GetType() == typeof(float))
|
||||
int key;
|
||||
// Key for 1.10+ is 7 and 1.14+ is 8
|
||||
if (protocolVersion >= Protocol.Handlers.Protocol18Handler.MC114Version)
|
||||
{
|
||||
entities[entityID].Health = (float)metadata[8];
|
||||
key = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
key = 7;
|
||||
}
|
||||
if (metadata.ContainsKey(key) && metadata[key].GetType() == typeof(float))
|
||||
{
|
||||
entities[entityID].Health = (float)metadata[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue