So you’ve seen all these amazing minecraft mods and now you want to code your own coding in java may seem daunting but i’m here to tell you it’s not by the end of this video you will have your very own item in minecraft there are two popular modding apis forge and fabric Both have their advantages and disadvantages but for this tutorial we’ll be coding a mod with fabric the less popular but lighter weight option now that we’ve chosen an api we are ready to set up our development environment to make things easy we can go to github.com fabricmc and download the example mod By clicking fabric example mod and then the button labeled code then download zip the fabric example mod is a neatly packaged template with all the files we need to create our mod once it’s done downloading we can unzip the folder and place it where we want to store our mod We can rename the folder to reflect the name of our mod for this tutorial i plan on creating a mod that adds mud blocks and balls to minecraft so i will call it llama’s mud now we can open the folder and begin configuring our mod we could start by deleting the license And readme files since those were made for the fabric github page before we start adding our item to the game we have to configure gradle open the gradle.properties file with any text editor this properties file is extremely important to your mod it sets the version of minecraft your Mod will run on the name of your mod the version number of your mod and the version of fabric api that your mod will depend on to simplify updating these options we will use a website by modmoose50 which allows us to pick a minecraft version and generate the values needed for the properties File since i’ll be making my mod for 1.16.2 i will copy the gradle properties for that version now we must configure our mod properties first we can set the version of our mod i’ll set mine to 0.0.1 since this will be the first version of my mod Although you could also leave it as 1.0.0 if you prefer that now we must set the maven group generally you want to follow the format of your username dot the name of your mod if there are multiple words in the name of your mod you can separate them with a period For example my maven group would be suited llama.llamas.muds you can also make references to a website you own for example if i had the website suitedlomas.com i would make my maven group com.suitedlamas.muds but squarespace didn’t sponsor this video so i’ll leave it as is finally we have to set our archive space Name this is just the name of your mod separated with dashes if it’s multiple words for example mine would be llamas-muds we can now save and close the gradle.properties file we are now ready to open our ide the program that we will use to code our mod For this tutorial i will be using visual studio code if you’re not familiar with coding i suggest that you use the same ide as me open visual studio code which i’ll be referring to as vs code from now on we can download several plugins to make our experience in vs code better geared Towards coding minecraft mods i’ve linked the most important plugins below all of them can be installed in one click through the browser once you have the plugins installed navigate back to vs code and click file open folder and select your mod folder vs code will begin importing the gradle project we Configured earlier once it is done we must import the minecraft and fabric api code which is required to begin coding our mod to do this click terminal new terminal this will you guessed it open a new terminal window since we configured gradle earlier it knows all the sources required for our project So we can just type the case sensitive command dot slash gradle w gen sources to download everything we need this can sometimes take a while once gradle is done generating sources type the command dot backslash gradle w vs code this will allow us to view or use mojang’s code and test our mod Quickly right in vs code without having to export it lastly we have to configure the fabric.mod.json file to tell fabric how to load your mod open that src folder then resources to reveal the file you can click on it once to edit it directly inside of vs code Firstly we have to set our mod id this is what minecraft uses to separate the blocks items biomes and other features you add from those of the base game the mod id cannot have any spaces or special characters in it so i will set mine to llamas mud all one word all lowercase Next we have to set the name of vermont this is where we can get fancy with all the special characters spaces and capitalizations we could possibly want i will need my mod llamas muds then we must set our mod description it’s generally a good idea to keep the description brief yet descriptive For mine i’ll write adds mud blocks and balls to minecraft the author of your mod is where your name goes you can list multiple authors by separating their names with commas the homepage and sources are not required you can leave these lines blank if you would like I’ll put a link to my twitter as the homepage but leave the sources field blank i’ll leave the license field to your discretion there will be links to common licenses and their layman’s explanations in the description for my mod i’ll be using cc by ncsa 3.0 Now we have to set the directory of our mod icon we can change the mod id to the name we set earlier since we will be changing the names of all the folders after we are finished editing the fabric mod json file the entry points tell fabric where all the Features of your mod are initialized so that the api knows to load them into the game we’ll change main to reflect the name we used earlier for our maven group plus your mod name with proper capitalization and no spaces so my main entry point would be suited llamas dot llamas Dot muds dot llamas muds it’s a real mouthful and finally we gotta update the mix and entry point mixins are a powerful tool for monitors that allow us to mix in code to vanilla minecraft but we’ll go over those in a later video now that we are finished configuring the Fabric mod json file we must update the names of the folders and files in our mod to reflect the changes we have made we have to put our main entry point file in the same place that we told fabric it would be for example i define my main entry point As suited llama.llamas.muds.lama’s muds to match this i will rename the net folder to suited llama the fabric mc folder to llamas and the example folder to mods if your mod contains more spaces in the name you may have to create new folders just be sure to move the content of the Example folder into the last folder in your chain now we must rename examplemod.java to also match the name at the end of our main entry point i’ll set the name of mine to llamasmud.java this is case sensitive this will cause an error in the java file which we must Also update to match the new file name the directory of this file is now suited llama slash llamas slash mods slash llamasmuds.java which matches what i put in my main entry point we will leave the mixin folder as is for use in a future tutorial now we Will expand the resources folder in the assets folder then change the name of the mod id folder to match our mod id i’ll change mine to llamas mods the last file we have to configure is mod id.mixins.json first we’ll rename the file and replace mod id with our actual mod id once again Then click on the file we must change the package value to our maven group with dot mixin on the end of it this will tell fabric where to load our mix-ins once we start making them we are now done configuring the development environment we can run the Game by clicking on the debug icon and then pressing the green play button if the game does not launch you can check the terminal to see the air i’ve listed common errors and their fixes in the description below now that we’ve configured our development environment correctly we can close the game and Begin coding our mod first we’ll add an item to do this open your main class mine is llamasmuds.java we must make an instance of our items that we can register it in our mod initializer type public static final item the name of your item i will be calling mine mud underscore ball equals New item new item dot settings dot group item group dot here we can define the tab that we want our item to appear in under the created menu i want my mud ball to appear in the miscellaneous top so i will select misc to fix the errors mouse over the Red underlines and import anything that needs importing now we must register our item in the mod initializer in order for it to appear in game to do this we will go inside of the on initialize method and type registry.register parentheses registry.item comma new identifier parentheses then your mod id Comma the name of your item parentheses comma the identifier you set for your item above when you launch the game you should have your very own item now we must add a model and texture for it to give your item a texture you must create a model json file in the Correct directory in vs code navigate to resources asset slash your mod id slash model item if any folders aren’t present make them next right click on the item folder and select new file you’ll want to name this file after your item’s in-game id for example my file will be named mud Underscore ball ball.json then type the following text while replacing your mod id with your actual mod id and your item name with the in-game id of your item this model file points to the texture of the item we must add the texture to our assets navigate to resources assets slash your mod id Slash textures item again if any folders aren’t present make them this is where you’ll put your item texture for my mod i created the simple mud ball texture that i will place in the folder your texture must be in a png format in order for the game to recognize it If you don’t have a texture you can use mine a link to it is in the description when you start the game your item should now be textured but it lacks any functionality we will cover that in a later tutorial so be sure to subscribe and hit that Bell icon to not miss any future videos Video Information
This video, titled ‘Minecraft, But I Show You How to Code a Modded Item!’, was uploaded by Suited Llama on 2020-08-30 23:41:31. It has garnered 593802 views and 17404 likes. The duration of the video is 00:09:13 or 553 seconds.
In this tutorial I show you how to code a Minecraft mod for the Fabric Mod Loader.
Modmuss50 gradle website: https://modmuss50.me/fabric.html
Downloads: JDK 11 (MUST HAVE): https://www.oracle.com/java/technologies/javase-jdk11-downloads.html Fabric Example Mod: https://github.com/FabricMC/fabric-example-mod Visual Studio Code: https://code.visualstudio.com/
VSCode Plugins: Java Debugger- https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug Java Extension Pack- https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack Java Language Support- https://marketplace.visualstudio.com/items?itemName=redhat.java Maven for Java- https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-maven Project Manager for Java- https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency Gradle Tasks- https://marketplace.visualstudio.com/items?itemName=richardwillis.vscode-gradle Visual Studio IntelliCode- https://marketplace.visualstudio.com/items?itemName=VisualStudioExptTeam.vscodeintellicode
Mud Ball Texture: https://imgur.com/DYPpuzy