The Ultimate Guide To Minecraft 1.11.2 Modding Tutorial S For 1

In this Minecraft Modding tutorial, we will be providing you with step by step instructions on how to get started with Minecraft modding while creating an awesome custom Sword that you'll get to play in the game.

Đang xem: Minecraft 1.11.2 modding tutorial

We'll be using Minecraft 1.12.2 as it is the version compatible with our current Minecraft courses. Newer versions may use different setup instructions.

As a rule of thumb, Minecraft mod code is not compatible from version to version. For example, 1.12 mods will not work with 1.13 and above.

You'll need a PC or Mac computer for this tutorial, as Chromebooks or mobile devices will not run the software properly.

At wtbblue.com we have taught over 30,000 students Minecraft coding, and have won numerous industry awards for online courses including a Parents' Choice Gold Award and CODiE Finalist for Best Coding and Computational Thinking Solution.

While we teach coding for kids, this guide can be used by teachers, parents, or anyone with an interest in creating a custom Sword Mod for Minecraft Forge.

We hope that you enjoy this free step by step guide to covering one of the first courses we teach in our Minecraft Modding series.

We'll cover the very basics of what you'll need to start Minecraft modding, and you will learn how to use Java, one of the most popular programming languages in the world.

We'll also teach you how to download and use the Eclipse IDE, a text editor used by professional developers at companies such as Facebook, Google, and Amazon.

We will continue to update this blog in the coming months and transition to more recent versions of Minecraft as they become stable for mod creation. Our next big course revision will take place after the upcoming Minecraft Caves and Cliffs Update.

*

Step 1: Set up Java Developer Kit (JDK)

We will need to download the Java Developer Kit that will let our Minecraft Modding in Eclipse work correctly.

You can find the download link HERE for JDK 8. The version of JDK you need is JDK 8 to work properly with Minecraft Modding.

*

The download page should automatically detect your platform and give you the correct download. The version I am downloading that is shown in the picture is for Windows 64-bit. However, you can click “Other platforms” to find versions for other operating systems. Click the “Latest release” button to begin your download.

Now the download of the executable file will start.

Once this is finished, find the file in your downloads folder and run the executable to install the JDK.

*

Run through the pop up window guide to install the JDK for your computer and click on each next keeping the default settings until the JDK finishes installing.

*

You will need to agree to the End-User License Agreement (EULA) to continue.

*

Let Java run its installation until it is finished.

*

Now that JDK is finished, we can set up our code editor in the next step.

Step 2: Set up your Text Editor

Before we begin Minecraft modding, we'll need to download some tools.

First, for this guide, we are going to download the Eclipse IDE, one of the most popular professional text editors for Java in the world.

To download the installer CLICK HERE and look for the Get Eclipse IDE 2020-06 Download area that looks like this:

*

Click the Download 64 bit button and the next page will appear where you can download. Click the Download button shown and wait for the Eclipse file to finish downloading.

*

Find the executable file in your download file and open it to launch the Eclipse installer.

*

When the launcher opens, select the Eclipse IDE for Java Developers.

*

Then on the next window, keep the default install location and then click the INSTALL button.

*

The next window will appear and you need to accept the agreement for Eclipse. 

*

Then the next window will prompt to make sure you accept the license Agreement.

Checkmark the “Remember accepted licenses” box and accept the Eclipse Foundation Software User Agreement.

*

Once this is accepted, you are almost done with the install.

Just accept the Eclipse Foundation certificate as shown in the image below.

*

Once this is done, Eclipse will be downloaded and ready for when we need to use it to write our code.

The next step is going to be installing the Java Developer Kit which will let our code work properly with Minecraft.

Step 3: Set up Forge

Next you will need to download the 1.12.2 version Minecraft Forge, as this will allow us to mod Minecraft 1.12.2. The instructions shown here should work for any Minecraft version from 1.12.2 onwards.

You can find the download link HERE, and just follow the instructions we've laid out below.

On this page you should see the latest and recommended version for Forge. Download the Recommended version Mdk (Mod Development Kit) file for 1.12.2 as shown.

*

You'll be taken to Forge's advertisement redirect. You don't need to click on anything but the “Skip” button in the top-right corner, highlighted in red below.

*

Once this is downloaded, find it in your downloads folder, right click on the zipped up folder and then select Extract All…

*

On the next window click the Extract button.

*

This is going to be our project folder. So we want to make a copy and rename and move it to a new location on our computer.

We recommend putting a copy in your Documents folder or on your Desktop.

Right click and copy and paste the unzipped forge folder in a location you want and make sure to rename it to something descriptive.

In this example we will be naming it ForgePractice.

Read more: Minecraft How To Get Grass To Grow On Dirt Blocks, Block Of The Week: Grass

*

We have the Forge folder set up and are ready to create our new project!

Step 4: Install Pinta

Next we want to install the Pinta program we will use to change the look of our Sword Texture.

Go the the link HERE to get to the Pinta download page.

On this page click the download link for the OS you are on Mac or Windows.

*

Once you have the installer downloaded, open it up in your downloads folder and run the installer.

Fully install the application and accepting any agreements along the way. 

*

Close out of the installation when it is finished.

*

Now we have the programs we need to create our mod.

The next step is creating our project.

Step 5: Create Your Project

Launch Eclipse. It will ask you to choose a directory to use as Eclipse's workspace. This directory needs to be outside of your project folder. I recommend creating “eclipse-workspace” inside of your Documents folder. You can also just use the default location Eclipse gives you.

*

Eclipse will now open up. Close out of the Welcome tab.

*

In the Package Explorer, click on “Import projects…”

*

In the “Import” window that pops up, select “Existing Gradle Project” and click Next.

*

