mojira.dev
MCPE-161672

[GameTest] .setlore and .nameTag dont work for ItemStack Class

When I try to use .setLore() and .nameTag to set the lore of an item or change the itemname it doesn't work

 

import { world, ItemType, ItemStack, Items } from "mojang-minecraft";
let container = player.getComponent('minecraft:inventory').container
let itemSlot = player.selectedSlot
let itemLore; try {itemLore = container.getItem(itemSlot).getLore()} catch (e) {}
let itemName; try {itemName = container.getItem(itemSlot).nameTag} catch (e) {}
let itemCount; try {itemCount = container.getItem(itemSlot).amount} catch (e) {}
let itemData; try {itemData = container.getItem(itemSlot).data} catch (e) {}
let itemID; try {itemID = container.getItem(itemSlot).id} catch (e) {}
container.setItem(itemSlot, new ItemStack(Items.get(itemID), itemCount, itemData).setLore(['Test'])) // * || This throws an error: Unexpected type passed to function argument [0].
container.getItem(itemSlot).setLore(['Test']) // * || This doesn't throw an error

 

*Both methods don't work

Attachments

Comments 3

Thank you for your report!
However, this issue has been temporarily resolved as Awaiting Response

Could you please attach an example add-on to your report?

This ticket will reopen automatically when you reply.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

It has not been fixed in 1.19.50.

Resolving temporarily as Awaiting Response. Is this still an issue in the latest version of the game?
This ticket will reopen automatically when you reply.

Enis

(Unassigned)

Unconfirmed

Multiple

Windows 10

gametest, scripting-api

1.19.40.24 Preview, 1.19.30.23 Preview, 1.19.21 Hotfix, 1.19.31 Hotfix

Retrieved