feat(modloader): add managed block callbacks and ruby block examples

This commit is contained in:
Jacobwasbeast
2026-03-08 18:24:51 -05:00
parent d2be935ada
commit c6aac86e69
36 changed files with 2364 additions and 58 deletions

View File

@@ -22,7 +22,54 @@ internal static class NativeInterop
int lightBlock,
string displayName,
int requiredHarvestLevel,
int requiredTool);
int requiredTool,
int acceptsRedstonePower);
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern int native_register_managed_block(
string namespacedId,
int materialId,
float hardness,
float resistance,
int soundType,
string iconName,
float lightEmission,
int lightBlock,
string displayName,
int requiredHarvestLevel,
int requiredTool,
int acceptsRedstonePower);
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern int native_register_falling_block(
string namespacedId,
int materialId,
float hardness,
float resistance,
int soundType,
string iconName,
float lightEmission,
int lightBlock,
string displayName,
int requiredHarvestLevel,
int requiredTool,
int acceptsRedstonePower);
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern int native_register_slab_block(
string namespacedId,
int materialId,
float hardness,
float resistance,
int soundType,
string iconName,
float lightEmission,
int lightBlock,
string displayName,
int requiredHarvestLevel,
int requiredTool,
int acceptsRedstonePower,
out int doubleNumericBlockId);
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern int native_register_item(
@@ -78,6 +125,12 @@ internal static class NativeInterop
int harvestLevel,
float destroySpeed);
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl)]
internal static extern void native_configure_managed_block(
int numericBlockId,
int dropNumericBlockId,
int cloneNumericBlockId);
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl)]
internal static extern int native_configure_custom_tool_item(
int numericItemId,
@@ -145,6 +198,18 @@ internal static class NativeInterop
double spawnForward,
double spawnUp);
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl)]
internal static extern int native_level_has_neighbor_signal(nint levelPtr, int x, int y, int z);
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl)]
internal static extern int native_level_set_tile(nint levelPtr, int x, int y, int z, int blockId, int data, int flags);
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl)]
internal static extern int native_level_schedule_tick(nint levelPtr, int x, int y, int z, int blockId, int delay);
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl)]
internal static extern int native_level_get_tile(nint levelPtr, int x, int y, int z);
[DllImport(RuntimeDll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void native_subscribe_event(string eventName, IntPtr managedFnPtr);