How to use the minecraft-protocol.states function in minecraft-protocol

To help you get started, we’ve selected a few minecraft-protocol examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PrismarineJS / node-minecraft-protocol / examples / proxy / proxy.js View on Github external
const mc = require('minecraft-protocol')

const states = mc.states
function printHelpAndExit (exitCode) {
  console.log('usage: node proxy.js [...]  ')
  console.log('options:')
  console.log('  --dump name')
  console.log('    print to stdout messages with the specified name.')
  console.log('  --dump-all')
  console.log('    print to stdout all messages, except those specified with -x.')
  console.log('  -x name')
  console.log('    do not print messages with this name.')
  console.log('  name')
  console.log('    a packet name as defined in protocol.json')
  console.log('examples:')
  console.log('  node proxy.js --dump-all -x keep_alive -x update_time -x entity_velocity -x rel_entity_move -x entity_look -x entity_move_look -x entity_teleport -x entity_head_rotation -x position localhost 1.8')
  console.log('    print all messages except for some of the most prolific.')
  console.log('  node examples/proxy.js --dump open_window --dump close_window --dump set_slot --dump window_items --dump craft_progress_bar --dump transaction --dump close_window --dump window_click --dump set_creative_slot --dump enchant_item localhost 1.8')
  console.log('    print messages relating to inventory management.')
github omegablitz / chunky / chunky_proxy / src / proxy / Proxy / addListeners.js View on Github external
remoteClient.on('packet', (data, metadata) => {
      if (remoteClient.localClient.state === mc.states.PLAY && metadata.state === mc.states.PLAY) {
        remoteClient.localClient.write(metadata.name, data)
      }
    })
  }
github PrismarineJS / node-minecraft-protocol / examples / client_chat / client_chat.js View on Github external
const readline = require('readline')
const color = require('ansi-color').set
const mc = require('minecraft-protocol')
const states = mc.states
const util = require('util')

const colors = {
  black: 'black+white_bg',
  dark_blue: 'blue',
  dark_green: 'green',
  dark_aqua: 'cyan',
  dark_red: 'red',
  dark_purple: 'magenta',
  gold: 'yellow',
  gray: 'black+white_bg',
  dark_gray: 'black+white_bg',
  blue: 'blue',
  green: 'green',
  aqua: 'cyan',
  red: 'red',