mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-06-22 20:35:33 +00:00
Initial commit: LegacyForge mod loader for Minecraft Legacy Edition
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
This commit is contained in:
39
LegacyForge.API/Identifier.cs
Normal file
39
LegacyForge.API/Identifier.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
namespace LegacyForge.API;
|
||||
|
||||
/// <summary>
|
||||
/// A namespaced identifier in the form "namespace:path" (e.g. "minecraft:stone", "mymod:ruby_ore").
|
||||
/// </summary>
|
||||
public readonly record struct Identifier
|
||||
{
|
||||
public string Namespace { get; }
|
||||
public string Path { get; }
|
||||
|
||||
public Identifier(string ns, string path)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(ns);
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(path);
|
||||
Namespace = ns;
|
||||
Path = path;
|
||||
}
|
||||
|
||||
public Identifier(string id)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(id);
|
||||
|
||||
var colonIndex = id.IndexOf(':');
|
||||
if (colonIndex < 0)
|
||||
{
|
||||
Namespace = "minecraft";
|
||||
Path = id;
|
||||
}
|
||||
else
|
||||
{
|
||||
Namespace = id[..colonIndex];
|
||||
Path = id[(colonIndex + 1)..];
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString() => $"{Namespace}:{Path}";
|
||||
|
||||
public static implicit operator Identifier(string id) => new(id);
|
||||
}
|
||||
Reference in New Issue
Block a user