Skip to content
On this page

๐ŸŽฎ 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 SymbolsColor MeaningIn-Game String Equivalent
Format.BlackThe following text is blackยง0
Format.DarkBlueThe following text is dark blueยง1
Format.DarkGreenThe following text is dark greenยง2
Format.DarkAquaThe following text is lake blueยง3
Format.DarkRedThe following text is dark redยง4
Format.DarkPurpleThe following text is purpleยง5
Format.GoldThe following text is goldยง6
Format.GrayThe following text is grayยง7
Format.DarkGrayThe following text is dark greyยง8
Format.BlueThe following text is blueยง9
Format.GreenThe following text is light greenยงa
Format.AquaThe following text is sky blueยงb
Format.RedThe following text is redยงc
Format.LightPurpleThe following text is light purpleยงd
Format.YellowThe following text is light yellowยงe
Format.WhiteThe following text is whiteยงf
Format.MinecoinGoldThe following text is coin goldยงg

Format Code Table

Format Code SymbolFormat MeaningIn-Game String Eqivalent
Format.BoldThe following text is Boldยงl
Format.ItalicsThe following text is Italicยงo
Format.UnderlineThe following text is Underlineยงn
Format.StrikeThroughThe following text is Strikethroughยงm
Format.RandomThe following text is randomly flashed garbled charactersยงk
Format.ClearThe following text clears all formattingยงr

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

[JavaScript]

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

[Lua]

Lua
mc.broadcast(Format.Red .. Format.Bold .. "Red & Bold " .. Format.DarkGreen .. Format.Underline .. "DarkGreen & Underline" .. Format.Clear .. "Clear")