@Override
    public void bindTexture(TextureManager textureManager) {
        // If skin changed, or if no skin texture is yet loaded...
        if (skinBitmap != newSkinBitmap || textureId < 0) {
            synchronized (this) {
                if (skinBitmap != newSkinBitmap || textureId < 0) {
                    if (skinBitmap != null) {
                        // Unload the old texture
                        textureManager.unloadTexture(textureId);
                    }
                    if (newSkinBitmap == null) {
                        // Load default skin
                        if (isInteger(modelName)) {
                            textureId = textureManager.load(Textures.TERRAIN);
                        } else if (Model.HUMANOID.equals(modelName)) {
                            textureId = textureManager.load(Textures.MOB_HUMANOID);
                        } else {
                            textureId = textureManager.load(Textures.forModel(modelName));
                        }
                    } else {
                        // Load custom skin
                        hasHair = Model.HUMANOID.equals(modelName) && checkForHat(newSkinBitmap);
                        textureId = textureManager.load(newSkinBitmap);
                    }
                    skinBitmap = newSkinBitmap;
                }
            }
        }
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
    }