Jump to content

Adventure in agricultural engineering (IC2 cropcards)


Neowulf

Recommended Posts

I present to you, at Merchant's request, my continuing adventures in IC2 modding. AKA A newbie's blind stumbling!

First my downloads:

A fresh copy of .minecraft through the vanilla launcher. So I had a locked in copy of 1.2.5 to make copies of.

Eclipse.

MCP - http://mcp.ocean-labs.de/index.php/MCP_Releases

Mod loader - http://www.minecraftforum.net/topic/75440-v125-risugamis-mods-everything-updated/

Forge source (which also has the modloader DL link) - http://minecraftforge.net/forum/index.php/topic,4.0.html

FernFlower decompiler - link in the forge source readme.

IC2 client and API - http://forum.industrial-craft.net/index.php?page=Thread&threadID=5896

The api is located right below the KGB server host ad.

All that download, I loaded modloader into the minecraft.jar, copied the files into MCP as directed by the readmes and hit the forge install command.

First decompile, success!... I wish. First compile was a fail because I forgot to remove that damn meta-inf from the minecraft.jar

Ah well, second decompile a success!

Now to load the IC2 source because alblaka says that's all you need to jump right into coding an addon!

Liar. Knowing all the classes is fine and dandy, but unless you've already worked with IC2 then you need examples and references. So I went back and followed this guy's instructions and after a couple pages of hunk failures past my CMD wind's buffer size, I got a decompiled IC2 source.

And immediately regretted I didn't save an extra copy of the vanilla MCP decompile I did before, because I realized I might want one to make more copies from so I can work with other mods without mashing them all together... Ah well, recreate a vanilla MCP decompile and carry on.

Time to code!

Or actually, time to wrack my brain trying to follow var1, var2, and var3 as they go through each member function getting repurposed every 20 lines or so. But I figured it out eventually.

Package? Eclipse is helpfully telling me to declare my source files as part of a package, so I follow along.

Includes?!? Crap, I don't know any of the API's. I ahve no clue what to include... But wait! Eclipse is being a darling and helpfully offering the includes I'm using. Thanks eclipse, i'd be stuck if not for you...

Ok, class mod_ForTheTrees is defined, general layout copied by sight from another cropcard mod that helpfully included source (all of it config loading, which I had to rewrite anyway to work with more than 2 crops), file done for now.

Ahh, extend the cropcard base class, @override the member functions I will be using with direction from the example mod. Parsing slowly through the cropblock functions gave me a vague understanding of the crossbreeding rules, and a headache. So I know I just have to set all the stats to identical numbers for any crops I want to easily crossbreed.

Ok, cropcards all defined, mod_ file updated to register all the crops and their (development only) seeds, all is ready to recompile!

MCP: NOPE.

Me: Wha?

MCP: Screw off, can't recompile the IC2 client.

ME: FUCK!

ME: Ok, wait, if I make a copy of the base MCP, add in the IC2 API src and copy my files over, it should all be happy and kosher to recompile.

MCP: NOPE. Dunno who this cropcard is you're trying to use.

ME: Yes you do, it's right there in the source!

MCP: Not listening.

Me: Ok, wait, the actual IC2 source includes those classes from net.minecraft.src.ic2, maybe that's the problem.

MCP: Yup, but I still ain't gonna compile, dunno what that random function you're using is.

ME: Fuck, mod_ic2 declaration isn't part of the src so I can't use the Random member of it... Ok, reimplement myself in my own mod_

MCP: Now was that so hard? Here's your .class files.

Me: Fuck yeah!

Compiled mod files in hand, I toss them into a zip, toss the zip into my .technicssp\mods and start the game.

It starts! But the crops don't work, never found my mod_ to load...

Ok, maybe it's the package? Remove it all, try adding to ic2 package, try adding to net.minecraft.src, all no dice.

An hour later (I ate dinner) I'm sitting here trying to figure out why it's throwing up a "java.lang.NoClassDefFoundError" in modloader.txt and not comming up with anything until...

Eureka! Dickmove.bat! I mean, reobfuscate.bat! I forgot I was going straight to my .technicssp install, so I need to prep my mod for production instead of test.

Holyfuckingshitwithaheapingsideofvulgarity! It works!

Client loads, I can start my crops with almost all of my defined seeds, and it doesn't throw a fit like my 4 year old!

Sprites need some work, since they aren't doing transparency I have white blocks with my terrible hackjob sprites (I'm no artist), and I messed up the seed definition for shrooms. But hell I'm happy!

TL;DR

Download client and API.

Do one mod at a time.

Make one MCP decompile of the client, for coding your mod.

Make one MCP decompile of vanilla then toss the API in, for recompiling.

Package your stuff into net.minecraft.src unless you know what you're doing.

Use Eclipse for an IDE, it makes includes nice and easy.

Recompile and reobfuscate when you're ready to test in the big client.

Link to comment
Share on other sites

  • 1 month later...

Welcome to the world of programming. It's a "WROTE EPIC CODE LIKE A BOSS TIME TO MINECRAFT!" -> Compiles with errors -> "Dafuq just happened??? Everything is Java's fault... Oh, fine, I'll double check my code." -> "WHY THE HELL DID I MISS THAT STUPID } AFTER MY FUNCTION ENDED???" -> goto step 2. In java form:

public class worldOfCoding

{

public static void main(String[] args)

{

Code test = new Code();

for(int i = 0; i<9001; i++)

{

test.compile();

System.out.println(test.getErrorInCompile());

test.correctStupidMistake();

}

System.out.println("IT FINALLY WORKS!!! ME GUSTA!");

}

}

// let object "Code" be your code for the mod. All methods in Code are not shown here. Hell, none of Code is shown here

// Feel free to make a class for Code and run this java code if you want. I see no reason to, but if it floats your boat, let it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...