How to use the @xmcl/text-component.TextComponent.from function in @xmcl/text-component

To help you get started, we’ve selected a few @xmcl/text-component examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Voxelum / minecraft-launcher-core-node / packages / client / index.ts View on Github external
        static error() { return new Status(TextComponent.from("Error"), TextComponent.from("Error"), -1, -1, -1); }
        static from(obj: ServerStatusFrame | Status): Status {
github Voxelum / minecraft-launcher-core-node / packages / client / index.ts View on Github external
static from(obj: ServerStatusFrame | Status): Status {
            if (obj instanceof Status) {
                return obj;
            }
            let motd: TextComponent = TextComponent.from("");
            if (obj.description) {
                motd = TextComponent.from(obj.description);
            }
            const favicon = obj.favicon;
            const version = obj.version;
            let versionText: TextComponent = TextComponent.from("");
            let protocol = -1;
            let online = -1;
            let max = -1;
            if (version) {
                if (version.name) {
                    versionText = TextComponent.from(version.name);
                }
                if (version.protocol) {
                    protocol = version.protocol;
                }
            }
            const players = obj.players;
            if (players) {
                online = players.online;
                max = players.max;
            }
github Voxelum / minecraft-launcher-core-node / packages / client / index.ts View on Github external
        static pinging() { return new Status(TextComponent.from("unknown"), TextComponent.from("Pinging..."), -1, -1, -1); }
        static error() { return new Status(TextComponent.from("Error"), TextComponent.from("Error"), -1, -1, -1); }
github Voxelum / minecraft-launcher-core-node / packages / client / index.ts View on Github external
static from(obj: ServerStatusFrame | Status): Status {
            if (obj instanceof Status) {
                return obj;
            }
            let motd: TextComponent = TextComponent.from("");
            if (obj.description) {
                motd = TextComponent.from(obj.description);
            }
            const favicon = obj.favicon;
            const version = obj.version;
            let versionText: TextComponent = TextComponent.from("");
            let protocol = -1;
            let online = -1;
            let max = -1;
            if (version) {
                if (version.name) {
                    versionText = TextComponent.from(version.name);
                }
                if (version.protocol) {
                    protocol = version.protocol;
                }
            }
            const players = obj.players;
github Voxelum / minecraft-launcher-core-node / packages / client / index.ts View on Github external
if (obj instanceof Status) {
                return obj;
            }
            let motd: TextComponent = TextComponent.from("");
            if (obj.description) {
                motd = TextComponent.from(obj.description);
            }
            const favicon = obj.favicon;
            const version = obj.version;
            let versionText: TextComponent = TextComponent.from("");
            let protocol = -1;
            let online = -1;
            let max = -1;
            if (version) {
                if (version.name) {
                    versionText = TextComponent.from(version.name);
                }
                if (version.protocol) {
                    protocol = version.protocol;
                }
            }
            const players = obj.players;
            if (players) {
                online = players.online;
                max = players.max;
            }

            const sample = players.sample;
            let profiles = new Array();
            if (sample) {
                profiles = new Array(sample.length);
                for (let i = 0; i < sample.length; i++) {
github Voxelum / minecraft-launcher-core-node / packages / client / index.ts View on Github external
static from(obj: ServerStatusFrame | Status): Status {
            if (obj instanceof Status) {
                return obj;
            }
            let motd: TextComponent = TextComponent.from("");
            if (obj.description) {
                motd = TextComponent.from(obj.description);
            }
            const favicon = obj.favicon;
            const version = obj.version;
            let versionText: TextComponent = TextComponent.from("");
            let protocol = -1;
            let online = -1;
            let max = -1;
            if (version) {
                if (version.name) {
                    versionText = TextComponent.from(version.name);
                }
                if (version.protocol) {
                    protocol = version.protocol;
                }

@xmcl/text-component

Parse Minecraft text component and render it to css.

MIT
Latest version published 1 year ago

Package Health Score

52 / 100
Full package analysis

Popular @xmcl/text-component functions