From 2c7e9bed3734da2cb80ec5352818129b8bdafe38 Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 12 Jan 2018 23:54:29 -0800 Subject: [PATCH] Minor code and documentation cleanup. (#4664) --- README.txt | 9 ++++++--- .../java/com/example/examplemod/ExampleMod.java | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.txt b/README.txt index b45931f..82be8dc 100644 --- a/README.txt +++ b/README.txt @@ -14,6 +14,9 @@ Source pack installation information: Standalone source installation ============================== +See the Forge Documentation online for more detailed instructions: +http://mcforge.readthedocs.io/en/latest/gettingstarted/ + Step 1: Open your command-line and browse to the folder where you extracted the zip file. Step 2: Once you have a command window up in the folder that the downloaded material was placed, type: @@ -24,7 +27,7 @@ Linux/Mac OS: "./gradlew setupDecompWorkspace" Step 3: After all that finished, you're left with a choice. For eclipse, run "gradlew eclipse" (./gradlew eclipse if you are on Mac/Linux) -If you preffer to use IntelliJ, steps are a little different. +If you prefer to use IntelliJ, steps are a little different. 1. Open IDEA, and import project. 2. Select your build.gradle file and have it import. 3. Once it's finished you must close IntelliJ and run the following command: @@ -33,14 +36,14 @@ If you preffer to use IntelliJ, steps are a little different. Step 4: The final step is to open Eclipse and switch your workspace to /eclipse/ (if you use IDEA, it should automatically start on your project) -If at any point you are missing libraries in your IDE, or you've run into problems you can run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not effect your code} and then start the processs again. +If at any point you are missing libraries in your IDE, or you've run into problems you can run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not affect your code} and then start the processs again. Should it still not work, Refer to #ForgeGradle on EsperNet for more information about the gradle environment. Tip: If you do not care about seeing Minecraft's source code you can replace "setupDecompWorkspace" with one of the following: -"setupDevWorkspace": Will patch, deobfusicated, and gather required assets to run minecraft, but will not generated human readable source code. +"setupDevWorkspace": Will patch, deobfuscate, and gather required assets to run minecraft, but will not generate human readable source code. "setupCIWorkspace": Same as Dev but will not download any assets. This is useful in build servers as it is the fastest because it does the least work. Tip: diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java index f01de14..42a155b 100644 --- a/src/main/java/com/example/examplemod/ExampleMod.java +++ b/src/main/java/com/example/examplemod/ExampleMod.java @@ -4,17 +4,28 @@ import net.minecraft.init.Blocks; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import org.apache.logging.log4j.Logger; -@Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION) +@Mod(modid = ExampleMod.MODID, name = ExampleMod.NAME, version = ExampleMod.VERSION) public class ExampleMod { public static final String MODID = "examplemod"; + public static final String NAME = "Example Mod"; public static final String VERSION = "1.0"; - + + private static Logger logger; + + @EventHandler + public void preInit(FMLPreInitializationEvent event) + { + logger = event.getModLog(); + } + @EventHandler public void init(FMLInitializationEvent event) { // some example code - System.out.println("DIRT BLOCK >> "+Blocks.DIRT.getUnlocalizedName()); + logger.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } }