1.2.2 • Published 4 years ago

mc-chat-format v1.2.2

Weekly downloads
45
License
MIT
Repository
github
Last release
4 years ago

mc-chat-format

Translate and convert Minecraft's chat components into plain text or a string component.

import { format, convert, flatten } from "mc-chat-format"

format({
    translate: "death.attack.player.item",
    with: ["jeb_", "Notch", { translate: "item.minecraft.wooden_shovel" }]
})
// ⮡ 'jeb_ was slain by Notch using Wooden Shovel'

flatten({ text: "1 ", extra: [{ text: "2", extra: [{ text: " 3" }] }] })
// ⮡ [ { text: '1 ' }, { text: '2' }, { text: ' 3' } ]

convert({
    translate: "block.minecraft.comparator",
    bold: true,
    insertion: "Test"
}, { stripNonText: true })
// ⮡ { text: 'Redstone Comparator', bold: true }

format({
    text: "§bHello §cworld",
    bold: true
}, { useAnsiCodes: true })
// ⮡ '\x1b[1m\x1b[38;2;85;255;255mHello \x1b[38;2;255;85;85mworld\x1b[0m'
1.2.2

4 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago