Magichem - A Minecraft Mod

Continuing the legacy of Thaumcraft with an addon for Mana and Artifice. Currently in active development.

Notable Relevant Skillsets

Project Management, Asset Creation, OpenGL, Java, Reverse Engineering, Game Design

a cell phone on a table
a cell phone on a table
a cell phone on a table
a cell phone on a bench
a cell phone on a bench
a cell phone on a bench

Minecraft has a large and thriving modding community, though unlike many games with such communities, there is no official API or official modding tools. Instead, users have developed two major modloaders/APIs.

MagiChem is an add-on mod to Mana and Artifice (an extensive mod about becoming a wizard) that adds alchemical gameplay. Items can be broken down into alchemical “elements” called essentia or “compounds” called admixtures using the mod’s devices, and those distilled materials can be used to create different items or to power alchemical paraphernalia.

Magic mods are set apart from technology mods by their style and spectacle.

MagiChem devices have a style that’s very distinctive and more “refined” than vanilla blocks—many of them incorporate diagonal slopes instead of only cuboids—but I’ve made a major effort to keep everything relative to vanilla’s pixel density of 16px/m. As the models are OBJ format rather than being built with Minecraft cuboids, they also perform better than a model of similar complexity.

Spectacle, on the other hand, is achieved by doing things in an overwrought fashion to evoke a sense of wonder.

Rather than using pipes to move essentia and admixtures around, devices and rituals pull them directly from jars in the world. The fluid flies through the air in a stream—internally called a “shlorp”—spattering out of its target and sticking to the environment briefly.

Spectacle, on the other hand, is achieved by doing things in an overwrought fashion to evoke a sense of wonder.

Rather than using pipes to move essentia and admixtures around, devices and rituals pull them directly from jars in the world. The fluid flies through the air in a stream—internally called a “shlorp”—spattering out of its target and sticking to the environment briefly.

Shlorps are drawn manually using OpenGL. First, the starting point and destination point (along with built-in default tangents) are used to generate a bezier curve. Then, at each visible point along the shlorp’s length I generate a forward vector by normalizing the difference between the active point and a point an absurdly tiny distance ahead of it.

The cross product of the forward vector and (0, 1, 0) makes a left vector, and the cross product of the left vector and the forward vector makes an up vector. The left and up vectors are multiplied by the shlorp’s thickness at that point, and the vectors and their negations are added to the absolute coordinates at that point on the bezier curve and stored for use as vertices.

Once all this vertex data is generated, quads are drawn between clusters and triangles between the first or final point and the adjacent vertex ring.

Shlorps are drawn manually using OpenGL. First, the starting point and destination point (along with built-in default tangents) are used to generate a bezier curve. Then, at each visible point along the shlorp’s length I generate a forward vector by normalizing the difference between the active point and a point an absurdly tiny distance ahead of it.

The cross product of the forward vector and (0, 1, 0) makes a left vector, and the cross product of the left vector and the forward vector makes an up vector. The left and up vectors are multiplied by the shlorp’s thickness at that point, and the vectors and their negations are added to the absolute coordinates at that point on the bezier curve and stored for use as vertices.

Once all this vertex data is generated, quads are drawn between clusters and triangles between the first or final point and the adjacent vertex ring.

Code Breakdown of Schlorp Rendering (Click here)

Some of the more advanced devices use magic circles as a visual element. Rather than simply scaling a texture in, I elect to draw the circle manually using OpenGL so that it can be fully configured (e.g. number of sides, thickness, what texture to use, and how much of it to draw for animating purposes).

First, I use some trigonometry to determine the length of the inner edge by using the height of the supplied texture area. From here, there are three potential cases. In the first and simplest case, the outer edge is less than or equal to the supplied texture area’s width and thus the entire section can be handled as a single face. In the second case, the outer edge is less than or equal to twice the width of the supplied texture area, so the section can be handled as two faces.

Otherwise, in the most complicated third case, a full length quad is drawn on the left and right extents, and then full length quads are drawn from the edges of the endcap quads until there’s no longer enough space for a full length quad, at which point a quad is drawn to fill the remaining space, starting from the leftmost edge of the supplied texture area. This can result in partial pixels, but adjusting the radius of the magic circle can correct for this.

Some of the more advanced devices use magic circles as a visual element. Rather than simply scaling a texture in, I elect to draw the circle manually using OpenGL so that it can be fully configured (e.g. number of sides, thickness, what texture to use, and how much of it to draw for animating purposes).

First, I use some trigonometry to determine the length of the inner edge by using the height of the supplied texture area. From here, there are three potential cases. In the first and simplest case, the outer edge is less than or equal to the supplied texture area’s width and thus the entire section can be handled as a single face. In the second case, the outer edge is less than or equal to twice the width of the supplied texture area, so the section can be handled as two faces.

Otherwise, in the most complicated third case, a full length quad is drawn on the left and right extents, and then full length quads are drawn from the edges of the endcap quads until there’s no longer enough space for a full length quad, at which point a quad is drawn to fill the remaining space, starting from the leftmost edge of the supplied texture area. This can result in partial pixels, but adjusting the radius of the magic circle can correct for this.

Code Breakdown of Magic Circle Rendering (Click here)

Among other sources, MagiChem is inspired by Thaumcraft, a very popular older mod that did a lot to define how magic mods looked and felt in the modded Minecraft ecosystem. Thaumcraft was closed source and its author decided to step away from modding, and its absence is felt quite strongly on modern versions of the game. I’m hoping my work scratches the community’s collective itch.

If you want to see the repo for yourself and explore my work, you can reach it here!

Among other sources, MagiChem is inspired by Thaumcraft, a very popular older mod that did a lot to define how magic mods looked and felt in the modded Minecraft ecosystem. Thaumcraft was closed source and its author decided to step away from modding, and its absence is felt quite strongly on modern versions of the game. I’m hoping my work scratches the community’s collective itch.

If you want to see the repo for yourself and explore my work, you can reach it here!

a cellphone leaning against a wall
a cellphone leaning against a wall
a cellphone leaning against a wall

Other projects

Steven Bostwick

Steven Bostwick

Steven Bostwick