-
-
Notifications
You must be signed in to change notification settings - Fork 254
Description
const nbtBuffer = Buffer.from([ // follow wiki nbt
0x22, // 34
0x0A, // compound
0x00, 0x00, // 0
//
0x08, // string
0x00, 0x02, // 2
0x69, 0x64, // id
0x00, 0x17, // 23
0x6D, 0x69, 0x6E, 0x65, 0x63, 0x72, 0x61, 0x66, 0x74, // minecraft
0x3A, // :
0x63, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x5F, 0x62, 0x6C, 0x6F, 0x63, 0x6B, // command_block
0x00 // end compound
]);
bot.write('set_creative_slot', {
slot: 36,
item: {
itemCount: 1,
itemId: 425, // command_block
addedComponentCount: 1,
components: [{
type: 51, // block_entity_data
data: nbtBuffer // byteArray
/*
this work in 1.21.4
type: "block_entity_data",
data: {
type: "compound",
value: {
id: {
type: "string",
value: "command_block"
}
}
}
*/
}],
removedComponentCount: 0,
removeComponents: []
}
});
Change to a version higher than 1.21.4, will got this error
TypeError [ERR_INVALID_ARG_TYPE]: SizeOf error for undefined : The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Object
minecraft-data changed it to UntrustedSlot
The 'data' field is a varint-prefixed byte array that contains the actual component data. The code generator will need to know that it should read a varint for length, then the bytes.
"data" field should be a single buffer structured as: [VarInt Length] + [NBT Data Buffer]
Then i search these for "data" field: mineflayer prismarine-item Slot_data wiki.vg_merge/NBT
Make it in code nbtBuffer then still dont work the server still kick the bot.
Failed to decode packet 'serverbound/minecraft:set_creative_mode_slot'
i ask for help
is my understanding of the "data" field correct?
has this been implemented in prismarine-item or mineflayer yet, and if so, how should it be used?