promotional bannermobile promotional banner
premium banner
UnicodeLib is a powerful backend tool that solves the complex challenge of adding and rendering custom graphical characters to Minecraft's text system, opening up a world of possibilities for creating more expressive and visually rich mods.

Description

Mod Description: UnicodeLib
UnicodeLib, or Unicode Font Library, is a library mod for Minecraft designed to serve as an API (Application Programming Interface) for other mods. Its main goal is to expand Minecraft's font rendering system, allowing other developers to easily register and display custom characters, including static and animated emojis, directly in-game.

UnicodeLib essentially doesn't add visual content itself, but rather provides other mods with the tools they need to enrich the game's text experience.

Main Features
Character Registration API: The mod exposes the UnicodeAPI, a core class that allows other mods to register new characters associated with a specific Unicode character.

Static Character Support: Developers can register a custom character from an image (sprite sheet). You can specify the exact coordinates (U, V, width, height) of the character's texture within the image file, as well as its size when rendered in-game.

Animated Character Support (GIFs): The standout feature is the ability to register animated emojis. A developer can simply provide a .gif file and associate it with a character. The library takes care of:

Decoding the GIF into its individual frames.

Managing the display time of each frame to create the animation.

Dynamically updating the texture in real time to display the animation in-game.

Custom Font Renderer Injection: To display the new characters, the mod intelligently replaces Minecraft's default font renderer with its own CustomFontRenderer. This renderer intercepts any text to be displayed, checks if it contains any of the registered custom characters, and, if so, renders the corresponding image or animation instead of the default text character.

Automatic Animation Management: The mod includes an AnimationManager that integrates with the game's rendering cycle. With each rendering tick, it updates the frame of all registered animated GIFs, ensuring smooth and synchronized animations.

Dynamic Line Height Adjustment: To prevent larger emojis or characters from overlapping text on other lines, the library calculates the maximum height of all registered custom characters and adjusts Minecraft's FONT_HEIGHT to accommodate the largest one.

How It Works in Practice
Another mod that wants to add an animated heart emoji would do the following:

It would add UnicodeLib as a dependency.

In its code, it would call the API function, for example: UnicodeAPI.registerAnimatedChar('\u2764', "/path/to/my/heart.gif");

From then on, whenever the '❤' (\u2764) character appears in any in-game text (chat, signs, item names), UnicodeLib will replace it with the animated heart GIF.

In short, UnicodeLib is a powerful backend tool that solves the complex challenge of adding and rendering custom graphical characters to Minecraft's text system, opening up a world of possibilities for creating more expressive and visually rich mods.

==============================================================

 

Descrição do Mod: UnicodeLib

 

O UnicodeLib, ou Unicode Font Library, é um mod de biblioteca para Minecraft, projetado para servir como uma API (Interface de Programação de Aplicativos) para outros mods. Seu principal objetivo é expandir o sistema de renderização de fontes do Minecraft, permitindo que outros desenvolvedores registrem e exibam facilmente caracteres personalizados, incluindo emojis estáticos e animados, diretamente no jogo.

Essencialmente, o UnicodeLib não adiciona conteúdo visual por si só, mas fornece a outros mods as ferramentas necessárias para enriquecer a experiência de texto do jogo.


 

Funcionalidades Principais

 

  1. API para Registro de Caracteres: O mod expõe a UnicodeAPI, uma classe central que permite a outros mods registrar novos caracteres associados a um caractere Unicode específico.

  2. Suporte a Caracteres Estáticos: Desenvolvedores podem registrar um caractere personalizado a partir de uma imagem (sprite sheet). É possível especificar as coordenadas exatas (U, V, largura, altura) da textura do caractere dentro do arquivo de imagem, bem como o tamanho que ele deve ter ao ser renderizado no jogo.

  3. Suporte a Caracteres Animados (GIFs): A funcionalidade de destaque é a capacidade de registrar emojis animados. Um desenvolvedor pode simplesmente fornecer um arquivo .gif e associá-lo a um caractere. A biblioteca cuida de:

    • Decodificar o GIF em seus quadros (frames) individuais.

    • Gerenciar o tempo de exibição de cada quadro para criar a animação.

    • Atualizar a textura dinamicamente em tempo real para exibir a animação no jogo.

  4. Injeção de Renderizador de Fonte Personalizado: Para que os novos caracteres sejam exibidos, o mod substitui de forma inteligente o renderizador de fontes padrão do Minecraft por seu próprio CustomFontRenderer. Este renderizador intercepta qualquer texto a ser exibido, verifica se contém algum dos caracteres personalizados registrados e, em caso afirmativo, renderiza a imagem ou animação correspondente em vez do caractere de texto padrão.

  5. Gerenciamento Automático de Animações: O mod inclui um AnimationManager que se integra ao ciclo de renderização do jogo. A cada "tick" de renderização, ele atualiza o quadro de todos os GIFs animados registrados, garantindo que as animações sejam fluidas e sincronizadas.

  6. Ajuste Dinâmico da Altura da Linha: Para evitar que emojis ou caracteres maiores se sobreponham ao texto em outras linhas, a biblioteca calcula a altura máxima entre todos os caracteres personalizados registrados e ajusta a FONT_HEIGHT (altura da fonte) do Minecraft para acomodar o maior deles.

 

Como Funciona na Prática

 

Um outro mod que queira adicionar um emoji de coração animado faria o seguinte:

  1. Adicionaria o UnicodeLib como uma dependência.

  2. Em seu código, chamaria a função da API, como por exemplo: UnicodeAPI.registerAnimatedChar('\u2764', "/caminho/para/meu/coracao.gif");

  3. A partir daí, sempre que o caractere '❤' (\u2764) aparecer em qualquer texto do jogo (chat, placas, nomes de itens), o UnicodeLib o substituirá pelo GIF animado do coração.

Em resumo, o UnicodeLib é uma poderosa ferramenta de back-end que soluciona o complexo desafio de adicionar e renderizar caracteres gráficos personalizados no sistema de texto do Minecraft, abrindo um leque de possibilidades para a criação de mods mais expressivos e visualmente ricos.