go-mc

module
v1.20.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2023 License: MIT

README

Go-MC

Version Go Reference Go Report Card Discord

教程 · Tutorial

Require Go version: 1.19

There's some library in Go support you to create your Minecraft client or server.
这是一些Golang库,用于帮助你编写自己的Minecraft客户端或服务器。

  • 👍 Minecraft network protocol
  • 👍 Robot framework
  • 👍 Server framework
  • 👍 Dual role RCON protocol (Server & Client)
  • 👍 Chat Message (Support both Json and old § format)
  • 👍 NBT (Based on reflection)
  • 👌 SNBT ⇋ NBT
  • 👍 Regions & Chunks & Blocks
  • ⌛ Yggdrasil (Mojang login)
  • ⌛ Realms Server

We don't promise that API is 100% backward compatible.

Getting start

Go-MC tag the old version after new version released. For example, if 1.19.4 is the latest Minecraft version, the newest go-mc tag will be v1.19.3. To get the latest Go-MC that support 1.19.4, usually you must use go get -u github.com/Tnze/go-mc@master. Special cases are version like 1.19, the Go-MC support it is tagged v1.19.0 to avoid automatically upgrade.

Examples:
To get the latest version: go get github.com/Tnze/go-mc@master
To get old versions (e.g. 1.18.2): go get github.com/Tnze/go-mc@v1.18.2 To get the first of each primary version: go get github.com/Tnze/go-mc@v1.19.0

Run Examples
  • Run go run github.com/Tnze/go-mc/cmd/mcping localhost to ping and list the localhost mc server.
  • Run go run github.com/Tnze/go-mc/cmd/daze to join the local server at localhost:25565 as player named Daze on the offline mode.

Supported Version

As the go-mc/net package implements the minecraft network protocol, there is no update between the versions at this level. So net package actually supports any version. It's just that the ID and content of the package are different between different versions.

由于go-mc/net实现的是MC底层的网络协议,而这个协议在MC更新时其实并不会有改动,MC更新时其实只是包的ID和内容的定义发生了变化,所以net包本身是跨版本的。

Directories

Path Synopsis
bot
Package bot implements a simple Minecraft client that can join a server or just ping it for getting information.
Package bot implements a simple Minecraft client that can join a server or just ping it for getting information.
basic
Package basic provides some basic packet handler which client needs.
Package basic provides some basic packet handler which client needs.
msg
playerlist
Package playerlist contains a PlayerList struct that used to manage player information.
Package playerlist contains a PlayerList struct that used to manage player information.
Package chat implements Minecraft's chat message encoding system.
Package chat implements Minecraft's chat message encoding system.
data
entity
Code generated by gen_entity.go DO NOT EDIT.
Code generated by gen_entity.go DO NOT EDIT.
item
Code generated by gen_item.go DO NOT EDIT.
Code generated by gen_item.go DO NOT EDIT.
lang/got-de
Code generated by downloader.go; DO NOT EDIT.
Code generated by downloader.go; DO NOT EDIT.
lang/gv-im
Code generated by downloader.go; DO NOT EDIT.
Code generated by downloader.go; DO NOT EDIT.
lang/kab-kab
Code generated by downloader.go; DO NOT EDIT.
Code generated by downloader.go; DO NOT EDIT.
lang/mi-nz
Code generated by downloader.go; DO NOT EDIT.
Code generated by downloader.go; DO NOT EDIT.
lang/moh-ca
Code generated by downloader.go; DO NOT EDIT.
Code generated by downloader.go; DO NOT EDIT.
lang/nuk
Code generated by downloader.go; DO NOT EDIT.
Code generated by downloader.go; DO NOT EDIT.
lang/oj-ca
Code generated by downloader.go; DO NOT EDIT.
Code generated by downloader.go; DO NOT EDIT.
lang/scn
Code generated by downloader.go; DO NOT EDIT.
Code generated by downloader.go; DO NOT EDIT.
lang/swg
Code generated by downloader.go; DO NOT EDIT.
Code generated by downloader.go; DO NOT EDIT.
lang/tzl-tzl
Code generated by downloader.go; DO NOT EDIT.
Code generated by downloader.go; DO NOT EDIT.
examples
daze
Daze is a basic bot example that join a server as client with these features: - Say "Hello, world" when game started.
Daze is a basic bot example that join a server as client with these features: - Say "Hello, world" when game started.
mcadump
This is an example of how to use the go-mc/save/region package to read and write .mca files.
This is an example of how to use the go-mc/save/region package to read and write .mca files.
mcping
Usage: go run examples/ping/ping.go localhost
Usage: go run examples/ping/ping.go localhost
minimal
A minimal bot example that could join minecraft server as a client.
A minimal bot example that could join minecraft server as a client.
pressureTest
This example is used to apply pressure test on the server.
This example is used to apply pressure test on the server.
simpleServer1.15.2
This example is a minimal minecraft 1.15.2 server allowing vanilla clients or go-mc/bot to connect.
This example is a minimal minecraft 1.15.2 server allowing vanilla clients or go-mc/bot to connect.
simpleServer1.17.1
This example is a minimal minecraft 1.17.1 server allowing vanilla clients or go-mc/bot to connect.
This example is a minimal minecraft 1.17.1 server allowing vanilla clients or go-mc/bot to connect.
sniffRegistryCodec
sniffRegistryCodec is an example that acts as a client, connects to the server and saves its RegistryCodec to a .nbt file.
sniffRegistryCodec is an example that acts as a client, connects to the server and saves its RegistryCodec to a .nbt file.
yggdrasil
This example used to act as a launcher, log in and obtain the access token.
This example used to act as a launcher, log in and obtain the access token.
internal
nbt
Package nbt implement the Named Binary Tag format of Minecraft.
Package nbt implement the Named Binary Tag format of Minecraft.
dynbt
Package dynbt is a library that provides dynamic NBT operation APIs.
Package dynbt is a library that provides dynamic NBT operation APIs.
net
Package net pack network connection for Minecraft.
Package net pack network connection for Minecraft.
CFB8
Package CFB8 implements CFB8 block cipher mode of operation used by Minecraft protocol.
Package CFB8 implements CFB8 block cipher mode of operation used by Minecraft protocol.
Package server provide a minecraft server framework.
Package server provide a minecraft server framework.
Package yggdrasil implement Yggdrasil protocol.
Package yggdrasil implement Yggdrasil protocol.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL