Recently I experienced something every modder dreads of - losing his/her code. I was so bummed since I had put so much work into making the mod. And unfortunately, I am not an experienced modder or experienced with Eclipse. A bit of research on the internet helped, but nothing on Forge Modding. But today I found out how to retrieve all of the code back, and now I will tell you how to get your code back if you are experiencing the same problem! Unfortunately I don't have any pictures to show because it happened a while ago.
An unclean shutdown caused my eclipse modding workspace to become corrupted, and unfortunately unable to run. I could still see all of my folders and classes inside the package explorer, however, trying to run any of the classes would display an error (sorry, it was a couple of months ago and I can't quite remember the error message). I tried mucking around inside the Eclipse plugins folder, which was a bad idea, and it made the problem worse; Eclipse could no longer find the folders or classes inside the workspace. Errors popped up in the console as well.
~~~What I did:~~~
First, I tried to move it to another computer via USB, which did not work. Second, I tried to fiddle around inside the Eclipse plugins folder, which was a bad idea and it made the problem worse; Eclipse could no longer find the folders or classes inside the workspace and made many errors pop up in the console. How did I fix it? Here is what I did:
I created a new, fresh workspace so that I would no longer get any errors. I went into File -> Import -> General -> Existing Folders into Workspace. Next I selected 'Select Root Directory' and put in the directory of my BROKEN workspace (not the eclipse folder inside, the whole folder itself) and under the 'Options' box pressed 'Copy projects into workspace'. After that I pressed finish. It took a while, but I found that all of my projects were restored. However it still came up with errors! I looked into the errors and I saw that the gradle files in my user folder were missing (by the way this is only if you are using a different computer to the one it stopped working on). To fix this, I simply installed gradle by going into my Main mod folder, opening the console and typing 'gradlew setupDecompWorkspace' and after it finished typed in 'gradlew eclipse'. After I performed these, I found out that I didn't know what class was used to execute the code. After testing and experimenting, I found that 'GradleStart' worked for me. When Minecraft opened, I found that my mod worked, textures and all!
I hope this works for you! If you have any questions or comments, please post on this thread below!