mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-06-15 17:31:52 +00:00
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:
@@ -54,6 +54,48 @@ bool HookManager::Install(const SymbolResolver& symbols)
|
||||
LogUtil::Log("[WeaveLoader] Hooked Minecraft::init");
|
||||
}
|
||||
|
||||
if (symbols.pItemInstanceMineBlock)
|
||||
{
|
||||
if (MH_CreateHook(symbols.pItemInstanceMineBlock,
|
||||
reinterpret_cast<void*>(&GameHooks::Hooked_ItemInstanceMineBlock),
|
||||
reinterpret_cast<void**>(&GameHooks::Original_ItemInstanceMineBlock)) != MH_OK)
|
||||
{
|
||||
LogUtil::Log("[WeaveLoader] Warning: Failed to hook ItemInstance::mineBlock");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogUtil::Log("[WeaveLoader] Hooked ItemInstance::mineBlock (managed item callbacks)");
|
||||
}
|
||||
}
|
||||
|
||||
if (symbols.pItemMineBlock)
|
||||
{
|
||||
if (MH_CreateHook(symbols.pItemMineBlock,
|
||||
reinterpret_cast<void*>(&GameHooks::Hooked_ItemMineBlock),
|
||||
reinterpret_cast<void**>(&GameHooks::Original_ItemMineBlock)) != MH_OK)
|
||||
{
|
||||
LogUtil::Log("[WeaveLoader] Warning: Failed to hook Item::mineBlock");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogUtil::Log("[WeaveLoader] Hooked Item::mineBlock (managed item callbacks)");
|
||||
}
|
||||
}
|
||||
|
||||
if (symbols.pDiggerItemMineBlock)
|
||||
{
|
||||
if (MH_CreateHook(symbols.pDiggerItemMineBlock,
|
||||
reinterpret_cast<void*>(&GameHooks::Hooked_DiggerItemMineBlock),
|
||||
reinterpret_cast<void**>(&GameHooks::Original_DiggerItemMineBlock)) != MH_OK)
|
||||
{
|
||||
LogUtil::Log("[WeaveLoader] Warning: Failed to hook DiggerItem::mineBlock");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogUtil::Log("[WeaveLoader] Hooked DiggerItem::mineBlock (managed item callbacks)");
|
||||
}
|
||||
}
|
||||
|
||||
if (symbols.pExitGame)
|
||||
{
|
||||
if (MH_CreateHook(symbols.pExitGame,
|
||||
|
||||
Reference in New Issue
Block a user