Jump to content

Recommended Posts

Posted

I was wondering How much java should I know before starting serious modding. by serious modding i mean not just items and blocks. I want to do custom rendered blocks and power systems and multi blocks and stuff like that. anyways thanks everyone for helping me like always

 

 

 

                                                          Sincerely,

 

                                    ClarmonkGaming

Posted

If you're going to do stuff with power systems, you're really going to need to know how to program efficiently.  That whole Big-O notation thing.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Unfortunately it's kind of hard to gauge how much is 'enough'.

 

Ideally, you'd have an understanding of:

 

Classes

Methods

Primitive types (boolean, int, short, long, float, char, as well as String)

Inheritance (extending classes and also using interfaces)

Basic data structures (Arrays, Lists, etc)

Using Public/Private/Final/etc modifiers for methods and variables when appropriate

If, For, Else, While, Do, Switch statements - How they work and when to use them

Recursive methods (which can save you a lot of coding)

Basic logic (!= not equal, && and, || or, == equal, etc)

Some understanding of packets, hopefully

 

I've probably missed a bunch here, but that's what springs to mind. A lot of it you can learn on the way while poking through vanilla Minecraft classes. Once you wrap your head around certain Minecraft-specific things (Blocks have an associated TileEntity, that TileEntity can implement a Container, that Container can implement Slots, and the whole shebang can be looked at with a GUI activated by the block), things tend to make more sense.

 

I first dealt with Java while doing Minecraft modding, now I've come back after taking University classes on the subject. A lot of what we covered in the introductory courses I had already learned just from playing around with Forge for a week.

 

And remember, Google is your friend. There are plenty of good online tutorials for learning the basics of Java.

Posted

Hi

 

I think a good general rule is that when you don't know enough Java to understand how the vanilla code for some feature works after studying it for a while, then you probably need more practice before you implement something similar.

 

If I were going to recommend a checklist I'd say you need to be comfortable with the following concepts to do anything "serious" in Minecraft

 

- know the basic syntax (keywords like for, switch, if, while, do, final, static, public etc)

- understand the different types of variables (int, byte, float, etc)

- understand what inheritance is and how it works (extends), instanceof and casting (MyBaseObject)derivedObject;

- have a good working knowledge of the container classes (ArrayLists, HashMaps, etc)

- understand the difference between

MyObject a = b;

and

MyObject a = b.clone();

or

MyObject a = new Object(b);

 

- know the difference between

a == b

and

a.equals(b)

 

Knowing a bit about OpenGL would help too

http://www.glprogramming.com/red/index.html

 

- know how to use your integrated debugger properly (breakpoints, watches, etc)

 

Once you're comfortable with that lot, then you've got a decent chance of understanding the vanilla code and learning how to create your own stuff.

 

Reading up on good coding style and code design would be a bit help (eg "Effective Java" textbook)

 

My only other advice would be to create small pieces and test them one by one.  So if you're making a mod with fifteen types of new weapons that fire everything from bullets to small nukes, start with just a bullet-

(1) copy a class from vanilla (say - snowball) into your own classes and see if you can spawn it.

(2) Once that works, test whether you can spawn it and it flies through the air straight until it hits something. 

(3) Once that works, add a damage effect for when it hits a mob.

(4) etc etc

There's nothing worse than coding up a storm for 3 days and then when you try to test it nothing works, it takes hours to find any bug because you don't know which parts of the code are reliable and which aren't, every time you try to fix something it breaks something else, you realise you made a couple of incorrect assumptions so half of the code you wrote is useless and has to be scrapped, etc etc

 

Apart from anything else, coding & testing in small chunks is much more rewarding because you get a better sense of progress and it's good to change between coding & debugging fairly often, keeps you from getting bored.

 

-TGG

Posted
There's nothing worse than coding up a storm for 3 days and then when you try to test it nothing works, it takes hours to find any bug because you don't know which parts of the code are reliable and which aren't, every time you try to fix something it breaks something else, you realise you made a couple of incorrect assumptions so half of the code you wrote is useless and has to be scrapped, etc etc

 

Apart from anything else, coding & testing in small chunks is much more rewarding because you get a better sense of progress and it's good to change between coding & debugging fairly often, keeps you from getting bored.

 

Also know when you've coded yourself into a corner.  Even if it works, but the way you've done it you've had to make sacrifices due to some assumption here or how you set your data up over there.

 

In the little project I did over the last few days I got to a spot where it's not viable to keep working because my data structures won't support it.  In order to do something simple like locate a topological feature I have to iterate through one of four different arrays and compare datapoints with at least one of the other remaining three.

 

i.e. I have an array that holds vertex locations.  I have another array that holds triangles (that references indices in the vertex array).  I then have yet another array that holds the edges of those triangles (because the triangle array wasn't set up to be useful for the next step of what I was doing).  I then have an array of objects that exist visually, which are related to the vertex array.

 

In order to draw a series of lines between my objects I need to find which object I want to draw from, and to, then locate the relevant edge in the edge array.  If it exists (as not every object is connected to every other object).

 

So I need to scrap everything I have, use what I learned, and find a single cohesive way of storing the data so I can reference and modify it in the various ways I need to.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.