(!) same problem in GLState.applyLight(…)
further, about code readability, consider these two logically identical code listings:
void stuff()
{
if(someFlag)
{
// do
// lots
// of
// complex
// things
}
else
{
throw new IllegalStateException("Problem");
}
}
vs.
void stuff()
{
if(!someFlag)
throw new IllegalStateException("Problem");
// do
// lots
// of
// complex
// things
}
Or, like this:
for(.....)
{
if(....) {
if(....) {
// stuff!
// stuff!
// stuff!
// stuff!
// stuff!
// stuff!
}
}
}
vs.
for(.....)
{
if( ! ....)
continue;
if( ! ....)
continue;
// stuff!
// stuff!
// stuff!
// stuff!
// stuff!
// stuff!
}
I find that reducing the indentation level in your sourcecode makes it easier to read, and easier do fix. After all it was Linus who said that if you have more than 3 indentation levels (in your method) you’re screwed anyway. I tend to strongly agree with that, but he also said that Linux is so fast, it does an infinite loop in 2 seconds… so go figure.
Another nice idea might be to make your methods max 10-15 lines. Split those massive methods into nice little chunks, with self descriptive names. The JIT will also take advantage of that, btw.