Pilynth is a library which enables you to write Minecraft mods entirely in C#. It transpiles the CIL bytecode of your project into Java bytecode, and wraps it all up into a JAR, ready to run.
It is very much in the alpha phase, and probably not ready for much more than the most basic mods.
Pilynth is available as a NuGet package for .NET 8. A ready to run example project can be found in its own repository.
To create a mod, you must include a class that inherits FabricMod in the assembly. The Identifier and Version attributes must also be used, the former which will be used as the mod namespace. The ModBuilder class can then be used to configure and build the mod.
// Program.cs
new Pilynth.ModBuilder(args)
.Version("1.21.3")
.Build();// mod/Main.cs
using Pilynth.Fabric;
namespace ExampleMod;
[Identifier("pilynth_example")]
[Version("1.0.0")]
public class ExampleMod : FabricMod
{
public void onInitialize()
{
Logger log = LoggerFactory.GetLogger("pilynth_example");
log.Info("hello pilynth world!");
}
}Multiple ModBuilder instances can be created to build the mod with different settings, such as building for multiple Minecraft versions.
A useable JAR can be generated by running the project.
> dotnet run
# The final JAR(s) will be placed in /build