Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const mc = require('minecraft-protocol')
- const minecraftData = require('minecraft-data')('1.18.2')
- const nbt = require('prismarine-nbt')
- /*
- client.write('block_dig', {
- location: {
- x: Math.round(data.x + 1),
- y: Math.round(data.y),
- z: Math.round(data.z)
- }
- })
- client.write('set_creative_slot', {
- slot: 36,
- item: {
- present: true,
- itemId: minecraftData.itemsByName.chest.id,
- itemCount: 1,
- nbtData: nbt.comp({
- BlockEntityTag: nbt.comp({
- id: nbt.string('minecraft:chest'),
- Items: nbt.list(
- nbt.comp([
- {
- Slot: nbt.byte(0),
- Count: nbt.byte(1),
- id: nbt.string('minecraft:stone')
- }
- ])
- )
- })
- })
- }
- })
- client.write('block_place', {
- hand: 0,
- location: {
- x: Math.round(data.x + 1),
- y: Math.round(data.y),
- z: Math.round(data.z)
- },
- cursorX: 0,
- cursorY: 0,
- cursorZ: 0,
- insideBlock: false,
- direction: 1
- })
- */
- /*
- client.on('position', position => {
- client.write('teleport_confirm', { teleportId: position.teleportId })
- client.write('block_place', {
- hand: 0,
- location: {
- x: Math.floor(position.x),
- y: Math.floor(position.y - 1),
- z: Math.floor(position.z)
- },
- direction: 2,
- cursorX: 0.5,
- cursorY: 0.5,
- cursorZ: 0.5,
- insideBlock: false
- })
- client.once('open_window', window => {
- const interval = setInterval(() => {
- client.write('set_item')
- }, 1000)
- clearInterval(interval)
- })
- })
- */
- const client = mc.createClient({
- host: '129.159.58.114',
- port: 25565,
- username: 'diffbot',
- password: null
- })
- client.once('kick_disconnect', reason => {
- console.error(reason)
- })
- client.once('end', reason => {
- console.error(reason)
- })
- client.once('connected', () => {
- console.log('Connected!')
- })
- // Run code once inventory is loaded
- client.once('window_items', () => {
- setInterval(() => {
- client.write('set_creative_slot', {
- slot: 22,
- item: {
- present: true,
- itemId: minecraftData.itemsByName.stone.id,
- itemCount: 1,
- nbtData: nbt.comp({
- display: nbt.comp({
- Lore: nbt.list(nbt.comp([
- nbt.string('{"text":"among us"}')
- ]))
- })
- })
- }
- })
- }, 1000)
- })
Add Comment
Please, Sign In to add comment