mcuser

package
v0.0.0-...-fdc8e6b Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Unlicense Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const TexturesBaseURL = "http://textures.minecraft.net/texture/"

Variables

View Source
var (
	McUserProto_UserStatus_name = map[int32]string{
		0: "UNSET",
		1: "OK",
		2: "ERROR_GENERIC",
		3: "ERROR_UNKNOWN_USER",
		4: "ERROR_RATE_LIMIT",
	}
	McUserProto_UserStatus_value = map[string]int32{
		"UNSET":              0,
		"OK":                 1,
		"ERROR_GENERIC":      2,
		"ERROR_UNKNOWN_USER": 3,
		"ERROR_RATE_LIMIT":   4,
	}
)

Enum value maps for McUserProto_UserStatus.

View Source
var (
	McUserProto_URLType_name = map[int32]string{
		0: "UNKNOWN",
		1: "TEXTURES_MC_NET",
	}
	McUserProto_URLType_value = map[string]int32{
		"UNKNOWN":         0,
		"TEXTURES_MC_NET": 1,
	}
)

Enum value maps for McUserProto_URLType.

View Source
var File_pkg_mcclient_mcuser_mcuser_proto_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type McUser

type McUser struct {
	minecraft.User
	Textures  Textures
	Timestamp tinytime.TinyTime
	Status    status.Status
}

func DecompressMcUser

func DecompressMcUser(flatedBytes []byte) (McUser, error)

Decompress a Protobuf McUser

func NewMcUser

func NewMcUser(logger log.Logger, uuid string, sessionProfile minecraft.SessionProfileResponse, err error) McUser

func (McUser) Compress

func (u McUser) Compress() ([]byte, error)

func (McUser) EncodeProtobuf

func (u McUser) EncodeProtobuf() ([]byte, error)

func (McUser) IsFresh

func (u McUser) IsFresh() bool

func (McUser) IsValid

func (u McUser) IsValid() bool

func (McUser) String

func (u McUser) String() string

func (McUser) TTL

func (u McUser) TTL() time.Duration

type McUserProto

type McUserProto struct {
	Time     uint32                 `protobuf:"varint,1,opt,name=Time,proto3" json:"Time,omitempty"`
	Status   McUserProto_UserStatus `protobuf:"varint,2,opt,name=Status,proto3,enum=mcuser.McUserProto_UserStatus" json:"Status,omitempty"`
	Username string                 `protobuf:"bytes,4,opt,name=Username,proto3" json:"Username,omitempty"`
	UUID     string                 `protobuf:"bytes,5,opt,name=UUID,proto3" json:"UUID,omitempty"`
	BaseURL  McUserProto_URLType    `protobuf:"varint,7,opt,name=BaseURL,proto3,enum=mcuser.McUserProto_URLType" json:"BaseURL,omitempty"`
	//bool SkinSlim = 8
	SkinPath string `protobuf:"bytes,9,opt,name=SkinPath,proto3" json:"SkinPath,omitempty"` //string CapePath = 10;
	// contains filtered or unexported fields
}

func (*McUserProto) Descriptor deprecated

func (*McUserProto) Descriptor() ([]byte, []int)

Deprecated: Use McUserProto.ProtoReflect.Descriptor instead.

func (*McUserProto) GetBaseURL

func (x *McUserProto) GetBaseURL() McUserProto_URLType

func (*McUserProto) GetSkinPath

func (x *McUserProto) GetSkinPath() string

func (*McUserProto) GetStatus

func (x *McUserProto) GetStatus() McUserProto_UserStatus

func (*McUserProto) GetTime

func (x *McUserProto) GetTime() uint32

func (*McUserProto) GetUUID

func (x *McUserProto) GetUUID() string

func (*McUserProto) GetUsername

func (x *McUserProto) GetUsername() string

func (*McUserProto) ProtoMessage

func (*McUserProto) ProtoMessage()

func (*McUserProto) ProtoReflect

func (x *McUserProto) ProtoReflect() protoreflect.Message

func (*McUserProto) Reset

func (x *McUserProto) Reset()

func (*McUserProto) String

func (x *McUserProto) String() string

type McUserProto_URLType

type McUserProto_URLType int32

Supports other value incase another Texture host is ever used

const (
	McUserProto_UNKNOWN         McUserProto_URLType = 0
	McUserProto_TEXTURES_MC_NET McUserProto_URLType = 1
)

func (McUserProto_URLType) Descriptor

func (McUserProto_URLType) Enum

func (McUserProto_URLType) EnumDescriptor deprecated

func (McUserProto_URLType) EnumDescriptor() ([]byte, []int)

Deprecated: Use McUserProto_URLType.Descriptor instead.

func (McUserProto_URLType) Number

func (McUserProto_URLType) String

func (x McUserProto_URLType) String() string

func (McUserProto_URLType) Type

type McUserProto_UserStatus

type McUserProto_UserStatus int32
const (
	McUserProto_UNSET              McUserProto_UserStatus = 0
	McUserProto_OK                 McUserProto_UserStatus = 1
	McUserProto_ERROR_GENERIC      McUserProto_UserStatus = 2
	McUserProto_ERROR_UNKNOWN_USER McUserProto_UserStatus = 3
	McUserProto_ERROR_RATE_LIMIT   McUserProto_UserStatus = 4
)

func (McUserProto_UserStatus) Descriptor

func (McUserProto_UserStatus) Enum

func (McUserProto_UserStatus) EnumDescriptor deprecated

func (McUserProto_UserStatus) EnumDescriptor() ([]byte, []int)

Deprecated: Use McUserProto_UserStatus.Descriptor instead.

func (McUserProto_UserStatus) Number

func (McUserProto_UserStatus) String

func (x McUserProto_UserStatus) String() string

func (McUserProto_UserStatus) Type

type TextureIO

type TextureIO struct {
	io.ReadCloser
	TextureID string
}

func GetSteveTextureIO

func GetSteveTextureIO() TextureIO

func (TextureIO) DecodeTexture

func (tio TextureIO) DecodeTexture() (texture minecraft.Texture, err error)

DecodeTexture reads and closes the ReadCloser, returning a minecraft.Texture (and optional error)

func (TextureIO) MustDecodeSkin

func (tio TextureIO) MustDecodeSkin(logger log.Logger) (skin minecraft.Skin)

MustDecodeSkin reads and closes the ReadCloser, returning a minecraft.Skin

type Textures

type Textures struct {
	// SkinPath changes based on whether the Texture's URL was prefixed by the TexturesBaseURL.
	// It will either be just the "hash" (part after the TexturesBaseURL) or a full URL
	SkinPath string

	// TexturesMcNet is true when the SkinPath is just the part after the TexturesBaseURL
	// the Protobuf expresses this as an enum to support other values
	// This code does not need to support multiple values - unless new hosts are used
	TexturesMcNet bool
}

func NewTexturesFromSessionProfile

func NewTexturesFromSessionProfile(sessionProfile minecraft.SessionProfileResponse) (t Textures, err error)

After having made an API call, this can be used to create a textures object

func (Textures) CustomSkinURL

func (t Textures) CustomSkinURL(base string) string

Used to get a fully qualified URL for the Skin with a custom Textures server

func (Textures) SkinURL

func (t Textures) SkinURL() string

Used to get a fully qualified URL for the Skin

Jump to

Keyboard shortcuts

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