CHANGSTAR: Audiophile Headphone Reviews and Early 90s Style BBS

  • December 31, 2015, 09:07:10 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: I'm learning Java. For Minecraft modding shit. Yee.  (Read 336 times)

0 Members and 1 Guest are viewing this topic.

takato14

  • Designated furfag on deck
  • Able Bodied Sailor
  • Pirate
  • ***
  • Brownie Points: +85/-11
  • Online Online
  • Posts: 446
  • Likes it fuzzy
I'm learning Java. For Minecraft modding shit. Yee.
« on: September 17, 2015, 05:58:40 AM »

My friend is teaching me how to mod for Minecraft 1.7. I'm designing a replacement for BaracudaATA's Dragon Mounts mod, a mod which I make frequent use of and am constantly being annoyed by bugs, lack of content, etc etc. My aim is to fix up some of his code and add a lot more stuff to make the mod less cut-and-dry/barebones.

This thread is going to serve as my "homework". Every time we have a lesson I've been instructed to describe what I've learned in detail. Instead of leaving those text files to sit and waste away on my computer, I figured why not post it here instead?

This should be interesting and helpful for others interested in it.


Lesson 1: Setting up Git


Unfortunately this isn't the first time he's tried teaching me so my Forge dev environment has already been set up. There's plenty of tutorials for that anyways. So today we started with setting up a git repo. As usual, more went wrong than should have. Not sure why it was so finicky, but chances are other people will have the same problems I did, so here's the final process I ended up with:

**Please note, that this assumes you've ALREADY set forge up without setting up git first, or you're doing what I am and have to put someone else's code onto your repo before you start digging through it.

  • Obviously, download and install git and create a github account. That's self-explanatory and I'm not going to go into it here.
  • Create a new repository on the website. Click on the "+" in the upper right hand corner of the page. Unless you're okay with your repo being named dickbutt, give it a meaningful name; it can't be changed later. (spaces and symbols are not allowed)
  • Edit your PATH variables. Oh fuck me I hate doing this. None of the GIT commands work in the stock command prompt without doing this, so it's necessary. Start -> Computer -> Right Click -> Properties. Go to the Advanced tab and click on "Environment Variables". Select "PATH" in the drop-down list and click "Edit". Tack on a semicolon followed by the path to your GIT installation's cmd folder. For me, this was "C:\Program Files (x86)\Git\cmd". No quotes required for the space in the path, and no spaces between the semicolon and path.
  • Open your mod's folder and Shift + Right Click in the root. For me, this was "C:\mods\better-dragons". Select "Open Command Window here".
  • Add all your shit to the commit list. " git add [name of file or folder] ", sans brackets. One for each folder and file in your mod's root folder. This should be two folders, "src" and "gradle", and three files "build.gradle", "gradlew" and "gradlew.bat".
  • Commit all the changes. " git commit -m "initial commit" ". The -m switch adds a message to the commit. Quotes required. This is going to make git bitch at you, so be prepared.
  • "*** Please tell me who you are. Run ..." Yeah just do what it says. You'd better be perfectly capable of following on-screen instructions if you're trying to learn Java. If not, give up now.
  • Not quite ready to push yet. You need to set your origin. " git remote rename origin upstream " followed by " git remote add origin [url to your repo] ", sans brackets again.
  • Try to push to the repo. " git push origin master". It's going to prompt you for your username and password. Don't fuck up and typo, and it should work.

Woo hoo, git is set up. Fun. Now everyone can see and download your hard work and claim it as their own. Peachy.

Next stop: Forge mod structure.
Logged
This industry is really fucking broken

Deep Funk

  • Sure is fond of ellipses...
  • Able Bodied Sailor
  • Pirate
  • ***
  • Brownie Points: +111/-3
  • Offline Offline
  • Posts: 2344
  • Born in 1988, eclectic 90-ties!
    • Radjahs2cents
Re: I'm learning Java. For Minecraft modding shit. Yee.
« Reply #1 on: September 17, 2015, 07:35:28 AM »

Karma for Java  ahoy
Logged
Few things keep me sane: my loved ones, my music and my hobbies. Few is almost an understatement here...

smitty1110

  • The Ghost of Audio Forums Past
  • Able Bodied Sailor
  • Pirate
  • ***
  • Brownie Points: +5/-1
  • Offline Offline
  • Posts: 124
  • Amps are my drug of choice
Re: I'm learning Java. For Minecraft modding shit. Yee.
« Reply #2 on: September 17, 2015, 05:02:10 PM »

Java has served me well, almost as well as perl and shell scripting. Good luck getting started with modding, last time I checked it was a mess.
Logged

IzzyAxel

  • Swabbie
  • Brownie Points: +3/-0
  • Offline Offline
  • Posts: 2
Re: I'm learning Java. For Minecraft modding shit. Yee.
« Reply #3 on: September 18, 2015, 08:56:54 PM »

Lesson 0/2, setting up Forge for 1.7.10 with IntelliJ IDEA: Install JDK 7/8/9, whatever you want to be using, add an environment variable with name IDEA_JDK and value of the path leading to your JDK installation's root folder. (not bin)  Install IntelliJ.  Download the Forge src, make a project folder, like "mods" anywhere you want, clone your repo (which should have a .gitignore and readme.md) into the root of the project folder.  Unzip the forge source into the cloned folder.  Open IntelliJ and import the build.gradle file included with the forge source, default import settings.

Click this thing:

to bring up a sidebar on the right hand side.  There should be a Gradle section, click on that.  Run the 2 highlighted tasks (setupDecompWorkspace and genIntellijRuns):

Reload the project, and check in the left sidebar, under External Libraries; make sure you have the forgeSrc-1.7.10-(version numbers) folder, and inside it 'net' and 'minecraft'.  If you don't, I would suggest deleting everything and starting over, it sometimes doesn't decompile the source, but says it does, and the only way I've fixed it is to start from scratch. facepalm

Lastly, open the build.gradle file in a text editor, and paste this in at the very bottom:
Code: [Select]
idea {module {inheritOutputDirs = true}}
Logged