mcserver

package module
v0.0.0-...-05212bf Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: MIT Imports: 13 Imported by: 0

README

mcserver

Minecraft server implementation for 1.16.5 (protocol version 754)

Documentation

Index

Constants

View Source
const (
	// ServerVersion is the vanilla server version that is mostly implemented by this server.
	ServerVersion = "1.16.5"
	// ProtocolVersion is the minecraft protocol version that this server implements.
	ProtocolVersion = 754
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MCServer

type MCServer struct {
	// contains filtered or unexported fields
}

MCServer is a minecraft server. It holds things like a logger, a net.Listener, a game.Game and a config.Config, and coordinates all the components.

func New

func New(config config.Config, opts ...Option) (*MCServer, error)

New creates a new MCServer with the given config. This server will not use a logger. Use WithLogger if you want the server to generate log output.

func (*MCServer) Start

func (s *MCServer) Start(ctx context.Context) error

Start will prepare the game. The given context will be respected. This method will go into an infinite loop, accepting incoming connections. This method terminates only if an error occurs or if the context was cancelled.

type Option

type Option func(*MCServer)

Option is an API function that can be passed into New to customize the created server with optional arguments.

func WithListener

func WithListener(lis net.Listener) Option

WithListener tells the server, which listener he should use. If this is given, the server will not allocate a separate listener.

func WithLogger

func WithLogger(log zerolog.Logger) Option

WithLogger will make the server use the given logger to write logs.

Directories

Path Synopsis
cmd
Package comparr implements a data structure we call "compact array".
Package comparr implements a data structure we call "compact array".
block
Package block provides means for registering blocks and creating blocks from registered block descriptors.
Package block provides means for registering blocks and creating blocks from registered block descriptors.
id
tools

Jump to

Keyboard shortcuts

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