mc

package
v0.0.0-...-96089b2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2015 License: MIT Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const (
	LegacyURL = "http://skins.minecraft.net/MinecraftSkins/%s.png"
)

Variables

View Source
var AlexArmModel = [faceCount]image.Rectangle{
	bounds(14, 16),
	relative(4, 4, 3, 12),
	relative(11, 4, 3, 12),
	relative(4, 0, 3, 4),
	relative(7, 0, 3, 4),
	relative(7, 4, 4, 12),
	relative(0, 4, 4, 12),
}
View Source
var BodyModel = [faceCount]image.Rectangle{
	bounds(24, 16),
	relative(4, 4, 8, 12),
	relative(16, 4, 8, 12),
	relative(4, 0, 8, 4),
	relative(12, 0, 8, 4),
	relative(12, 4, 4, 12),
	relative(0, 4, 4, 12),
}
View Source
var HeadModel = [faceCount]image.Rectangle{
	bounds(32, 16),
	relative(8, 8, 8, 8),
	relative(24, 8, 8, 8),
	relative(8, 0, 8, 8),
	relative(16, 0, 8, 8),
	relative(16, 8, 8, 8),
	relative(0, 8, 8, 8),
}
View Source
var LimbModel = [faceCount]image.Rectangle{
	bounds(16, 16),
	relative(4, 4, 4, 12),
	relative(12, 4, 4, 12),
	relative(4, 0, 4, 4),
	relative(8, 0, 4, 4),
	relative(8, 4, 4, 12),
	relative(0, 4, 4, 12),
}
View Source
var OverlayPositions = [skinPartCount]image.Point{
	image.Pt(32, 0),
	image.Pt(16, 32),
	image.Pt(48, 48),
	image.Pt(40, 32),
	image.Pt(0, 48),
	image.Pt(0, 32),
}
View Source
var Positions = [skinPartCount]image.Point{
	image.ZP,
	image.Pt(16, 16),
	image.Pt(32, 48),
	image.Pt(40, 16),
	image.Pt(16, 48),
	image.Pt(0, 16),
}

Functions

func IsAlex

func IsAlex(uuid string) bool

func IsName

func IsName(name string) bool

func IsUUID

func IsUUID(uuid string) bool

func Model

func Model(skin Skin, part SkinPart) [faceCount]image.Rectangle

func ParseUUID

func ParseUUID(uuid string) string

func SkinURL

func SkinURL(player string) string

func ToLower

func ToLower(name string) string

Types

type Face

type Face byte
const (
	All Face = iota
	Front
	Back
	Top
	Bottom
	Left
	Right
)

type Profile

type Profile interface {
	Name() string
	UUID() string
	IsAlex() bool
}

func FetchProfile

func FetchProfile(player string) (p Profile, err error)

type Skin

type Skin interface {
	Image() image.Image
	IsAlex() bool
	IsLegacy() bool
	Get(part SkinPart) image.Image
	GetFace(part SkinPart, face Face) image.Image
	Overlay(part SkinPart) image.Image
	OverlayFace(part SkinPart, face Face) image.Image
}

func CreateSkin

func CreateSkin(skin image.Image, alex bool) Skin

func DownloadSkin

func DownloadSkin(url string, alex bool) (sk Skin, err error)

type SkinMeta

type SkinMeta interface {
	ID() string
	URL() string
	Download() (Skin, error)
}

func Alex

func Alex() (meta SkinMeta, err error)

func Steve

func Steve() (meta SkinMeta, err error)

type SkinPart

type SkinPart byte
const (
	Head SkinPart = iota
	Body
	LeftArm
	RightArm
	LeftLeg
	RightLeg
)

type SkinProfile

type SkinProfile interface {
	Profile
	Profile() Profile
	Skin() SkinMeta
}

func FetchSkin

func FetchSkin(uuid string) (p SkinProfile, err error)

Jump to

Keyboard shortcuts

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