mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-05-21 21:24:30 +00:00
SKSE-style external mod loader with zero game source modifications. - LegacyForge.Launcher: C# console app that injects runtime DLL into game process - LegacyForgeRuntime: C++ DLL with PDB symbol resolution, MinHook function hooking, and .NET CoreCLR hosting - LegacyForge.Core: C# mod discovery and lifecycle management - LegacyForge.API: Fabric-style mod API with namespaced string IDs, fluent property builders, and event system - ExampleMod: Sample mod demonstrating block/item registration
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
namespace LegacyForge.API.Entity;
|
|
|
|
/// <summary>
|
|
/// Represents an entity type that has been registered with the game engine.
|
|
/// </summary>
|
|
public class RegisteredEntity
|
|
{
|
|
public Identifier StringId { get; }
|
|
public int NumericId { get; }
|
|
|
|
internal RegisteredEntity(Identifier id, int numericId)
|
|
{
|
|
StringId = id;
|
|
NumericId = numericId;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Entity registration via the LegacyForge registry.
|
|
/// Accessed through <see cref="Registry.Entity"/>.
|
|
/// </summary>
|
|
public static class EntityRegistry
|
|
{
|
|
public static RegisteredEntity Register(Identifier id, EntityDefinition definition)
|
|
{
|
|
int numericId = NativeInterop.native_register_entity(
|
|
id.ToString(),
|
|
definition.WidthValue,
|
|
definition.HeightValue,
|
|
definition.TrackingRangeValue);
|
|
|
|
if (numericId < 0)
|
|
throw new InvalidOperationException($"Failed to register entity '{id}'.");
|
|
|
|
Logger.Debug($"Registered entity '{id}' -> numeric ID {numericId}");
|
|
return new RegisteredEntity(id, numericId);
|
|
}
|
|
}
|