To be honest I can't completely figure out what my issue is, so a quick run through of the process. I downloaded and extracted forge mod 12.2 (file name: forge-1.12.2-14.23.5.2854-mdk), then copied it and renamed the copied folder to Forge Mod Test (saved at "D:\Documents\Forge Mod Test"). On Eclipse, I import an Existing Gradle Project, with Project root directory "D:\Documents\Forge Mod Test" and click finish. When the project is done importing, I go to the Gradle Tasks bar, select fg_runs, and run "genEclipseRuns". When this is done, I go to IDE task folder and run "eclipse". Then I refresh the project by going to File, and selecting "Refresh". (I've tried running "eclipse" then "genEclipseRuns" and run into the same issues described next). With the project slected, I click File, Import, Launch Configurations, Browse, and select the folder at path "D:\Documents\Forge Mod Test". I select the "Forge Mod Test" folder, then select the next 2 files "runClient.launch" and "runServer.launch", then click finish. I select the drop down menu next to the run button on eclipse, go to run configurations, and select runClient under the Java Application tab. Here, I go to environment and change "${MC_VERSION}" to "1.12" and click apply. I repeat that same process for runServer. Now I click run, and it tell me that "Errors exist inrequired project(s): Forge Mod Test". I proceed with launch and get the following error:
Error: Could not find or load main class net.minecraftforge.legacydev.MainServer
Caused by: java.lang.ClassNotFoundException: net.minecraftforge.legacydev.MainServer
From what I have read, there is an issue with dependencies, and I'm not sure exactly how or where to run the "gradlew --refresh-dependencies". Below is a screenshot (and text) of the example code given by the forge MDK (the code has not been touched by my hands).
The error messages given on eclipse for the lines 3-8 are:
Multiple markers at this line
- The import net cannot be resolved
- The import org.apache cannot be
resolved
- The import net cannot be resolved
- The import net cannot be resolved
- The import net cannot be resolved
- The import net cannot be resolved
The rest of the errors are simply "xxx cannot be resolved to a type".
@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
logger.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
}
}
To be honest I can't completely figure out what my issue is, so a quick run through of the process. I downloaded and extracted forge mod 12.2 (file name: forge-1.12.2-14.23.5.2854-mdk), then copied it and renamed the copied folder to Forge Mod Test (saved at "D:\Documents\Forge Mod Test"). On Eclipse, I import an Existing Gradle Project, with Project root directory "D:\Documents\Forge Mod Test" and click finish. When the project is done importing, I go to the Gradle Tasks bar, select fg_runs, and run "genEclipseRuns". When this is done, I go to IDE task folder and run "eclipse". Then I refresh the project by going to File, and selecting "Refresh". (I've tried running "eclipse" then "genEclipseRuns" and run into the same issues described next). With the project slected, I click File, Import, Launch Configurations, Browse, and select the folder at path "D:\Documents\Forge Mod Test". I select the "Forge Mod Test" folder, then select the next 2 files "runClient.launch" and "runServer.launch", then click finish. I select the drop down menu next to the run button on eclipse, go to run configurations, and select runClient under the Java Application tab. Here, I go to environment and change "${MC_VERSION}" to "1.12" and click apply. I repeat that same process for runServer. Now I click run, and it tell me that "Errors exist inrequired project(s): Forge Mod Test". I proceed with launch and get the following error:
Error: Could not find or load main class net.minecraftforge.legacydev.MainServer
Caused by: java.lang.ClassNotFoundException: net.minecraftforge.legacydev.MainServer
From what I have read, there is an issue with dependencies, and I'm not sure exactly how or where to run the "gradlew --refresh-dependencies". Below is a screenshot (and text) of the example code given by the forge MDK (the code has not been touched by my hands).
The error messages given on eclipse for the lines 3-8 are:
Multiple markers at this line
- The import net cannot be resolved
- The import org.apache cannot be
resolved
- The import net cannot be resolved
- The import net cannot be resolved
- The import net cannot be resolved
- The import net cannot be resolved
The rest of the errors are simply "xxx cannot be resolved to a type".
Mod Example Code:
package com.example.examplemod;
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, 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
logger.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
}
}
run a command gradlew setupDecompWorkspace from the command line in the mod directory. then gradlew eclipse.