Skip to playerSkip to main content
  • 3 months ago
Time to start coding and make our very first mod. It won't be anything huge or fancy, but building a pyramid starts with moving a grain of sand.

Download Luanti: https://www.luanti.org/downloads/

https://www.nathansalapat.com/LMC/02-first-mod
https://nathansalapat.com/SocialMedia
https://nathansalapat.com/support-me
Transcript
00:00In this video, we'll be making our first mod.
00:04As you can see, it's going to be pretty basic, just a full grass node and recipe.
00:08The first step is to create a new directory in our mods directory for all the mod files.
00:12We're going to call our first mod grass, so we'll create a directory called grass.
00:16This mod is going to be very basic, so we're only going to need two files,
00:20init.lua and mod.conf.
00:24You can create these in the file browser or in the code editor.
00:28I'm going to open the project directory in Pulsar and create the two new files.
00:33init.lua will hold the actual code for the mod.
00:36mod.conf stores some configuration data that tells Luanti about the mod.
00:40Every mod will need, at very least, these two files.
00:43We'll take care of the mod.conf file first.
00:46Luanti expects a few different bits of data.
00:49A name, title, description, dependencies, and an author.
00:53The name is the internal name of the mod.
00:55All nodes and items will be named with name colon something.
00:59The title is a human-friendly name and will be displayed in the mod selection dialog in Luanti.
01:05For this mod, we'll just use grass for both.
01:07The description is a short sentence explaining what the mod is, does, adds, etc.
01:12Dependencies tell Luanti what your mod needs or can use.
01:16We'll cover them more in a later video.
01:19This mod will only depend on default.
01:21Lastly, the author should be set to your content database username if you have an account there.
01:26Now, onto writing some actual code.
01:28We'll start with registering a new node called grass-grass.
01:32Remember, every node in this mod needs to start with grass colon.
01:36The description will be shown when hovering the node in most inventory screens.
01:45The tiles are the textures that Luanti will render on the faces of the node.
01:50If all the faces have the same texture, we only need to list the texture once.
01:54We'll cover this more in a future video.
01:56Groups can do many different things.
01:59In this case, the crumbly group is needed for tools, so Luanti knows what tools should be able to break the node.
02:05The soil group is used by other mods, but we'll just include it for compatibility.
02:10When we break this node, we don't actually want to get back to full grass block, but rather dirt.
02:16So, we'll tell the engine that on breaking, the node should drop default dirt.
02:21We can do a lot more with the drop table, but we'll cover that more in another video.
02:26This is a really basic node registration.
02:29Nodes can have callbacks so that they're more interactive, but for the time being, this will suffice.
02:34Right now, there is no way to craft this node.
02:37We can get it via creative or using the give command, but it would be really nice to be able to craft it.
02:42So, let's add a craft recipe.
02:44This is structured a bit different than the node registration.
02:47We use an output to say what the node or item is that's created.
02:52The recipe is a table, and the default craft grid is a 3x3 square.
02:56So, we have 9 items max we can use.
02:58We need to know the item strings for each ingredient.
03:01A blank entry just means the inventory slot should be empty.
03:05How do we know the item strings though?
03:07There are many different items in a game, and it would be nearly impossible to ever remember all of them.
03:12The easiest way is to open Luanti, go into settings, click on the user interfaces heading on the side, and check the append item name option.
03:22Now, if we launch a world with creative enabled, we can search for any item and hover on it in inventory to get the item string.
03:29Some inventory mods will also give us this data without enabling this option.
03:33We want to use grass and dirt to make the full grass block, but there are several different stages of grass in the game.
03:40Thankfully, they all drop the same item.
03:43So, we can just use default colon grass underscore one in the recipe.
03:48Our recipe will be one dirt in the center, with one grass on top, right, bottom, and left.
03:54Launching a world, with our new mod enabled, we can dig up some dirt, collect a bit of grass, and craft our new node.
04:03Let's add another recipe, just for fun.
04:06This recipe will just be one dirt and one grass.
04:09Our table doesn't need to have two rows of blanks, so we can put the entire recipe on one line.
04:14We'll just set our output to be default dirt underscore width underscore grass.
04:19Mods can make recipes for nodes that other mods provide.
04:23We just need to make sure that the other mods we want to use items from are listed in our dependencies in the mod.com file.
04:33Well, that wraps this lesson up, but before you go, homework!
04:39Add the other grasses to this mod, so we can craft full grass nodes of all the grasses, and make craft recipes for them as well.
04:47There's a link to a completed mod on the related webpage.
04:52Thank you!
04:53Thank you, correct.
04:55I'll show you all the instructions.
04:57Don't know your instructions, so we can save the water and Geb Jay.
05:02It's for the next page!
05:03We can use the calculations of the behav.
05:04You can use the neurologic entrar, so we can use the problem.
05:08We can use the tools to make...
05:09...we can use the brain as well.
05:11We can use the dificultness of the system, and use the system.
05:14The reason should be the next part, so we can use the system to control the system.
05:16We can use the documentation and use the system.
05:17The idea is 길 and need to understand those things.
Be the first to comment
Add your comment

Recommended