mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-05-22 05:34:36 +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:
52
ExampleMod/ExampleMod.cs
Normal file
52
ExampleMod/ExampleMod.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using LegacyForge.API;
|
||||
using LegacyForge.API.Block;
|
||||
using LegacyForge.API.Item;
|
||||
using LegacyForge.API.Events;
|
||||
|
||||
namespace ExampleMod;
|
||||
|
||||
[Mod("examplemod", Name = "Example Mod", Version = "1.0.0", Author = "LegacyForge",
|
||||
Description = "A sample mod demonstrating the LegacyForge API")]
|
||||
public class ExampleMod : IMod
|
||||
{
|
||||
public static RegisteredBlock? RubyOre;
|
||||
public static RegisteredItem? Ruby;
|
||||
|
||||
public void OnInitialize()
|
||||
{
|
||||
RubyOre = Registry.Block.Register("examplemod:ruby_ore",
|
||||
new BlockProperties()
|
||||
.Material(MaterialType.Stone)
|
||||
.Hardness(3.0f)
|
||||
.Resistance(15f)
|
||||
.Sound(SoundType.Stone)
|
||||
.Icon("ruby_ore"));
|
||||
|
||||
Ruby = Registry.Item.Register("examplemod:ruby",
|
||||
new ItemProperties().MaxStackSize(64));
|
||||
|
||||
Registry.Recipe.AddFurnace("examplemod:ruby_ore", "examplemod:ruby", 1.0f);
|
||||
|
||||
GameEvents.OnBlockBreak += OnBlockBroken;
|
||||
|
||||
Logger.Info("Example Mod initialized! Ruby ore and ruby registered.");
|
||||
}
|
||||
|
||||
private void OnBlockBroken(object? sender, BlockBreakEventArgs e)
|
||||
{
|
||||
if (RubyOre != null && e.BlockId == RubyOre.StringId.ToString())
|
||||
{
|
||||
Logger.Info($"Ruby ore broken at ({e.X}, {e.Y}, {e.Z})!");
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTick()
|
||||
{
|
||||
// Per-tick logic goes here
|
||||
}
|
||||
|
||||
public void OnShutdown()
|
||||
{
|
||||
Logger.Info("Example Mod shutting down.");
|
||||
}
|
||||
}
|
||||
17
ExampleMod/ExampleMod.csproj
Normal file
17
ExampleMod/ExampleMod.csproj
Normal file
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>ExampleMod</RootNamespace>
|
||||
<AssemblyName>ExampleMod</AssemblyName>
|
||||
<Description>Example mod for LegacyForge demonstrating the mod API</Description>
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LegacyForge.API\LegacyForge.API.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user