#RawMessage(Translate) in Item Lore

1 messages · Page 1 of 1 (latest)

old mason
#

Guys can i make item lore with translate instead of using string ?

import * as Minecraft from "@minecraft/server";

export function event() {
    Minecraft.system.runInterval(() => {
    for(let player of Minecraft.world.getPlayers()) {
        const inventory= player.getComponent("inventory");
        const container = inventory.container;
        for(let i=0;i<container.size;i++) {
            let item = container.getItem(i);
            if(item && item.hasTag("digimobs:require_lore")) {
                item.setLore([ `%item.${item.typeId}.lore` ]);
                container.setItem(i, item);
            }
        }
    }
    }, 20)
}
#

I tried using rawtext object and it throws an errror

clever acorn
#

You can't

pliant cosmos
#

You can't make it translatable unfortunately. It only accept array of string.

Raw Message isn't supported probably because of length string limitation.

brisk zinc
#

Could a translation be serialized into a string before setting it to lore?

#

I am thinking along the lines of "send a raw message to a player, then read the chat message contents"-type deal, but less awful and more synchronous

kindred pebble
brisk zinc
#

According to the docs, getText should return the string. Perhaps it needs time (a tick) to write to the sign?

#

A shame that it doesn't work synchronously though

kindred pebble
#

but let me know if you had made it work, im also really longing for it

brisk zinc
#

Even system.run() wouldn't be sufficient?

#

I am curious about it, I could try it tomorrow

kindred pebble
nimble moon
#

i suppose we can translate strings cuz in form ui i traslated button with 'skill.combat.name' as string and in lang file i did skill.combat.name=Combat Skill

#

@old mason

kindred pebble
brisk zinc