tModLoader CLib

Corinna

Terrarian
Join my discord! Join the CMod/CLib Discord Server!
Could always use help with my wiki or project itself!

CLib

GitHub: aberna01/CLib

What is ClLib?
Clib is an open source collection of different methods/tools to help you solve problems fast with easy to remember names almost as if you were typing pseudocode. However it also offers a few custom data structures with more being worked on and planned on soon!

Data Structures - Data structures is a concept probably familiar to those who've dived into the source code, what I mean when I say data structures is basically a self contained object that collect, edit, and save data useful to some task. These structures themselves are like packages that you can refer to by referencing them.

Examples you may have seen in source code: DrawData - a structure that encompasses information for spritebatch's draw commands.
Data structures I've created myself so far is mostly the DrawText object as it was easy to follow the pattern. I try to make as much use of pre written code as I can when designing these structures.

Planned Data Structures - Animation and dynamic plant life. Some may have already seen my proof of concept for real time spreading and growing plants, I'll continue to work on that and also try to set up a more userfriendly animation system when it comes to entities.

Encapsulated Static Methods and Enums - These are intended to be used inside hooks that TML already provides.

Here's a random specific example - in an projectile's AI hook you can run one of my static methods based on its location to get the tiles around and determine if the projectile is approaching a solid target. I may add actual code snippets on how I implement this library in my own projects but for now you get the idea.

> In other words, when you're making a reference to a static method of another class, if you were to simply use a 'using' statement, you would have to call that method by typing 'Class.Method' in a method body of the current class you're in. However if you do
C#:
using static Class.Method;
you can get the same results by only typing
C#:
Method(Parameters);


>>> To use and reference in visual studio:
Make sure that you put CLib in the mod references line of your mod's code, I didn't know that myself and couldn't compile my own mod for the longest time.
sMhlM9G.png

khZPGQp.png

There should be a directory for assemblies in visual studio, make sure to drag and drop the dll file into there or right click on your project and choose 'Add Reference'
b38xT48.png

I could go on and on about what I've put in my library, and much of it is not complete, but that will get me nowhere. I've been working on this for about a year now. If there's any problems or issues in the code feel free to contact me on discord or pm, I'm updating this pretty much every day, alone, so far.
 
Back
Top Bottom