<commit_before>package io.github.voidzombie.nhglib.assets;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ai.fsm.DefaultStateMachine;
import com.badlogic.gdx.assets.AssetDescriptor;
import com.badlogic.gdx.assets.AssetErrorListener;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ArrayMap;
import com.badlogic.gdx.utils.JsonValue;
import com.badlogic.gdx.utils.UBJsonReader;
import io.github.voidzombie.nhglib.Nhg;
import io.github.voidzombie.nhglib.assets.loaders.JsonLoader;
import io.github.voidzombie.nhglib.assets.loaders.NhgG3dModelLoader;
import io.github.voidzombie.nhglib.assets.loaders.SceneLoader;
import io.github.voidzombie.nhglib.graphics.scenes.Scene;
import io.github.voidzombie.nhglib.interfaces.Updatable;
import io.github.voidzombie.nhglib.runtime.fsm.base.AssetsStates;
import io.github.voidzombie.nhglib.runtime.messaging.Message;
import io.github.voidzombie.nhglib.utils.data.Bundle;

/**
 * Created by <NAME> on 19/10/2016.
 */
public class Assets implements Updatable, AssetErrorListener {
    public final DefaultStateMachine<Assets, AssetsStates> fsm;
    public final AssetManager assetManager;

    private ArrayMap<String, Asset> assetCache;
    private Array<Asset> assetQueue;

    public Assets() {
        fsm = new DefaultStateMachine<>(this, AssetsStates.IDLE);

        assetManager = new AssetManager();
        assetManager.setLoader(Scene.class, new SceneLoader(assetManager.getFileHandleResolver()));
        assetManager.setLoader(JsonValue.class, new JsonLoader(assetManager.getFileHandleResolver()));

        assetManager.setLoader(Model.class, ".g3db", new NhgG3dModelLoader(
                new UBJsonReader(), assetManager.getFileHandleResolver()));

        assetManager.setErrorListener(this);

        assetQueue = new Array<>();
        assetCache = new ArrayMap<>();

        Texture.setAssetManager(assetManager);
    }

    // Updatable
    @Override
    public void update() {
        fsm.update();
    }

    // AssetErrorListener
    @Override
    public void error(AssetDescriptor asset, Throwable throwable) {
        throw new RuntimeException(throwable);
    }

    public void assetLoadingFinished() {<commit_msg>- Assets is no longer the AssetManager for the Texture class<commit_after>package io.github.voidzombie.nhglib.assets;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ai.fsm.DefaultStateMachine;
import com.badlogic.gdx.assets.AssetDescriptor;
import com.badlogic.gdx.assets.AssetErrorListener;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ArrayMap;
import com.badlogic.gdx.utils.JsonValue;
import com.badlogic.gdx.utils.UBJsonReader;
import io.github.voidzombie.nhglib.Nhg;
import io.github.voidzombie.nhglib.assets.loaders.JsonLoader;
import io.github.voidzombie.nhglib.assets.loaders.NhgG3dModelLoader;
import io.github.voidzombie.nhglib.assets.loaders.SceneLoader;
import io.github.voidzombie.nhglib.graphics.scenes.Scene;
import io.github.voidzombie.nhglib.interfaces.Updatable;
import io.github.voidzombie.nhglib.runtime.fsm.base.AssetsStates;
import io.github.voidzombie.nhglib.runtime.messaging.Message;
import io.github.voidzombie.nhglib.utils.data.Bundle;

/**
 * Created by <NAME> on 19/10/2016.
 */
public class Assets implements Updatable, AssetErrorListener {
    public final DefaultStateMachine<Assets, AssetsStates> fsm;
    public final AssetManager assetManager;

    private ArrayMap<String, Asset> assetCache;
    private Array<Asset> assetQueue;

    public Assets() {
        fsm = new DefaultStateMachine<>(this, AssetsStates.IDLE);

        assetManager = new AssetManager();
        assetManager.setLoader(Scene.class, new SceneLoader(assetManager.getFileHandleResolver()));
        assetManager.setLoader(JsonValue.class, new JsonLoader(assetManager.getFileHandleResolver()));

        assetManager.setLoader(Model.class, ".g3db", new NhgG3dModelLoader(
                new UBJsonReader(), assetManager.getFileHandleResolver()));

        assetManager.setErrorListener(this);

        assetQueue = new Array<>();
        assetCache = new ArrayMap<>();
    }

    // Updatable
    @Override
    public void update() {
        fsm.update();
    }

    // AssetErrorListener
    @Override
    public void error(AssetDescriptor asset, Throwable throwable) {
        throw new RuntimeException(throwable);
    }

    public void assetLoadingFinished() {
{'fraction_non_alphanumeric': 0.10707456978967496, 'fraction_numerical': 0.005098789037603569, 'mean_word_length': 4.343927355278093, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4668845', 'n_tokens_mistral': 1551, 'n_tokens_neox': 1473, 'n_words': 249}