Glyphs
How to add new glyphs to the game?
Last updated
How to add new glyphs to the game?
Last updated
A glyph is a textured unicode symbol. It can be used in any place text is rendered ingame (chat, item name, lore and more). They can be used to do very, very powerful things (custom inventories, extra bars) but their simplest use is to be emoji.
You first need to create a png texture. For example the heart.png file contained in default/chat
.
You can then add your section to any yaml file from the glyphs directory.
A glyph has a few main properties, texture
, ascent
, height
and font
The texture is the path and name of the texture file in the format of namespace:path
height
is the scale of your glyph, height must also never be lower than ascent.
ascent
is the vertical offset of your glyph, and must be equal or lower than height.
font
is the font you want to use. If unspecified, minecraft:default
will be used.
It is generally adviced to set a font unless you want to use the glyph in Esc Menu, as that only accepts the default font.
The textures cannot be higher resolution than 256x256 and name of the texture must be all lowercase without spaces, as with all Resourcepack files.
To adjust the horizontal position of your texture/glyph in the inventory, use the shift-tag. <shift:-8>
for moving 8 pixels back, and <shift:211>
for moving 211 pixels forward.
This really is not necessary as Nexo will handle the <glyph:glyph_id>
tag in any inventory / title.
So to add this glyph in any other plugin, just set the title to be <glyph:glyph_id>
.
If you still want the raw unicode, you can find it in your glyphs config.
If you have a png consisting of several emotes, you can make it a multi-bitmap.
This means you can, tie several glyphs to one image. This step requires some extra configuration to work however.
In fonts.yml there is a section for bitmaps
.
Here you need to specify an id
, which you will use in your glyph-configs.
You also need to specify the path to the texture, as well as how many rows and columns the bitmap has.
Below is an example of an entry in fonts.yml
:
As you can see, the image shown above has 4 rows and 9 columns. The ascent and height property will be the one used for all glyphs tied to this bitmap. Now that you have your bitmap configured, you can link a glyphs to it. In your glyph config, you need to specify the bitmap id, as well as the row and column of the glyph you want to use. Below is an example of a glyph config using the bitmap above.
This will link the glyph to the first emoji on the first row in the image above.
To make a glyph appear under /nexo emojis
you need to specify that it is one, like below.
If not specified, this will default to false
You need to add a chat subsection to your glyph section:
The placeholders can be used in chat by players with the required permission (if permission is specified, it is not mandatory).
If it does not format your glyph in chat, change the chat-handler
in settings.yml, as your chat-plugin is likely using LEGACY
logic.
Simply set tabcomplete: true
in the chat-section. If not specified, this will default to false
The section name is the glyph id. In this example the glyph id is heart
, the placeholder is %nexo_glyphid%
, so in this example: %nexo_heart%
Glyph-ID is the first line in any glyphs config, it is not the texturename or the placeholder.
To add a glyph to a luckperms prefix, commonly to display ranks, simply add %nexo_glyphid%
to your prefix solution of choice.
For example, if using LuckPerms, you can use the command: /lp group default meta setprefix %nexo_glyphid%
and it will replace it with the glyph.
Because most plugins only parse the placeholders one time, the %luckperms_prefix% will not be parsed again.
You will most likely need to get the Utils-Expansion for PlaceholderAPI aswell.
To get this, go to this link, and place it in your plugins/PlaceholderAPI/expansions folder.
Then in your plugin of choice use %utils_parse:2_luckperms_prefix%
to parse the prefix again.
Keep in mind your chatplugin must support PlaceholderAPI for this to work.
If this does not work for whatever reason, you can always use the raw unicode from your glyph-config's char
-property
Any glyph can be used in name and lore of your item configurations, by using <glyph:glyphid>
It will also, by default, only show emojis the player has the permission for.
In settings.yml
you can toggle the only_show_emojis_with_permission
setting.
This will show all emojis to every player, and adds a hover-message indicating if they have permission or not.