Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I would like to know how the animation system works in minecraft. I get a feeling that all the mobs are hardcoded into the game. Did notch really sit there and create the matrices for all the animation bones by hand?

I like recreating games for fun, so I would like to know how he did this. Also, if he truly does hardcode them... is there a better way?


closed as off-topic by Josh Petrie Feb 7 at 22:30

  • This question does not appear to be about game development within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

why do you think he may have hardcoded animations? –  Ali.S Oct 2 '11 at 16:51
Seems like this question is only answerable by Notch. –  Byte56 Oct 2 '11 at 18:01
More to the point, why do you care how Minecraft did it? Do you have an idea on how to accomplish the same thing some other way? –  Tetrad Oct 2 '11 at 19:37
minecraftforum.net/topic/361430-181smp-smart-moving The maker of this mod might have an answer for you but animation is not an area of the minecraft code I have looked through before. –  James Oct 3 '11 at 2:59
I've looked through the MCP code before, and I'm 99% sure I remember seeing the animations hard-coded. I no longer have minecraft (or even Eclipse) to check, though. –  BlueRaja - Danny Pflughoeft Oct 3 '11 at 6:28

3 Answers 3

up vote 18 down vote accepted

As others have said, yes the models as well as the animations are hard-coded. If you would like to see how this was done, go to the Minecraft Coder Pack wiki.

The package was created to help mod creators to decompile, change and recompile the Minecraft classes. Instructions are included in the readme files which come with the package. The package contains scripts to decompile, recompile, and reobfuscate the game and the server.

The classes you will want to look at are: ModelBase, ModelBiped, and ModelRenderer.

ModelBiped contains the following functions which do the humanoid animations:

public void render(Entity entity, float time, float f1, ...)
    setRotationAngles(time, f1, ...);

public void setRotationAngles(float time, float f1, ...)
    bipedRightArm.rotateAngleX = MathHelper.cos(time * 0.6662F + 3.141593F) * 2.0F * f1 * 0.5F;
    bipedLeftArm.rotateAngleX = MathHelper.cos(time * 0.6662F) * 2.0F * f1 * 0.5F;

The arm swings are simply cosine functions. The right arm is offset by PI to make them swing in opposing directions.

graph of the arm swings

I hope that answers your question =)

If you would like more information on how to actually mod Minecraft, then check out this question:

How do I add a custom mob to Minecraft?

Thanks! this is exactly what I was looking for. –  radenon Oct 9 '11 at 17:45
Sis! Euclidean rotation :(. –  Jonathan Dickinson Oct 10 '11 at 8:04

Models in Minecraft are hard-coded. There is no notion of block hierarchy (only a list of blocks). This means animations are either done procedurally (in a very basic way) or hard-coded values with interpolation.

There are a few editors for Minecraft models like Techne or FMCModeler which allow importing / exporting Minecraft model code for mods, but they don't support animations since it is probably handled differently for each model.

Here's a quick sample generated with FMCModeler:

//variables init:
public ModelRenderer box;

box = new ModelRenderer(0, 0);
box.addBox(0F, 0F, 0F, 16, 16, 16);


A better way to do it would be to build a full block-based modeler with some notions of block hierarchy so you can animate the models with keyframes and interpolation.

I'm currently building a multiplayer game building tool which does just that (among other things, http://craftstud.io/). It already allows building complex static textured models and more is on the way.

Here's a complex model built with CraftStudio As you can see, the blocks are arranged in a tree on the right: http://i.stack.imgur.com/FRQeV.png

Each block is serialized to disk / over the network with the following data:

  • Unique ID
  • Parent node ID
  • Position (affects descendants)
  • Scale (affects descendants)
  • Angle (affects descendants)
  • Offset from pivot point
  • Block Size
  • Block texture offset (UV coordinates offset for the texturing)

I plan on adding animation support by storing a map with animation names as key and a list of keyframes as value. Each keyframe will be associated with a block and a value to animate. Between keyframes, values should be interpolated (either linearly for position or spherically for angles, search for lerp and slerp).


Minecraft block models are actually not hardcoded into the game as of 1.8 and can be edited using resource packs. The JSON modeling system is fairly easy to understand and models exist at /models/block. You can then look at the code to see how it interprets the JSON models.


Not the answer you're looking for? Browse other questions tagged or ask your own question.