70 likes | 298 Views
Introduction to Minecraft Forge. CSCI 3130 Summer 2014. Installing Forge . Make sure JDK 7 (not 8) is installed Download and install Minecraft from https:// minecraft.net/download Download Minecraft Forge from http://files.minecraftforge.net /
E N D
Introduction to Minecraft Forge CSCI 3130 Summer 2014
Installing Forge • Make sure JDK 7 (not 8) is installed • Download and install Minecraft from https://minecraft.net/download • Download Minecraft Forge from http://files.minecraftforge.net/ • Choose the (Src) option under “Recommended” • In the folder where Minecraft Forge is expanded, open the command line • Run gradlewsetupDecompWorkspace –refresh-dependencies • Run gradlew eclipse • Open Eclipse and select the eclipse folder as your workspace
Using Eclipse with Forge • Source code for your mod is located in src/main/java • Minecraft’s (decompiled) source is located in ReferncedLibraries/forgeSrc • Run your mod be pressing the green arrow
Creating a Mod • Forge will create an example mod for you. • Your main class must have the @Mod annotation • Your init, function must have the @Event Handler Annotation
Creating a new Block • Create a new subclass of Block • Set its attributes • Register the block
Setting the name of a block • In src/main/resources • Create a new package called assets.modid.lang • Create a new file for your language (en_US.lang) is default • Add tile.blockname.name=Whatever your name should be
Going Further • All code from this tutorial is available at https://github.com/dyule/CSCI3130GildedAge • Many tutorials at http://www.minecraftforge.net/wiki/Tutorials/ • Warning: may be out of date • Use IDE and autocompletion to look for alterations to method names • Look at the source code of Minecraft to see how they do things • Sometimes variable names are obfuscated • Look at the source code of existing mods • Don’t just copy and paste though