mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
New entity status packet event (#1506)
This commit is contained in:
parent
49603db657
commit
c15b071cad
4 changed files with 35 additions and 0 deletions
|
|
@ -335,6 +335,12 @@ namespace MinecraftClient
|
|||
/// <param name="protocolversion">Ptotocol version</param>
|
||||
public virtual void OnEntityMetadata(Entity entity, Dictionary<int, object> metadata) { }
|
||||
|
||||
/// <summary>
|
||||
/// Called when the status of client player have been changed
|
||||
/// </summary>
|
||||
/// <param name="statusId"></param>
|
||||
public virtual void OnPlayerStatus(byte statusId) { }
|
||||
|
||||
/// <summary>
|
||||
/// Called when a network packet received or sent
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ namespace MinecraftClient
|
|||
public bool GetNetworkPacketCaptureEnabled() { return networkPacketCaptureEnabled; }
|
||||
public int GetProtocolVersion() { return protocolversion; }
|
||||
public ILogger GetLogger() { return this.Log; }
|
||||
public int GetPlayerEntityID() { return playerEntityID; }
|
||||
|
||||
// get bots list for unloading them by commands
|
||||
public List<ChatBot> GetLoadedChatBots()
|
||||
|
|
@ -2076,6 +2077,19 @@ namespace MinecraftClient
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the status of an entity have been changed
|
||||
/// </summary>
|
||||
/// <param name="entityID">Entity ID</param>
|
||||
/// <param name="status">Status ID</param>
|
||||
public void OnEntityStatus(int entityID, byte status)
|
||||
{
|
||||
if (entityID == playerEntityID)
|
||||
{
|
||||
DispatchBotEvent(bot => bot.OnPlayerStatus(status));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when server sent a Time Update packet.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1006,6 +1006,14 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
handler.OnEntityMetadata(EntityID, metadata);
|
||||
}
|
||||
break;
|
||||
case PacketTypesIn.EntityStatus:
|
||||
if (handler.GetEntityHandlingEnabled())
|
||||
{
|
||||
int entityId = dataTypes.ReadNextInt(packetData);
|
||||
byte status = dataTypes.ReadNextByte(packetData);
|
||||
handler.OnEntityStatus(entityId, status);
|
||||
}
|
||||
break;
|
||||
case PacketTypesIn.TimeUpdate:
|
||||
long WorldAge = dataTypes.ReadNextLong(packetData);
|
||||
long TimeOfday = dataTypes.ReadNextLong(packetData);
|
||||
|
|
|
|||
|
|
@ -209,6 +209,13 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="prop">Dictionary of properties</param>
|
||||
void OnEntityProperties(int entityID, Dictionary<string, Double> prop);
|
||||
|
||||
/// <summary>
|
||||
/// Called when the status of an entity have been changed
|
||||
/// </summary>
|
||||
/// <param name="entityID">Entity ID</param>
|
||||
/// <param name="status">Status ID</param>
|
||||
void OnEntityStatus(int entityID, byte status);
|
||||
|
||||
/// <summary>
|
||||
/// Called when the world age has been updated
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue