feat(modloader): add item use and summon APIs

Add managed item use hooks, server-authoritative summon support, and side-aware use item context.

Include IdHelper mappings, example ruby wand usage, and related runtime/crash-handler updates.
This commit is contained in:
Jacobwasbeast
2026-03-07 19:54:52 -06:00
parent eabf8fe858
commit 0b4c87acbc
21 changed files with 1862 additions and 45 deletions

View File

@@ -1,3 +1,5 @@
using System.Collections.Generic;
namespace WeaveLoader.API.Block;
/// <summary>
@@ -24,6 +26,9 @@ public class RegisteredBlock
/// </summary>
public static class BlockRegistry
{
private static readonly object s_lock = new();
private static readonly Dictionary<int, Identifier> s_idByNumeric = new();
/// <summary>
/// Register a new block with the game engine.
/// </summary>
@@ -53,6 +58,18 @@ public static class BlockRegistry
}
Logger.Debug($"Registered block '{id}' -> numeric ID {numericId}");
lock (s_lock)
{
s_idByNumeric[numericId] = id;
}
return new RegisteredBlock(id, numericId);
}
internal static bool TryGetIdentifier(int numericId, out Identifier id)
{
lock (s_lock)
{
return s_idByNumeric.TryGetValue(numericId, out id);
}
}
}