Minecraft Data Packs / Game Mechanic

Simple Text Formatting (1.20+): Use formatting codes in anvils and books!

  • check_circle Functions
  • 6,708 views, 25 today
  • 955 downloads, 4 today
  • 26
  • 24
  • 2
Oligo's Avatar Oligo
Level 37 : Artisan Crafter
22
Simple Text Formatting (1.20+)
Use formatting codes in anvils and books!
A datapack by Oligo

Description
This datapack implements formatting codes for making customized text without JSON formatting! Formatting codes can be used to customize item names within anvils and text within books without the need for commands or special permissions. This makes text formatting accessible to all players regardless of gamemode or op status!

Usage
Text in books or anvils can be customized using the Ampersand sign (&) followed by any of the available formatting codes (listed below). For item names, text formatting is updated once the item is placed in the player's inventory after using the anvil. For writable books, text formatting is updated once the book is signed in the player's inventory.

This datapack offers the following formatting codes for text customization:
Code
Name
&0
Black
&1
Dark Blue
&2
Dark Green
&3
Dark Aqua
&4
Dark Red
&5
Dark Purple
&6
Gold
&7
Gray
&8
Dark Gray
&9
Blue
&a
Green
&b
Aqua
&c
Red
&d
Light Purple
&e
Yellow
&f
White
&k
Obfuscated
&l
Bold
&m
Strikethrough
&n
Underline
&o
Italic
&r
Reset

Formatting Rules
  1. Multiple formatting codes can be placed after each other to create mixed formatting (see example 1)
  2. Unlike Vanilla Minecraft, formatting codes do not overwrite color codes and vice versa (see example 2)
  3. The &r formatting code can be used to reset any currently set formatting (see example 3)
  4. Any ampersand character followed by an invalid code is treated as plain text (see example 4)
  5. Ampersand characters can be inserted into formatted text using an escape character (see example 5)
  6. Formatting codes count towards the character limit of item names and book text
Examples
Example
Raw String
Formatted String
1
&l&o&6Hello World
Hello World
2
&lHello &4World
Hello World
3
&l&6Hello &rWorld
Hello World
4
&4Tom & Jerry
Tom & Jerry
5
red\&blue
red&blue

Credits
Datapack was written and tested by Oligo. Give credit if using for other projects.
CompatibilityMinecraft 1.20
Tags

Create an account or sign in to comment.

1
11/02/2023 6:56 am
Level 1 : New Miner
User4879850G
User4879850G's Avatar
why does this spawn a yellow shulker box near the world border? could you please make a version of this that does not spawn that shulker box?
1
07/10/2023 6:38 pm
Level 1 : New Miner
Shadins
Shadins's Avatar
I can't seem to get this to work. I have even copied "&l&o&6Hello World" and still can't get it to work. I am naming a name tag for a mob and I just see the & and letters/nums and name once I place it from the anvil to my inventory. Im not sure if I'm missing somehting.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome