mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-06-30 16:22:08 +00:00
Rebrand LegacyForge to Weave Loader
Rename across entire codebase: - LegacyForge -> WeaveLoader (identifiers, namespaces, classes, DLLs) - LegacyForgeRuntime -> WeaveLoaderRuntime (C++ project) - LegacyForge.API/Core/Launcher -> WeaveLoader.API/Core/Launcher (C# projects) - [LegacyForge] -> [WeaveLoader] (log prefixes) - legacyforge -> weaveloader (config files, log files, backup suffixes) - Display name "Weave Loader" in README, CONTRIBUTING, LICENSE
This commit is contained in:
16
WeaveLoader.API/Entity/EntityDefinition.cs
Normal file
16
WeaveLoader.API/Entity/EntityDefinition.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace WeaveLoader.API.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// Fluent builder for defining entity properties.
|
||||
/// </summary>
|
||||
public class EntityDefinition
|
||||
{
|
||||
internal float WidthValue = 0.6f;
|
||||
internal float HeightValue = 1.8f;
|
||||
internal int TrackingRangeValue = 80;
|
||||
|
||||
public EntityDefinition Width(float width) { WidthValue = width; return this; }
|
||||
public EntityDefinition Height(float height) { HeightValue = height; return this; }
|
||||
public EntityDefinition TrackingRange(int range) { TrackingRangeValue = range; return this; }
|
||||
public EntityDefinition Size(float width, float height) { WidthValue = width; HeightValue = height; return this; }
|
||||
}
|
||||
38
WeaveLoader.API/Entity/EntityRegistry.cs
Normal file
38
WeaveLoader.API/Entity/EntityRegistry.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
namespace WeaveLoader.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 WeaveLoader 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user