node-minecraft-protocol icon indicating copy to clipboard operation
node-minecraft-protocol copied to clipboard

Slot data documentation

Open Sceat opened this issue 7 years ago • 1 comments

Issue

Documentation is wrong about slot datas (i assume)

Solution

I spent almost an hour to understand that content was in fact just a prismarine item.toNotch. Would be nice for new users to precise explicitly this matter in docs somehow.

The correct format is the following (or maybe i just don't know how to read the doc table ?)

import prismarineItem from "prismarine-item"
const Item = prismarineItem('1.12.1')

const stick = new Item(280, 5)
const notchStick = Item.toNotch(stick)
this.client.write('window_items', {
    windowId: 0,
    items: [0, 0, 0, notchStick, notchStick, 0, notchStick],
})

Sceat avatar Dec 10 '18 13:12 Sceat

slot is defined here https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.13.2/protocol.json#L32

The documentation cannot be "wrong" because it's based on the file nmp is implemented with (protocol.json). However yes, it's missing information. See https://github.com/PrismarineJS/minecraft-data/issues/123

rom1504 avatar Dec 15 '18 18:12 rom1504