Add OnTimeUpdate() and OnRespawn() to ChatBot API

This commit is contained in:
Рома Данилов 2020-08-07 13:35:23 +05:00 committed by GitHub
parent 2034729f74
commit ccc364df34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View file

@ -153,6 +153,13 @@ namespace MinecraftClient
/// <param name="tps">New estimated server TPS (between 0 and 20)</param> /// <param name="tps">New estimated server TPS (between 0 and 20)</param>
public virtual void OnServerTpsUpdate(Double tps) { } public virtual void OnServerTpsUpdate(Double tps) { }
/// <summary>
/// Called when a time changed
/// </summary>
/// <param name="WorldAge">World age</param>
/// <param name="TimeOfDay">Time</param>
public virtual void OnTimeUpdate(long WorldAge, long TimeOfDay) { }
/// <summary> /// <summary>
/// Called when an entity moved nearby /// Called when an entity moved nearby
/// </summary> /// </summary>
@ -312,6 +319,11 @@ namespace MinecraftClient
/// <param name="uuid">UUID of the player</param> /// <param name="uuid">UUID of the player</param>
/// <param name="name">Name of the player</param> /// <param name="name">Name of the player</param>
public virtual void OnPlayerLeave(Guid uuid, string name) { } public virtual void OnPlayerLeave(Guid uuid, string name) { }
/// <summary>
/// Called when the player respawns
/// </summary>
public virtual void OnRespawn() { }
/* =================================================================== */ /* =================================================================== */
/* ToolBox - Methods below might be useful while creating your bot. */ /* ToolBox - Methods below might be useful while creating your bot. */

View file

@ -1522,6 +1522,7 @@ namespace MinecraftClient
} }
ClearInventories(); ClearInventories();
DispatchBotEvent(bot => bot.OnRespawn());
} }
/// <summary> /// <summary>
@ -1978,6 +1979,7 @@ namespace MinecraftClient
lastAge = WorldAge; lastAge = WorldAge;
lastTime = DateTime.Now; lastTime = DateTime.Now;
} }
DispatchBotEvent(bot => bot.OnTimeUpdate(WorldAge, TimeOfDay));
} }
/// <summary> /// <summary>