mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
parent
70e5ae85d7
commit
2e1e79bcef
10 changed files with 128 additions and 11 deletions
|
|
@ -42,6 +42,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
EntityTeleport,
|
||||
EntityStatus,
|
||||
UpdateHealth,
|
||||
HeldItemChange,
|
||||
UnknownPacket
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -730,6 +730,10 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
dataTypes.ReadNextFloat(packetData);
|
||||
handler.OnUpdateHealth(health, food);
|
||||
break;
|
||||
case PacketIncomingType.HeldItemChange:
|
||||
byte slot = dataTypes.ReadNextByte(packetData);
|
||||
handler.OnHeldItemChange(slot);
|
||||
break;
|
||||
default:
|
||||
return false; //Ignored packet
|
||||
}
|
||||
|
|
|
|||
|
|
@ -277,7 +277,8 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
case 0x59: return PacketIncomingType.EntityProperties;
|
||||
case 0x57: return PacketIncomingType.EntityTeleport;
|
||||
case 0x1C: return PacketIncomingType.EntityStatus;
|
||||
case 0x49: return PacketIncomingType.UpdateHealth; // TODO: Add backwards support for this packet
|
||||
case 0x49: return PacketIncomingType.UpdateHealth; // TODO: Add backwards support
|
||||
case 0x40: return PacketIncomingType.HeldItemChange; // TODO: Add backwards support
|
||||
default: return PacketIncomingType.UnknownPacket;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,8 +212,20 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="item">Item (may be null for empty slot)</param>
|
||||
void OnSetSlot(byte inventoryID, short slotID, Item item);
|
||||
|
||||
/// <summary>
|
||||
/// Called when player health or hunger changed.
|
||||
/// </summary>
|
||||
/// <param name="health"></param>
|
||||
/// <param name="food"></param>
|
||||
void OnUpdateHealth(float health, int food);
|
||||
|
||||
/// <summary>
|
||||
/// Called when client need to change slot.
|
||||
/// </summary>
|
||||
/// <remarks>Used for setting player slot after joining game</remarks>
|
||||
/// <param name="slot"></param>
|
||||
void OnHeldItemChange(byte slot);
|
||||
|
||||
/// <summary>
|
||||
/// Called when the Player entity ID has been received from the server
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue