feat(items): add managed custom item callbacks and native pickaxe support

Introduce a managed custom item API with mine-block callbacks and cancellation semantics, plus native runtime support for registering pickaxe items.

Key changes:

- add WeaveLoader.API Item base/PickaxeItem and dispatcher plumbing

- register managed item instances in ItemRegistry

- add native export for pickaxe registration and wire through GameObjectFactory

- resolve/hook item mineBlock paths (ItemInstance/Item/DiggerItem) and dispatch to managed host

- expose managed OnItemMineBlock entry in WeaveLoader.Core and DotNetHost

- add Ruby Pickaxe example item + placeholder texture

- keep logger usable even before managed handler setup via native fallback
This commit is contained in:
Jacobwasbeast
2026-03-07 13:42:46 -06:00
parent 4119522cde
commit 6464263d12
19 changed files with 572 additions and 13 deletions

View File

@@ -22,6 +22,7 @@ static managed_entry_fn fn_Init = nullptr;
static managed_entry_fn fn_PostInit = nullptr;
static managed_entry_fn fn_Tick = nullptr;
static managed_entry_fn fn_Shutdown = nullptr;
static managed_entry_fn fn_ItemMineBlock = nullptr;
static bool LoadHostfxr()
{
@@ -177,6 +178,7 @@ bool DotNetHost::Initialize()
ok &= resolve(L"PostInit", &fn_PostInit);
ok &= resolve(L"Tick", &fn_Tick);
ok &= resolve(L"Shutdown", &fn_Shutdown);
ok &= resolve(L"OnItemMineBlock", &fn_ItemMineBlock);
if (!ok)
{
@@ -227,6 +229,13 @@ void DotNetHost::CallShutdown()
if (fn_Shutdown) fn_Shutdown(nullptr, 0);
}
int DotNetHost::CallItemMineBlock(const void* args, int sizeBytes)
{
if (!fn_ItemMineBlock || !args || sizeBytes <= 0)
return 0;
return fn_ItemMineBlock(const_cast<void*>(args), sizeBytes);
}
void DotNetHost::Cleanup()
{
}