Thank you all for your help. I gave a very enjoyable workshop called 'Programming Minecraft Mods in Java'. You can find my project setup and sample code on github. There within the README.md you can find the steps to get this setup working. Below I describe how I initially created my project setup.
I have a setup similar to the one of Pahimar, but figured out a less time consuming way to create it.
My forge directory is within a directory called 'minecraft-forge-mods' (which is also the name of my git repository) and my own mod is called 'aeir_mod' which resides within a 'sources' directory. You are free to change this in the steps below, but for illustration here is
the directory tree of my porject:
minecraft-forge-mods
│
├── eclipse
│ ├── Minecraft
│ │ └── bin
│ └── aeir_mod
│ └── bin
├── eclipse_cfg
│ └── forgeMCP-eclipse-launch-config
├── forge
│ ├── client
. .
│ │
. .
│ ├── mcp
│ │ ├── bin
│ │ ├── conf
│ │ ├── docs
│ │ ├── eclipse
│ │ │ └── Minecraft
│ │ ├── jars
│ │ │ ├── assets
│ │ │ ├── libraries
│ │ │ └── versions
│ │ ├── lib
│ │ ├── logs
│ │ ├── reobf
│ │ ├── runtime
│ │ ├── src
│ │ └── temp
. .
│
.
├── source
│ └── aeir_mod
│ ├── common
│ │ └── de
│ │ └── blogspot
│ │ └── debukkitsblog
│ │ └── proxies
│ └── resources
│ └── assets
│ └── basis
│ └── textures
│ ├── blocks
│ └── items
└── textures
Note that 'textures' on the top level is just my gimp workspace. Also note that everything beneath forge is ignored by git (see .gitignore in my repo)
These are the steps to create this setup:
- copy the preconfigured forge workspace:
cp -a forge/mcp/eclipse eclipse
- remove all generated code from bin:
rm -r eclipse/Minecraft/bin/*
- start eclipse and point it to the copied workspace
- within eclipse open the 'Minecraft' project Properties (right click the project in the Package Explorer view to open its context menu, select Properties)
- Within project properties go to 'Resource' -> 'Linked Sources'
- mark the variable 'MCP_LOC' and 'Edit...' it: change its 'Location' to
${WORKSPACE_LOC}/../forge/mcp
${WORKSPACE_LOC} is a variable that points to your workspace directory. From there you move up one level ('../') and you descend into the MCP directory ('forge/mcp')
- still within the project 'Properties' select 'Java Build Path' and on the 'Order and Export' tab check all libraries
- in the package explorer view expand the 'Minecraft' project, right click the 'src' directory to open its 'Properties'
- within the 'src' directory 'Properties' select 'Resource' and 'Edit...' its 'Location'. Change the location to:
MCP_LOC/src/minecraft
These steps should give you a working mindcraft forge project - without your mod.
To add your mod:
- create a new project
- on tab Source remove the src directory from build path and
- Link two additional source directories:
'Location':
WORKSPACE_LOC/../source/aeir_mod/common
'Name':
common
'Location':
WORKSPACE_LOC/../source/aeir_mod/resources
'Name':
resources
- on tab Projects add the Minecraft project created above to the list of Required projects on the build path
- after creating your project delete its auto-generated src folder
In future you can add more mods the same way. As your mod projects require the Minecraft project and the Minecraft projects exports all libraries it depends on, you don't have to add those libraries to your mod projects again.
If in future something in Minecraft Forge changes, change it in the Minecraft project.
Now you have to adjust the ('Run' ->) 'Run Configurations' for your projects:
- under 'Java Application' you can find the preconfigured 'Client' and 'Server' run configurations for the Minecraft project.
- optionally select them and on their 'Common' tab check 'Run' and 'Debug' under 'Display in favorites menu'
- optionally on the 'Arguments' tab, 'Program Arguments' you can add
[email protected] yourpasswort
of your Majong account
- copy the configurations and give them a telling name like 'Modded Client' (or 'aeir_mod Client' in my case) and 'Modded Server'
- on the copied run configuration's 'Main' tab change the 'Project' to your mod ('aeir_mod Client' in my case)
- on the tab 'Classpath' select 'User Entries' and 'Add Projects...', check the 'Minecraft' project and make sure that 'Add exported entries of selected projects' and 'Add required projects of selected projects' are unchecked
Hope I did not forget something. If so, please tell me. Have fun!