versions

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Protocol1_20_0   = 589
	Protocol1_20_10  = 594
	Protocol1_20_30  = 618
	Protocol1_20_40  = 622
	Protocol1_20_50  = 630
	Protocol1_20_60  = 649
	Protocol1_20_70  = 662
	Protocol1_20_80  = 671
	Protocol1_21_0   = 685
	Protocol1_21_2   = 686
	Protocol1_21_20  = 712
	Protocol1_21_30  = 729
	Protocol1_21_40  = 748
	Protocol1_21_50  = 766
	Protocol1_21_60  = 776
	Protocol1_21_70  = 786
	Protocol1_21_80  = 800
	Protocol1_21_90  = 818
	Protocol1_21_93  = 819
	Protocol1_21_100 = 827
	Protocol1_21_111 = 844
	Protocol1_21_120 = 859
	Protocol1_21_124 = 860
	Protocol1_21_130 = 898
)
View Source
const (
	// MaceImplemented is the protocol version where the Mace item was introduced (1.21.0).
	MaceImplemented = Protocol1_21_0
	// SpearImplemented is the protocol version where the Spear item was introduced (1.21.130).
	SpearImplemented = Protocol1_21_130
)

Variables

This section is empty.

Functions

func FeatureByID added in v1.0.4

func FeatureByID(id string) (int32, bool)

FeatureByID returns the protocol version where a feature was implemented.

func HasFeature added in v1.0.4

func HasFeature(protocol, feature int32) bool

HasFeature returns true if the given protocol version supports the specified feature.

func HasFeatureByID added in v1.0.4

func HasFeatureByID(protocol int32, id string) bool

HasFeatureByID returns true if the given protocol version supports the feature with the specified ID.

func HasMace added in v1.0.4

func HasMace(protocol int32) bool

HasMace returns true if the given protocol version supports the Mace item.

func HasSpear added in v1.0.4

func HasSpear(protocol int32) bool

HasSpear returns true if the given protocol version supports the Spear item.

func Register

func Register(protocol int32, version string)

Register adds a new version to the version registry, making it available for lookup by both protocol number and version string. Not thread safe, should run during initialisation.

func RegisterFeature added in v1.0.4

func RegisterFeature(id string, protocol int32)

RegisterFeature adds a feature to the registry with a string ID. Not thread safe, should run during initialisation.

func Versions

func Versions() iter.Seq[Version]

Versions returns a slice of all registered Version objects. The versions are returned in an arbitrary order. Use this function when you need to iterate through all available versions or display a list of supported versions.

Types

type Version

type Version struct {
	// Protocol is the numeric protocol identifier used in Minecraft network communication.
	// This is the official protocol number that clients and servers use.
	// Example: 589 for Minecraft 1.20.0
	Protocol int32
	// Version is the human-readable Minecraft version string in semantic version format.
	// This follows the standard Minecraft version numbering scheme (major.minor.patch).
	// Example: "1.20.0", "1.21.100"
	Version string
}

Version represents a Minecraft version with its protocol number and version string.

func ByProtocol

func ByProtocol(protocol int32) (Version, bool)

ByProtocol returns the Version object for a given protocol number. This is useful for looking up version strings when you have a protocol number.

func ByVersion

func ByVersion(version string) (Version, bool)

ByVersion returns the Version object for a given version string. This is useful for looking up protocol numbers when you have a version string.

Jump to

Keyboard shortcuts

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