use of meteordevelopment.meteorclient.utils.Init 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();
}
use of meteordevelopment.meteorclient.utils.Init 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;
}
use of meteordevelopment.meteorclient.utils.Init in project meteor-client by MeteorDevelopment.
the class AddonManager method init.
@Init(stage = InitStage.Pre)
public static void init() {
// Meteor pseudo addon
{
METEOR = new MeteorAddon() {
@Override
public void onInitialize() {
}
};
ModMetadata metadata = FabricLoader.getInstance().getModContainer("meteor-client").get().getMetadata();
METEOR.name = metadata.getName();
METEOR.authors = new String[metadata.getAuthors().size()];
if (metadata.containsCustomValue("meteor-client:color"))
METEOR.color.parse(metadata.getCustomValue("meteor-client:color").getAsString());
int i = 0;
for (Person author : metadata.getAuthors()) {
METEOR.authors[i++] = author.getName();
}
}
// Addons
for (EntrypointContainer<MeteorAddon> entrypoint : FabricLoader.getInstance().getEntrypointContainers("meteor", MeteorAddon.class)) {
ModMetadata metadata = entrypoint.getProvider().getMetadata();
MeteorAddon addon = entrypoint.getEntrypoint();
addon.name = metadata.getName();
addon.authors = new String[metadata.getAuthors().size()];
if (metadata.containsCustomValue("meteor-client:color"))
addon.color.parse(metadata.getCustomValue("meteor-client:color").getAsString());
int i = 0;
for (Person author : metadata.getAuthors()) {
addon.authors[i++] = author.getName();
}
ADDONS.add(addon);
}
}
use of meteordevelopment.meteorclient.utils.Init in project meteor-client by MeteorDevelopment.
the class MeteorClient method reflectInit.
private static void reflectInit(Method task, InitStage initStage, Set<Method> left, Map<Class<?>, List<Method>> byClass) {
left.remove(task);
Init init = task.getAnnotation(Init.class);
if (!init.stage().equals(initStage))
return;
for (Class<?> clazz : init.dependencies()) {
for (Method m : byClass.getOrDefault(clazz, Collections.emptyList())) {
if (left.contains(m)) {
reflectInit(m, initStage, left, byClass);
}
}
}
try {
task.invoke(null);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
use of meteordevelopment.meteorclient.utils.Init in project meteor-client by MeteorDevelopment.
the class EntityShaders method initOutlines.
// Outlines
@Init(stage = InitStage.Pre)
public static void initOutlines() {
outlinesShader = new Shader("outline.vert", "outline.frag");
outlinesFramebuffer = new SimpleFramebuffer(mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight(), false, false);
outlinesVertexConsumerProvider = new OutlineVertexConsumerProvider(mc.getBufferBuilders().getEntityVertexConsumers());
}
Aggregations