Dinhero21

Bot test

Jun 27th, 2022 (edited)
566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const mc = require('minecraft-protocol')
  2. const minecraftData = require('minecraft-data')('1.18.2')
  3. const nbt = require('prismarine-nbt')
  4.  
  5. /*
  6. client.write('block_dig', {
  7.   location: {
  8.     x: Math.round(data.x + 1),
  9.     y: Math.round(data.y),
  10.     z: Math.round(data.z)
  11.   }
  12. })
  13.  
  14. client.write('set_creative_slot', {
  15.   slot: 36,
  16.   item: {
  17.     present: true,
  18.     itemId: minecraftData.itemsByName.chest.id,
  19.     itemCount: 1,
  20.     nbtData: nbt.comp({
  21.       BlockEntityTag: nbt.comp({
  22.         id: nbt.string('minecraft:chest'),
  23.         Items: nbt.list(
  24.           nbt.comp([
  25.             {
  26.               Slot: nbt.byte(0),
  27.               Count: nbt.byte(1),
  28.               id: nbt.string('minecraft:stone')
  29.             }
  30.           ])
  31.         )
  32.       })
  33.     })
  34.   }
  35. })
  36.  
  37. client.write('block_place', {
  38.   hand: 0,
  39.   location: {
  40.     x: Math.round(data.x + 1),
  41.     y: Math.round(data.y),
  42.     z: Math.round(data.z)
  43.   },
  44.   cursorX: 0,
  45.   cursorY: 0,
  46.   cursorZ: 0,
  47.   insideBlock: false,
  48.   direction: 1
  49. })
  50. */
  51.  
  52. /*
  53. client.on('position', position => {
  54.   client.write('teleport_confirm', { teleportId: position.teleportId })
  55.  
  56.   client.write('block_place', {
  57.     hand: 0,
  58.     location: {
  59.       x: Math.floor(position.x),
  60.       y: Math.floor(position.y - 1),
  61.       z: Math.floor(position.z)
  62.     },
  63.     direction: 2,
  64.     cursorX: 0.5,
  65.     cursorY: 0.5,
  66.     cursorZ: 0.5,
  67.     insideBlock: false
  68.   })
  69.  
  70.   client.once('open_window', window => {
  71.     const interval = setInterval(() => {
  72.       client.write('set_item')
  73.     }, 1000)
  74.  
  75.     clearInterval(interval)
  76.   })
  77. })
  78. */
  79.  
  80. const client = mc.createClient({
  81.   host: '129.159.58.114',
  82.   port: 25565,
  83.   username: 'diffbot',
  84.   password: null
  85. })
  86.  
  87. client.once('kick_disconnect', reason => {
  88.   console.error(reason)
  89. })
  90.  
  91. client.once('end', reason => {
  92.   console.error(reason)
  93. })
  94.  
  95. client.once('connected', () => {
  96.   console.log('Connected!')
  97. })
  98.  
  99. // Run code once inventory is loaded
  100. client.once('window_items', () => {
  101.   setInterval(() => {
  102.     client.write('set_creative_slot', {
  103.       slot: 22,
  104.       item: {
  105.         present: true,
  106.         itemId: minecraftData.itemsByName.stone.id,
  107.         itemCount: 1,
  108.         nbtData: nbt.comp({
  109.           display: nbt.comp({
  110.             Lore: nbt.list(nbt.comp([
  111.               nbt.string('{"text":"among us"}')
  112.             ]))
  113.           })
  114.         })
  115.       }
  116.     })
  117.   }, 1000)
  118. })
  119.  
Add Comment
Please, Sign In to add comment