On the next page, click “Browse…” and select your project folder. Click “Select Folder”.

*

You should now see this. Click Finish. It should close after importing the project.

*

You should now see your default workspace view:

*

Go into the Gradle Tasks tab at the bottom of the window. It looks like this:

*

Expand the “fg_runs” task folder, and double-click on genEclipseRuns to run the task to set up our Minecraft launch configuration. Once it's finished running, we need to import our new launch configurations.

Go to the File menu of Eclipse near the top of the window. Click it, then click Import in the menu that appears.

*

Click the arrow next to Run/Debug in the menu that appears. Select Launch Configurations and click Next.

*

In the next menu, checkmark the box next to ForgePractice (or your folder name if you named it differently). It should show the runClient and runServer configurations selected. Click Finish.

*

Just one more edit before we can run Minecraft. Click the arrow next to the green Run button. Click on Run Configurations. You can also find this from the Run menu at the top of Eclipse.

*

Go to the Environment tab in the new window that appears. Go to the MC_VERSION line in the list.

*

Double-click on the ${MC_VERSION} value and change it to 1.12. Then click Run. Your Minecraft should now launch from Eclipse.

*

You can close out of the Minecraft Client; you should now be able to run the game just by clicking the green “Run” button in the toolbar near the top of Eclipse.

We are now ready to start Creating a Mod and learning Java!

Step 6: Make Your Own Mod – A Custom Sword!

Finally our Minecraft modding tutorial begins!

Once Eclipse is loaded up and opened, we are ready to start typing in java code.

Let’s open an example Mod java file that is provided for us that we will be starting from.

On the left side of the window, open the project folder by clicking the arrow next to the name. Your project folder will likely be named with the same name you gave to the folder in Documents.

Now open the “src/main/java” folder and then open the “com.example.examplemod” file and inside you will find ExampleMod.java.

Double click this to open up this java code file.

*

This file contains our starting code. It contains our mod ID and name. The first thing we want to do in ExampleMod is find the lines that define our MODID and NAME.

Change the MODID to sword making sure it is all lower case.

This is the unique ID for our mod we will make.

The NAME is the name of the mod as it will appear in Minecraft.

Name this what you prefer.

Make sure these are inside quotation marks because they are String variables.

Strings are variables that are words or characters.

(We will be covering variables in a little bit).

*

Go to the src/main/resources folder and open the mod info file. 

Open mcmod.info here and change the modid to “sword” and change the name, description, author, and credits to whatever you like.

Make sure these are inside quotation marks again as they are Strings that will be read by the code.

*

The next step is to create variables for our ToolMaterial and sword.

Place these lines beneath the private static Logger logger line in ExampleMod.java.

Variables are helpful in code because they act as boxes with names that store information inside of them we can use easily.

What we are doing here is we are creating to variables myToolMaterial and mySword.

The types of variables are the ToolMaterial and Item.

*

Once we have the variables created, we need to import the code files that define what a ToolMaterial and an Item do.

We can do this by mousing over the red error lines underneath ToolMaterial and Item.

In the dropdown list that appears, import the code shown.

Start with the ToolMaterial as shown below.

*

Next import the Item as shown below.

*

Now because we are making a customized sword in Minecraft, we need to define what the material is for the sword tool is we will be using.

This is where we define our custom tool material variable we created.

Go into the preInit function shown and inside below the logger line, write out the myToolMaterial line shown.

*

What that line does is it fills in our myToolMaterial variable with information on what the material does for tools we apply it on.

We will be applying this tool material to our sword. But let’s actually fill in the name, harvest level, damage etc.

Change out the name to a String variable that is the material name.

You can name this whatever you like.

The harvest level indicates which minerals it can get resources from.

If we applied this material to a pickaxe, this is where we would define if it can get diamonds from Diamond Ore.

Putting this at 4 lets it mine whatever we want it to.

maxUses is how many times we can use it before it breaks, the efficiency is applied for harvesting tools for how quickly it will mine or harvest a block.

The damage is how much damage it will do when you hit an entity with it.

The enchantability is related to how easy it is to enchant.

*

After this material line add in a definition for what our sword is.

This line defines the sword as a new class called CustomSword. 

*

We need to create this new class and we do that by mousing over the red error line and clicking

Create class ‘CustomSword’. 

*

A new window will open up, keep these values at the default settings and just click Finish.

*

This will create a new Java code file CustomSword and automatically open it up for it.

This is a Class which is code that defines what the CustomSword is and how it behaves.

What is convenient for us is we can make sure to change the import and public class lines to say “ItemSword” instead of “Item” and this defines our class with all of the information that already exists for swords in Minecraft.

This lets us swing it and damage creatures as well as pick it up and drop it and any small interaction a sword will have in the code.

*

Now what we need to do is add a constructor for our class.

This defines how the sword is made. Think of it as how blueprints are used when creating buildings.

We are defining specific rules for how our sword will be created.

*

Once the constructor is added in, change it to remove the Material reference in the parentheses and then fill in our ExampleMod.myToolMaterial.

After these changes are made, we need to set the RegistryName, UnlocalizedName, and CreativeTab for our sword.

The Registry and Unlocalized names of our sword need to specifically be “my_sword” because these are the names our code uses to identify our sword and link our texture to it.

The CreativeTab can be changed to the tab you want the sword to appear in.

We chose COMBAT but there is a list that will appear where you can choose the tab you want your sword to be in.

Read more: Wow Classic Favor For Krazek

*

Once this is done, our class is ready to go.

We need to create a new java class that we will use to register our sword into Minecraft.

Go to the Package Explorer on the left side of Eclipse and right click on the com.example.examplemod package and create a new Class (as shown below).

Leave a Comment