How can you get the entire description of an item? #1517
-
Versions
Clear questionHow can you get the entire description of an item? Using .map What did you try yet?
Your current codeHow do I get the slot, number, name: let slotsw = bot.currentWindow.slots.filter(el => el !== null)
let spisok = slotsw.map(({slot, count, nbt, displayName}) =>
[slot+' '+'x'+count+' '+(JSON.parse(nbta.simplify(nbt).display.Name).extra[0].text || '')+' '+'('+displayName+')'+'\n']) Additional context |
Beta Was this translation helpful? Give feedback.
Answered by
TheDudeFromCI
Dec 24, 2020
Replies: 2 comments
-
Are you trying to get the description of all items? |
Beta Was this translation helpful? Give feedback.
0 replies
-
function getLore(item) {
let message = ''
if (item.nbt == null) return message
const nbt = require('prismarine-nbt')
const ChatMessage = require('prismarine-chat')(bot.version)
const data = nbt.simplify(item.nbt)
const display = data['display']
if (display == null) return message
const lore = display['Lore']
if (lore == null) return message
for (const line of lore) {
for (const group of JSON.parse(line)) {
message += new ChatMessage(group).toString()
message += '\n'
}
}
return message
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
rom1504
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@goncharovchik