Methods of decompiled classes

So I’ve been tinkering with Minecraft’s decompiled code (via the latest MCP), and noticed something curious when comparing the Client and Server sources.

Some classes have minor differences I find strange, for example, the class might lack a constructor in the server that it doesn’t on the client, even if the rest of the class (particularly the class attributes) are the same.

I’m suspecting this is due to the decompiler ignoring (or not being able to detect) methods that are not being referenced anywhere else on the code.

Is this correct? Or is there any merit in omitting a constructor of a class for server-side code that I’m not seeing?

reflecting on decompiled code is like thinking in 4 dimensions.

From what I understand, the devs might not have included a constructor in some classes. When Java compiles a class, if it doesn’t have a codded constructor, it adds its own empty one. http://stackoverflow.com/a/13773736

Also its not strange that there are difference between client and server code. The client handles rendering and fires events and the server handles the events and sends information back to the client so it knows what to render.

[quote=“bigbass1997,post:3,topic:54070”]
I know about both. The classes I’m referring to handle data regarding blocks, so it’s stuff both sides need to know.

The lack of a constructor would make sense if it was replaced with a private constructor to avoid instantiation, but just removing the specific constructor means the server can still instantiate the class, but won’t be able to initialize the attributes.

It looks something like this:


// Client
public class Block
{
    private int attribute;

    public Block(int value) { this.attribute = value;}

    /* Lots of other methods here */
}

// Server
public class Block
{
    private int attribute;

    /* Lots of other methods here */
}

I was, in fact, hoping to be able to extract all common data into its own library so I could inspect the Client and Server specific code more cleanly, hence my wondering if this has relevance, or is just a decompilation artifact.

By extension, I’d really like to know if decompilation ignores unreferenced (never used) functions.

Of course, since the MCP does some de-obfuscating and other things, it might be something on their end too.

You think in such three-dimensional terms. How small you’ve become.

:wink: … i was referring to the infinite amount of posible causes and reactions in higher dimension - which we only can guess.

to infinity i feel very small, yes :emo: … but the good thing is, compared to infinity everything is of equal size :slight_smile:

Don’t sweat it, I was quoting the Borg Queen from Star Trek: First Contact ;D

Perhaps something to do with the way the Server de/serializes instances of the world?

it did ring a bell tho’ :slight_smile:

If a class doesn’t define a constructor, it inherits the default constructor from the Object class, since the inheritance hierarchy of any class eventually leads down to the Object class.