XiaoMoMi Plugins
ไธญๆ–‡็ปดๅŸบ
CustomNameplates
CustomNameplates
  • Plugin Wiki
    • ๐Ÿ€ CustomNameplates
      • โœ๏ธ Text format
      • โ“๏ธ Common Questions
      • ๐Ÿ“– Basic Font Knowledge
      • โš™๏ธ Config
        • config.yml
        • bossbar.yml
        • actionbar.yml
        • bubble.yml
        • nameplate.yml
        • advance-data.yml
      • โž•๏ธ Add New Contents
        • ๐Ÿท๏ธ Nameplate
        • ๐Ÿ–ผ๏ธ Background
        • ๐Ÿ’ฌ Bubble
        • ๐Ÿ”ถ Image
      • ๐Ÿ…ฟ๏ธ Custom Placeholders
        • Switch Text
        • Background/Nameplate/Bubble Text
        • Shift Text
        • Conditional Text
        • Static Text
        • Vanilla Hud
      • ๐Ÿ…ฟ๏ธ Placeholders
      • โœ… Condition
      • ๐Ÿš Command & Permission
      • ๐Ÿค Compatibility
        • MagicCosmetics
      • ๐Ÿ” Examples
        • Stamina Bar
        • One Time Bedrock ActionBar
      • โŒจ๏ธ API
        • Basic Operations
      • ๐Ÿ“ CustomNameplates Update: Version 2.4 to 3.0 Overview
Powered by GitBook
On this page
  1. Plugin Wiki
  2. ๐Ÿ€ CustomNameplates
  3. ๐Ÿ…ฟ๏ธ Custom Placeholders

Shift Text

PreviousBackground/Nameplate/Bubble TextNextConditional Text

shift-text provides vertical offset for text. The default configuration applies a slight downward shift to better align the text with the background positioning. This ensures that the text is displayed in harmony with other visual elements, such as nameplates or bubbles, improving overall aesthetic consistency.

# /configs/custom-placeholder.yml
shift-text:
  weather:
    text: "Weather: %np_conditional_weather%"
    font: shift_1

Fonts are registered within the config.yml file. Here are a few examples to demonstrate how this system works:

# config.yml
shift-fonts:
  shift_1:
  - "space"
  - "nonlatin_european:3"
  - "accented:6"
  - "ascii:3"
  - "legacy_unicode:3"

Using shift_1 as an example, if the ascii font has a height of 8 pixels (font image height) and an ascent of 3, it means the text is shifted downward by 5 pixels relative to its normal position. This downward offset is calculated as the difference between the height and ascent (8 - 3 = 5), meaning the text will appear lower than usual to align with other elements.

Hereโ€™s an example of the default height configuration for fonts in config.yml:

ascii: 8
ascii_sga: 8
asciillager: 8
nonlatin_european: 8
accented: 12

For the accented font, due to its larger height, a higher ascent value is used to maintain proper alignment. In this case, an ascent of 6 is applied instead of 3, balancing the larger font height for accented characters.

By adjusting the values in the configuration, you'll notice a clear visual difference in how the text is rendered. Hereโ€™s an example of how these adjustments might look: (Please note that after making these adjustments, you'll need to reload your resource pack for the changes to take effect! This ensures that all the new font settings, such as the updated heights and ascents, are properly applied and reflected in-game.)

shift_1:
- "space"
- "nonlatin_european:3"
- "accented:6"
- "ascii:-15"
- "legacy_unicode:3"
shift_1:
- "space"
- "nonlatin_european:3"
- "accented:6"
- "ascii:-30"
- "legacy_unicode:3"

When using this in practice, you only need to select the specific character sets you plan to use and create offset fonts accordingly. This approach minimizes the size of the resource pack by avoiding the inclusion of unnecessary character sets, leading to better performance and faster loading times.

In the default configuration, since only numbers are used for displaying gold, money uses shift_2 and selected the ASCII character set. This efficiently minimizes the resource pack by only including the necessary characters for the money display.

# config.yml
shift-fonts:
  shift_2:
  - "space"
  - "ascii:-15"
# /configs/custom-placeholder.yml
shift-text:
  money:
    text: "%vault_eco_balance%"
    font: shift_2
ascii:3
ascii:-15
ascii:-30