So Now I have an understanding of how things work under the covers, it’s time to actually try to produce something. In the past I have used Eclipse for Java development (In fact development generally since I am a c++ programmer by day…) and I find it reasonable to use for this purpose.

Mincraft Forge before 1.7 had a set of scripts that the user could run to perform the setup (Extraction, de-compilation, de-obfuscation and work-space setup) written in python. These were a black art to most people and so now a Gradle build system has been created, although to many Gradle was a big unknown.

The big head start however is that the forge project can be downloaded without downloading anything else and it will take care of the details for you. Simply down load the “src” version of the forge from the downloads page (E.G. 1.7.2 recommended at the time of writing) and extract the contents into a directory of your choice.


There is actually very little in this setup and that’s because Gradle is told how to download what it needs to run. It downloads a plugin written by forge which will add the tasks that need to be performed in order to set up the environment.

There are 2 different ways to invoke the setup, gradlew setupDevWorkspace  and gradlew   setupDecompWorkspace .  It is useful to be able to examine the minecraft sources and so the latter of these two commands is what I use. N.B. the sources are actually held in a Jar file rather than in the source tree (prior to 1.7 forge included the de-obfuscated sources for minecraft in the project directly).

Once the command has finished running then you can use Gradlew eclipse to actually initialize and set up the eclipse work-space. Once you start eclipse, and set the work-space it should look similar to the picture below.


The picture above shows the ForgeSrc-XXX.jar  file which has the source code in it, if you used setupDevWorkspace then this would be the ForgeBin-XXX.jar  file instead. Also note the “example mod” source that is added to the project as a guide for you.  The setup also adds run/debug configurations, and when run or debugged minecraft will display the following:


Note that the Example Mod has a version of $(version) above. This is because I ran the debug profile. If you run gradle build  it will substitute the $(version)  for the real version specified in  build.gradle into the file under the resources folder.


From the previous article I have now almost covered the basic elements that make up a mod. The last important annotation (That I have come across So far!) is @SidedProxy  .

Essentially this annotation would be used in the mod class to annotate the static variable proxy .  This annotation is used by the framework to initialize the variable with an instance of a class that is dependent on whether it is being run on the server or the client.

By doing this we can code our mod for both sides using a single set of sources, although the actual class is completely under our control again apart from the fact that the two classes should be derived from a common base class. So even though I called the class  CommonProxy  above it is actually an arbitrary class name and so are the methods defined on it.

The way that this is used is in the initialization Event handler defined in the Mod class. The base class is “traditionally” defined in the following way in most tutorials on the web



FML sources are the basis for developing mods that are compatible with Minecraft forge, and here I am going to investigate and explain some of the main features. I’ve done this as a learning process for myself, but if it helps others then great.

A good place to start is with the simple example mod that is included with FML. It is very basic, but it illustrates the principles involved.

I have not used Java for some time and so I need to refresh my knowledge a little, specifically whilst I have used annotations like  @override  but I have not seen this used in user code (I guess because I haven’t worked in a Java Shop before.)


The @Mod annotation is provided, along with others as part of the FML interface. It is essentially a way to tag classes with information, and takes the place of what would be often repeated boilerplate code. The definition of this annotation is the basis for the class interface that Forge expects when trying to load a mod.

if we modify the example mod code slightly

We can extract the data that is attached to our  ExampleMod class

Here you can see that the class effectively contains more data members than we specified and that the values for version and modid correspond to the values of our members  MODID and  VERSION . FML will interrogate our generated classes in much the same way to get the values it requires to load and operate the mod.

Additionally we can see that within our  ExampleMod  class there is also an annotated method   @EventHandler  which tags the init method as special. Note that the name of the method is completely independent of the Tag and could be anything. However the signature of the function is important and the parameter be one of the following:

These events represent points in the lifecycle of the mod, for example just before initialising your mod FML will call a method which takes the  FMLPreInitializationEvent , and in this you can load up any configuration for your mod which will change things in initialisation (E.G. Block IDs could be read and configured so users could change them to manually avoid conflicts between mods).

More details on how this works lie in the FMLModContainer class in the FML sources, for example method  gatherAnnotations extracts the methods annotated with @EventHandler  and stores them in a map so they can be called for the class.

Next…  @Sidedproxy







Players always want more features that developers have the time and inclination to add, and the more technically able look for ways to change and exploit the software themselves. In my opinion, The modding communities generally strengthen and add to the game, extending the lifetime of a product and often producing high quality output. Developers of games have understood this relationship and lots of games support modding in various ways (level generation, adding features, scripting etc…) E.G. most Valve games, World of Warcraft, Skyrim, and many others.

Minecraft is written in Java and currently doesn’t support modding directly. however because it is written in Java the game can be decompiled from the delivered “executable” to sources that can be modified, changed and recompiled. That statement is a gross over-simplification of the process, but is in essence what people have been doing to Minecraft almost since it was released.

The modding community in Minecraft have extended the basic sandbox game greatly by adding new Blocks, Items and behaviors to the game; In some cases making it almost unrecognizable to the vanilla game. There is a Darwinian process where Minecraft is the ancestor and still thrives, but modded offshoots grow and multiply. If you look at the rise of modded minecraft it is linked to the current trend for people to produce content for YouTube or live streams (e.g. twitch). People record themselves playing and publish that for others to watch and learn from.

