• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

minefold/node-minecraft: The Minecraft protocol for Node.js. (aka. bots!)

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

minefold/node-minecraft

开源软件地址(OpenSource Url):

https://github.com/minefold/node-minecraft

开源编程语言(OpenSource Language):

CoffeeScript 100.0%

开源软件介绍(OpenSource Introduction):

node-minecraft

by Chris Lloyd & Dave Newman @ Minefold

Provides an implementation of the Minecraft protocol for Node.js that can be used for both client and server hacking.

Installation

You need Node.js and NPM installed first.

$ npm install node-minecraft

Writing Bots

It's best to check out examples/helloworld.coffee and examples/perv.coffee. They are both small bots that successfully connect to a world and serve some function. Let's run through a simple echo bot. All it does is repeat any chat messages it hears.

# Loads the library
mc = require 'node-minecraft'

# This creates a new client
mc.createOnlineClient host, port, username, password, (bot) ->

  # 'chat' is an event that is fired when a chat message is recieved
  bot.on 'chat', (msg) ->
    # `say` writes a string back for everybody to see.
    bot.say msg

Dead simple!

FAQ

Why createOnlineClient?

Minecraft checks that you have bought a copy of the game before you can play online. This why the library needs your password. You'll need to use that method if you are putting your bot into public servers who are in online-mode.

If you have a local server that is in offline mode you can use the createOfflineClient that doesn't validate with Mojang. This is best for testing and spinning up lots of bots locally.

Why does the bot just float there?

Minecraft works by each client calculating where it is suppose to be. The bot at the moment is too dumb to know about gravity, so it doesn't move. However, in future versions of node-minecraft we want to make the bots more intelligent. Perhaps you could contribute that?




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap