go-mc

module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: MIT

README

Go-MC

Version Go Reference Go Report Card Discord

教程 · Tutorial

Require Go version: 1.20

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/examples/mcping localhost to ping and list the localhost mc server.
  • Run go run github.com/Tnze/go-mc/examples/daze to join the local server at localhost:25565 as player named Daze on the offline mode.

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