Download
Direct Download Link
Github Release
Github Page
Discord
cModLoader
cModLoader is a mod loader for most
PC versions of
vanilla Terraria.
It's goal it to allow
modders to easily get full access to Terraria and its
code.
So far its supported on
Windows and
Linux and works in most versions.
It is not meant to replace
tModLoader, in fact the original purpose of
cModLoader was so mods could exist without the
overhead/changes of tModLoader, which fundamental is very different then Terraria
(1).
cModLoader runs completely without 'modifying'
(2) Terraria's code (editing the original code).
It makes use of
Xna,
FNA or Terraria itself to '
hook'
functions and events to execute
arbitrary code.
This allows
cModLoader to work without
patches from
MonoMod/
Harmony,
Mono.cecil or
TerrariaInjector.
Although
cModLoader can run without patches, it contains a built in
IL code patcher that uses Mono.cecil, which makes it easy to patch or replace a functions.
These patches are done before the Terraria
assembly loads therefore are safer then
runtime patches
(3).
How cModLoader works
cModLoader is basically a wrapper for Terraria. When installing
cModLoader the
Terraria.exe file gets renamed and
cModLoader takes its place.
This then opens
cModLoader when Terraria is opened from
Steam or from a short cut.
Because
cModLoader is a wrapper it can basically control Terraria however it wants, for example, dlls are loaded by
cModLoader rather then Terraria to allow mod dlls to load.
And because
cModLoader gets to run Terraria, its able to decide what occurs before Terraria starts like load content/mods or patch the Terraria executable.
Most notably
cModLoader does not reference Terraria, therefore can be built without needing Terraria, it technically uses reflection for everything but does some optimization to make it faster.
There is also an option to do a "virtual" lunch which does not move Terraria, so you could launch Terraria from steam and get vanilla and then launch Terraria from the cModLoader launcher to get modded.
Features
Although
cModLoader does offer many features, its not meant to be tModLoader, and therefore does not contain many features like the ability to add
items or other stuff.
cModLoader offers, an IL patcher, config manager, launcher (very primitive), native window system for Windows (using
Forms) and Linux (using
SDL3 and partially SDL2), a custom
Dynamic class meant to replace and improve
reflection, and a lot more.
Most of the features added are for comparability with every versions of Terraria such as a UI system that basically reimplements Terraria's UI while also being compatible with older versions that did not use the modern UI
(4).
The native window system was also added because Linux Terraria can not run Windows Forms.
Mod Development
Developing a mod for
cModLoader is fairly easy i think. It does basically requires you to know how Terraria works so if you don't, good luck.
Basically you create a new c# project using
.net Framework 4.5.2 and reference the
cModLoader exe, you may also need to reference other Xna assemblies as well.
First you need to inherit the
cModLoader.ModComponents.PreMod class, this is used to do stuff before Terraria starts like define patches, its also where you say what Terraria versions your mod is compatible with.
The
RegisterMod() function is where you create a new instance of your mod which is a class that inherits
cModLoader.ModComponents.Mod.
From there you can do stuff, im sure you can figure it out, but keep in mind
cModLoader is not tModLoader, you basically need to do almost everything.
There may or may not be an example mod you can look at as well,
cModLoader itself is a mod within itself so you can use
cModLoader as a reference.
You can technically reference Terraria in your mod and use it like you would be with
cModLoader or any other assembly however this will likely only work on the versions of Terraria you reference.
Future
The future of
cModLoader is uncertain, on one hand it would be very useful to have a mod loader that works in any versions of Terraria.
On the other, options to easily add items would be ideal, but its a lot of work required to make it work.
cModLoader is affectively a boiler plate program at this point in development, it doesn't have much to show, other then it loads mods and uses Terraria's UI.
I may consider adding the ability to add items, NPCs and more but for the time being its not the main goal of
cModLoader.
History
cModLoader was created in 2025 original for
Terraria version 1.4.4.9 as a way of loading mods.
It was original created in
c++ and used
dll injection with unmanaged dlls to run code in Terraria.
This versions was called
cModLoader Legacy and is still available although does not work with modern Terraria.
Before cModLoader
Before
cModLoader was even conceived, there was TerraHacker, a non-released memory reader/writer for Terraria.
It was not capable of running normal code in Terraria but could modify memory to run arbitrary
assembly code.
It was shown off in
Crawdad105's Discord server where it was capable of changing NPC textures and moving projectiles and in at least one
Youtube video was capable of listing the number of
NPCs in the game.
TerraHacker came from "PlayerBase Finder"/"Health Hack", created in 2023, which could find the 'player base' (the memory location where the player class is located) and modify the player's health.
This was also shown off in Crawdad105's Discord server on the 17th of September, 2023.
Notes
(1) tModLoader is 64 bit while Terraria on Windows in 32 bit. On Linux it is also 64 bit but tModLoader adds a lot of other features and modifies to the code that can cause slight variations in how Terraria works.
There often not large changes however the fact its different in the first place can be problematic when you need to replicated exactly Terraria.
(2) As in the original code does not change however they may be compleat skipped, override or wrapped, but no code is 'broken' in that it's not been segmented or split.
(3) I don't know if this is entirely true, i would assume that verifiable IL modifications that are protected by the runtime seems safer then modifying function pointers or intercepting the JIT compiler and modifying stuff that way.
(4) Modern UI referring to versions after and including 1.3 where the UI used actual drawn elements rather then just string/text like pre-1.3
Footer
Stuff