Refactored to share the new utilities between the MCP and the Chat Bot API

This commit is contained in:
Anon 2026-04-03 19:06:43 +02:00
parent a88ca3cb71
commit dfef24ad10
12 changed files with 2225 additions and 1027 deletions

View file

@ -48,6 +48,7 @@ namespace MinecraftClient.Scripting
private readonly List<string> registeredChatBotCommands = new();
private readonly Lock delayTasksLock = new();
private readonly List<TaskWithDelay> delayedTasks = new();
private MccGameApi? _game;
protected McClient Handler
{
get
@ -60,6 +61,11 @@ namespace MinecraftClient.Scripting
}
}
/// <summary>
/// Shared gameplay and observed-state API used by MCP and available to built-in bots and scripts.
/// </summary>
protected MccGameApi Game => _game ??= new MccGameApi(() => Handler);
/// <summary>
/// Will be called every client tick (~50ms at 20 TPS).
/// </summary>