SantacreeperLP Posted May 29, 2014 Posted May 29, 2014 Hey guys, I've a problem: I want to write my minecraft forge modification in scala, I've installed Scala IDE for Eclipse and Its done. But I can't add a scala nature to the Minecraft project. If I click on 'add scala nature', It don't do something. Please help me, ~Santa Quote
target.san Posted May 29, 2014 Posted May 29, 2014 I suppose you've used proper tutorial for deploying Forge 1.7 build environment. Then you should know that Eclipse project is generated from Gradle and thus changes to it won't do any good. Next, you'd have build.gradle look this way: repositories { ... // repos config, not our case } apply plugin: 'scala' // Here our hero comes apply plugin: 'forge' ... // rest of Gradle config and then re-generate Eclipse project with gradlew eclipse Also, you need to respect default source layout for Scala or override it http://www.gradle.org/docs/current/userguide/java_plugin.html http://www.gradle.org/docs/current/userguide/scala_plugin.html Last, to see Scala cookes in Eclipse you need to use Scala perspective. Though you should know this if you intend to write in Scala. One of good examples would be ForgeMultipart: https://github.com/Chicken-Bones/ForgeMultipart It's in Scala, it's a coremod, it's for 1.7 and it's using ForgeGradle. Last advice. Store your launch config as shared and keep it versioned. ForgeGradle doesn't create proper run configurations for you. If you gonna learn Scala by writing your first mod then I wouldn't recommend doing this because Scala is rather complicated and has steep learnring curve. I'd recommend attending these Scala courses on Coursera: https://www.coursera.org/course/progfun https://www.coursera.org/course/reactive Quote
SantacreeperLP Posted May 29, 2014 Author Posted May 29, 2014 thank you very much, it works . And yes, ForgeMultipart is the reason why I've installed scala Quote
SantacreeperLP Posted May 29, 2014 Author Posted May 29, 2014 No , It doesn't work. While I create the source folder, eclipse thinks the scala code was java code. How can I fix this? Quote
DiabolusNeil Posted May 29, 2014 Posted May 29, 2014 Minalien made a great tutorial for using Scala and the IntelliJ IDEA IDE: http://minalien.com/tutorial-setting-up-forgegradle-for-intellij-idea-scala/ Quote if (user.hasKnowledgeOfJava) { if (user.question.hasCode) { return interpetHelpfulResponse(user.getQuestion()); } else { return "Could you post your code please?"; } } else { return "Learn some freaking Java!"; }
target.san Posted May 29, 2014 Posted May 29, 2014 No , It doesn't work. While I create the source folder, eclipse thinks the scala code was java code. How can I fix this? As I said above, Eclipse project is generated from Gradle. Assume it as some generated code. Next, re-check info on Gradle's Scala plugin. You'll see that your sources should be in src/main/scala. Or override Scala source location manually. Investigate ForgeMultipart's build.gradle. Otherwise, specify exactly what you do, what you expect to happen and what went wrong. Quote
target.san Posted May 29, 2014 Posted May 29, 2014 Minalien made a great tutorial for using Scala and the IntelliJ IDEA IDE: http://minalien.com/tutorial-setting-up-forgegradle-for-intellij-idea-scala/ He's using Eclipse, Things will be a bit different there. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.