Miscellaneous

How-To use miscellaneous CraftedCore features

  1. TimerOverlayRenderer
  2. Register Key Bindings
  3. Getting the Patreons List
  4. Caching Textures

TimerOverlayRenderer

Here’s an example implementation:

public class OverlayRendererImpl {

    public static void initialize() {
        RenderEvents.HUD_RENDERING.register((matrices, delta) -> {
            TimerOverlayRenderer.register(matrices, cooldown, maxCooldown, iconAsItem);
        });
    }
}

By defining the cooldown, maxCooldown and iconAsItem, you’ll see a icon like the following in your bottom-right corner of you’re in-game-HUD:

red dye as overlay

Register Key Bindings

This will register a key in your menu settings.

public static final KeyMapping SOME_KEY = new KeyMapping("key.some_key_lang", InputConstants.Type.KEYSYM,
    GLFW.GLFW_KEY_GRAVE_ACCENT, "key.categories.key_category");

KeyBindingRegistry.register(SOME_KEY);

Remember to replace "key.some_key_lang", GLFW.GLFW_KEY_GRAVE_ACCENT and “key.categories.key_category" in the example!

Getting the Patreons List

Calling VIPs.cachePatreons() returns a List<UUID>, where patreons are obtained from the remote CraftedCore repository, a built-in file and, if enabled, the CraftedCore-Config.

Caching Textures

This caches an texture at the specified URL and parses it into Minecraft’s texture management. This returns the assigned ResourceLocation of the texture or null, if there was an error parsing the texture.

TextureCache.getTextureId(namespace, type, prefix, fileType, textureURL);

// e.g. the following will return the ResourceLocation (where the "random numbers" are auto-generated):
// modid:textures/entity/custom_skin_<random numbers>.png
TextureCache.getTextureId("modid", "entity", "custom_skin_", "png", new URI("https://example.com/skin.png").toURL());

Continue with Events