Skip to content

Commit f860eac

Browse files
authored
Fix chatterbox example not getting dropped item
1 parent 03846f6 commit f860eac

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

examples/chatterbox.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,8 @@ bot.on('playerLeft', (player) => {
168168
bot.chat(`Bye ${player.username}`)
169169
})
170170
bot.on('playerCollect', (collector, collected) => {
171-
if (collector.type === 'player' && collected.type === 'object') {
172-
const rawItem = collected.metadata[10]
173-
const item = mineflayer.Item.fromNotch(rawItem)
171+
if (collector.type === 'player') {
172+
const item = collected.getDroppedItem()
174173
bot.chat(`${collector.username !== bot.username ? ("I'm so jealous. " + collector.username) : 'I '} collected ${item.count} ${item.displayName}`)
175174
}
176175
})

0 commit comments

Comments
 (0)