Search in sources :

Example 1 with CustomTextRenderer

use of meteordevelopment.meteorclient.renderer.text.CustomTextRenderer in project meteor-client by MeteorDevelopment.

the class Fonts method load.

@Init(stage = InitStage.Post)
public static void load() {
    if (lastFont.equals(Config.get().font.get()))
        return;
    File file = new File(FOLDER, Config.get().font + ".ttf");
    if (!file.exists()) {
        Config.get().font.set(DEFAULT_FONT);
        file = new File(FOLDER, Config.get().font + ".ttf");
    }
    try {
        CUSTOM_FONT = new CustomTextRenderer(file);
    } catch (Exception ignored) {
        Config.get().font.set(DEFAULT_FONT);
        file = new File(FOLDER, Config.get().font + ".ttf");
        CUSTOM_FONT = new CustomTextRenderer(file);
    }
    if (mc.currentScreen instanceof WidgetScreen && Config.get().customFont.get()) {
        ((WidgetScreen) mc.currentScreen).invalidate();
    }
    lastFont = Config.get().font.get();
}
Also used : CustomTextRenderer(meteordevelopment.meteorclient.renderer.text.CustomTextRenderer) WidgetScreen(meteordevelopment.meteorclient.gui.WidgetScreen) File(java.io.File) Init(meteordevelopment.meteorclient.utils.Init)

Example 2 with CustomTextRenderer

use of meteordevelopment.meteorclient.renderer.text.CustomTextRenderer in project meteor-client by MeteorDevelopment.

the class Fonts method init.

@Init(stage = InitStage.Pre)
public static void init() {
    FOLDER.mkdirs();
    // Copy built in fonts if they not exist
    for (String font : BUILTIN_FONTS) {
        File file = new File(FOLDER, font);
        if (!file.exists()) {
            StreamUtils.copy(Fonts.class.getResourceAsStream("/assets/" + MeteorClient.MOD_ID + "/fonts/" + font), file);
        }
    }
    // Load default font
    CUSTOM_FONT = new CustomTextRenderer(new File(FOLDER, DEFAULT_FONT + ".ttf"));
    lastFont = DEFAULT_FONT;
}
Also used : CustomTextRenderer(meteordevelopment.meteorclient.renderer.text.CustomTextRenderer) File(java.io.File) Init(meteordevelopment.meteorclient.utils.Init)

Aggregations

File (java.io.File)2 CustomTextRenderer (meteordevelopment.meteorclient.renderer.text.CustomTextRenderer)2 Init (meteordevelopment.meteorclient.utils.Init)2 WidgetScreen (meteordevelopment.meteorclient.gui.WidgetScreen)1