Actually running modded minecraft was a problem for a lot of players since it required a level of technical expertise, or proficiency. Now thanks to launchers produced by the community (E.G.  Feed the Beast [FTB] ), the bar to entry has lowered and anyone can play minecraft with the mods people produce. These launchers handle the installation of the software to actually run the mods, and web sites and third party software like Curse  collate lists of Mods for Minecraft (for many games actually).  There is a planned union of FTB and Curse underway and this merger will unify the process of getting mods and running them still further.

The Modding process

As alluded to above, decompiling the executable downloaded from Mojang into source code is only the first step required. The source is Obfuscated when compiled and so the output of decompilers will be convoluted and hard to read.

Some of that code *is* understandable to a human reader,  BlockGrass for example, and it is from these clues and hours spent in debuggers that the community was able to produce tools to turn the above into something much more usable.

Mod Coder Pack (MCP) is a set of tools that will Decompile and Deobfuscate the Minecraft “executable” allowing modifications to be made to the basic code. It also provides a way to then package up the code into a working java “executable” again once you are done.

The proliferation of mods and peoples desire to use them together means that simply using MCP on its own quickly becomes a bit of a nightmare. Each mod author has his own copy of the source code and modifies it to achieve his desired effects. To make these mods play together you would need to have all the mod authors work together and then compile everything at the same time. You need to coordinate all the mods in Java source code so they play well together or it won’t work. (Identifiers, use of resources etc…) The other thing is that with MCP alone, adding new mods to your game also required going through the whole cycle again.

So the community created Mod loaders (plugin loaders). This is essentially code that modifies the original minecraft sources once, and in a standard way for all mod authors. The added loader provides a standard way for others to add functionality to Minecraft which is loaded dynamically from a separate zip or Jar file (Bukkit or FML are examples of this type of modification again )

Minecraft Forge is a framework that facilitates the creation of “mods” that extend and enhance “vanilla” Minecraft .  It uses MCP to set up the sources for a development environment, adds changes from FML, and then organizes the code allowing them to develop “Forge” compliant mods for the user. 

Next I’ll be looking into how FML adds support for the mods…

I’m now going to get back to my youth, I’ve decided that I want to code stuff for me and for pleasure. Enough work and playing with stuff for other peoples profit. I am going to play again and regain some of the joy I used to feel for this subject.

I have enjoyed playing minecraft now for quite a while and I might be late to the party but I don’t care. I have a couple of ideas about what I am going to create and I will document it all here, plus I might make the code open source.

So I will document the setup of Eclipse and the various tools (for myself primarily) and then begin creating the meat of the project. I don’t fear the code at all, but the textures and arty side of this should be ‘interesting’.




I’m going to start being more frequent with updates again, I do find this stuff useful and have reffered back a couple of times so far.

Came across this today  , I’m particularly interested in the lock-free ring-buffer / and/or queue as it will be useful in some work I’m doing on a processing pipeline. Makes me think I should consider publishing some of the data structures I have created…. I’ll need to tidy them up somewhat but I’ll think about it, they might be useful to someone :)

will go through this lib properly later on – much to do recently….

Had to jump through hoops today to get this to link with our product, the DLL version is much easier and I had done all testing up to this point via that route. However it looks like the client is going with a web service based product and I had to link statically because we don’t want to have to distribute cURL libs along with our product.

So first off – linking with the DLL is pretty easy because you basically include the libcurl_imp.lib  (or libcurld_imp.lib ) and then bob is your proverbial

So I changed the lib to be the static version in both release and debug configurations and that’s when the fun started. I got issues with missing symbols during the link:


There were more but they were all to do with the “easy” suite of functions.

This is caused because I needed to define the fact that my application was linking statically by defining the following flag on the compile command line :

or in properties->Configuration Properties->C/C++->PreProcessor:


This is symetric, and probably changes something in the headers I would guess changing the way that the API is implemented in my application as well as how it is compiled into the library or DLL.

That then got me issues with my runtime libraries when I attempted to rebuild. This can be sorted by making sure that the runtime used by your application is the same as the runtime in the libCurl project:


Once that was done I still had issues with missing symbols E.G.

Again there were others, but they were all to do with LDAP. This was sorted by rebuilding the libcURL library again with another define:

That was it for me, although if you do actually need LDAP support then you need to add

to the link line of your application.

I did read that you could also get issues with socket libs. This is not an issue for me because I am performing socket operations myself and therefore already link with

However if you get undefined symbols of a winsock type nature then you’ll probably need to link with this as well.




I’ve spent the last few days gradually working through this  to get the basics of creating Android applications. I have downloaded the latest Android SDK including a ready made eclipse environment.

About Dialog from the installed eclipse.

About Dialog from the installed eclipse.

The installation comes with various perspectives, views and tools for handling the ADK and the development process. These tools hide a lot of set up that is required under the covers.


The menu (above) contains buttons to get to the SDK management tool, the Virtual Device Manager, a wizard for adding the XML files required by an application, and a lint tool for identifying issues with your code and config files.






After setting up an Android Virtual Device (AVD), you get an emulator to run your application on


The emulator was extremely slow at first but after some reading I found that I needed to add in an extra package that supports the GPU and virtual machine acceleration :


There is also a flag in the AVD edit screen to switch on the GPU accelleration. This is misleading because it is still there even if the package above is not installed, and the resulting  AVD doesn’t start…



I’ll write more as I go on, it appears that the coding for the apps themselves is fairly easy, combinations of XML and code however can be problematic – leading to things either not working, or not working as expected. The book and the IDE do not match up either, but this is making me think harder about what it is saying and therefore helping in a strange way so far…