Skip to content

๐ŸŽฎ Game Utilities API

The following APIs provide some useful tool interfaces to help game content development, so that the development efficiency can be improved to a certain extent.

Format Code Utility

MC provides format control capabilities such as color text, style modification, etc. in the game through the formatting code symbol. Formatting codes are divided into two types: color codes and format codes, which respectively provide color control and style control capabilities.

The interface here is to help developers quickly get started with MC formatting code, without frequently looking up the table to use Note: The interface here will only have an effect when passed to the BDS and displayed.

Color Code Table

Color Code Symbols Color Meaning In-Game String Equivalent
Format.Black The following text is black ยง0
Format.DarkBlue The following text is dark blue ยง1
Format.DarkGreen The following text is dark green ยง2
Format.DarkAqua The following text is lake blue ยง3
Format.DarkRed The following text is dark red ยง4
Format.DarkPurple The following text is purple ยง5
Format.Gold The following text is gold ยง6
Format.Gray The following text is gray ยง7
Format.DarkGray The following text is dark grey ยง8
Format.Blue The following text is blue ยง9
Format.Green The following text is light green ยงa
Format.Aqua The following text is sky blue ยงb
Format.Red The following text is red ยงc
Format.LightPurple The following text is light purple ยงd
Format.Yellow The following text is light yellow ยงe
Format.White The following text is white ยงf
Format.MinecoinGold The following text is coin gold ยงg

Format Code Table

Format Code Symbol Format Meaning In-Game String Eqivalent
Format.Bold The following text is Bold ยงl
Format.Italics The following text is Italic ยงo
Format.Underline The following text is Underline ยงn
Format.StrikeThrough The following text is Strikethrough ยงm
Format.Random The following text is randomly flashed garbled characters ยงk
Format.Clear The following text clears all formatting ยงr

The method used by the above code is a connection string, similar to:

[JavaScript]

JavaScript
1
mc.broadcast(Format.Red + Format.Bold + "Red & Bold " + Format.DarkGreen + Format.Underline + "DarkGreen & Underline" + Format.Clear + "Clear");
[Lua]
Lua
1
mc.broadcast(Format.Red .. Format.Bold .. "Red & Bold " .. Format.DarkGreen .. Format.Underline .. "DarkGreen & Underline" .. Format.Clear .. "Clear")