Search in sources :

Example 1 with AboveHeadRenderer

use of cc.hyperium.mods.levelhead.renderer.AboveHeadRenderer in project Hyperium by HyperiumClient.

the class Levelhead method init.

@Override
public AbstractMod init() {
    instance = this;
    LevelheadJsonHolder jsonHolder = new LevelheadJsonHolder();
    try {
        jsonHolder = new LevelheadJsonHolder(FileUtils.readFileToString(new File(Hyperium.folder, "levelhead.json")));
    } catch (Exception e) {
        e.printStackTrace();
    }
    displayManager = new DisplayManager(jsonHolder, new File(Hyperium.folder, "levelhead.json"));
    Multithreading.runAsync(() -> types = new LevelheadJsonHolder(rawWithAgent("https://api.sk1er.club/levelhead_config")));
    Sk1erMod sk1erMod = new Sk1erMod("LEVEL_HEAD", VERSION, object -> {
        count = object.optInt("count");
        wait = object.optInt("wait", Integer.MAX_VALUE);
        if (count == 0 || wait == Integer.MAX_VALUE) {
            Hyperium.LOGGER.warn("An error occurred whilst loading loading internal Levelhead info.");
        }
    });
    sk1erMod.checkStatus();
    auth = new MojangAuth();
    Multithreading.runAsync(() -> {
        auth.auth();
        if (auth.isFailed()) {
            Hyperium.LOGGER.warn("Failed to authenticate with Levelhead: {}", auth.getFailedMessage());
        }
    });
    userUuid = Minecraft.getMinecraft().getSession().getProfile().getId();
    Hyperium.INSTANCE.getHandlers().getCommandHandler().registerCommand(new LevelheadCommand());
    Hyperium.INSTANCE.getHandlers().getCommandHandler().registerCommand(new CustomLevelheadCommand());
    LevelheadChatRenderer levelheadChatRenderer = new LevelheadChatRenderer(this);
    EventBus.INSTANCE.register(this);
    EventBus.INSTANCE.register(levelheadChatRenderer);
    EventBus.INSTANCE.register(new AboveHeadRenderer(this));
    Multithreading.runAsync(this::refreshPurchaseStates);
    Multithreading.runAsync(this::refreshRawPurchases);
    Multithreading.runAsync(this::refreshPaidData);
    return this;
}
Also used : Sk1erMod(cc.hyperium.mods.sk1ercommon.Sk1erMod) AboveHeadRenderer(cc.hyperium.mods.levelhead.renderer.AboveHeadRenderer) MojangAuth(cc.hyperium.mods.levelhead.auth.MojangAuth) CustomLevelheadCommand(cc.hyperium.mods.levelhead.command.CustomLevelheadCommand) LevelheadCommand(cc.hyperium.mods.levelhead.command.LevelheadCommand) DisplayManager(cc.hyperium.mods.levelhead.display.DisplayManager) LevelheadChatRenderer(cc.hyperium.mods.levelhead.renderer.LevelheadChatRenderer) LevelheadJsonHolder(cc.hyperium.mods.levelhead.util.LevelheadJsonHolder) File(java.io.File) CustomLevelheadCommand(cc.hyperium.mods.levelhead.command.CustomLevelheadCommand)

Aggregations

MojangAuth (cc.hyperium.mods.levelhead.auth.MojangAuth)1 CustomLevelheadCommand (cc.hyperium.mods.levelhead.command.CustomLevelheadCommand)1 LevelheadCommand (cc.hyperium.mods.levelhead.command.LevelheadCommand)1 DisplayManager (cc.hyperium.mods.levelhead.display.DisplayManager)1 AboveHeadRenderer (cc.hyperium.mods.levelhead.renderer.AboveHeadRenderer)1 LevelheadChatRenderer (cc.hyperium.mods.levelhead.renderer.LevelheadChatRenderer)1 LevelheadJsonHolder (cc.hyperium.mods.levelhead.util.LevelheadJsonHolder)1 Sk1erMod (cc.hyperium.mods.sk1ercommon.Sk1erMod)1 File (java.io.File)1