This guide will walk you through creating a new mixin library for the MDK Package Libraries repository using JetBrains Rider.
Hey, thanks for wanting to contribute! Sharing code with the Space Engineers community is awesome, and I really appreciate you taking the time to do it.
That said, I need to be upfront about something: By contributing here, you're responsible for your own code and licensing. I recommend using the MIT License (it's simple and everyone understands it), but you can choose whatever open-source license you want. Just make sure you actually have the right to share what you're contributing, and understand that if there are any copyright issues, that's on you to handle.
I'm not here to play lawyer or referee licensing disputes - I'm just providing a platform for the community. If you're cool with that, let's build something great together!
- JetBrains Rider 2023.2+
- .NET Framework 4.8 SDK
- MDK2 installed
- Git
- Go to
https://github.com/malforge/mdk2-packagesand click Fork - In Rider, click Get from VCS on the welcome screen
- Enter your fork's URL:
https://github.com/YourUsername/mdk2-packages - Choose a local path and click Clone
- In Rider, go to File → New → Solution
- Search for "MDK Mixin" template
- Name your solution using the format:
YourName.MdkScriptMixin.LibraryName- For programmable block scripts onlyYourName.MdkModMixin.LibraryName- For mods onlyYourName.MdkSharedMixin.LibraryName- For both scripts and mods
- Set location to the
librariesfolder in your cloned repository - Check "Create directory for solution" (this creates the proper folder structure)
- Click Create
In your shared project folder (the one inside the solution folder), create these files:
_version- Version number:1.0.0_authors- Your name (one per line)_description- One-line description of your library_releasenotes- Version history (format:- 1.0.0then indented features)readme.md- Usage examples and API docs
Tip: Right-click the project → Add → New Item → Text File for metadata files (they have no extension)
Now you'll write the actual library code that you want to share with others.
- Right-click the shared project → Add → C# File
- Name your file (e.g.,
MyLibrary.cs) - Write your library code - classes, methods, utilities, etc.
- Add as many files as needed to organize your code
Important:
- For script mixins: Strongly recommended to use the
IngameScriptnamespace to avoid conflicts (programmable blocks don't use namespaces, making namespace mismatches easy to cause trouble). Mixins for mods do not need to follow this convention.
Tips:
- Keep code well-organized and commented
- Consider edge cases and error handling
- Make your API intuitive for other developers
The demo shows how to use your library and is required for packaging.
- Right-click the solution → Add → New Project
- Search for "MDK Programmable Block Script"
- Name it
YourLibraryName.Demo - Set location to your library's solution folder (same as the mixin project)
- Click Create
- Right-click the Demo project → Add → Reference
- Select Projects tab
- Check your mixin project (shows as Shared Project)
- Click OK
Edit Program.cs in the Demo project to show how to use your library:
partial class Program : MyGridProgram
{
public Program()
{
// Initialize your library
var myLib = new MyLibraryClass();
}
public void Main(string argument, UpdateType updateSource)
{
// Show library usage
}
}- Press
Ctrl+Shift+Bor click Build → Build Solution - Check for errors in the Build output
- Success means your library compiles and a NuGet package was generated
- Press
Ctrl+Kto open commit dialog - Stage all new files
- Commit message:
Add [YourLibraryName] mixin - Click Commit
- Press
Ctrl+Shift+Kand click Push
- Go to your fork:
https://github.com/YourUsername/mdk2-packages - Click Pull requests → New pull request
- Verify base is
malforge/mdk2-packages:main - Title:
Add [YourLibraryName] mixin - Describe what your library does
- Click Create pull request
- GitHub Actions will automatically test your build
- A maintainer will review your code
- Once approved and merged, your library is automatically published to GitHub Packages
Important: By contributing to this repository, you confirm that:
- You own the copyright to the code you're contributing, OR
- You have permission to share it under your chosen license
We strongly recommend using the MIT License for maximum compatibility and ease of use. However, you may choose any open-source license. You are responsible for:
- Ensuring your code doesn't infringe on others' copyrights
- Maintaining and enforcing your chosen license
- Handling any licensing disputes
The repository maintainer does not police or enforce individual library licenses and takes no responsibility for copyright or licensing issues.
- Always include
readme.mdwith usage examples - Use semantic versioning (1.0.0 = Major.Minor.Patch)
- Test in Space Engineers before submitting
- Press
Alt+Enteron errors for quick fixes - Use
Ctrl+Shift+Rfor refactoring options
Check out existing libraries in the repository for examples, or open an issue on GitHub!
This guide is part of the MDK Package Libraries documentation.