utils

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: GPL-3.0 Imports: 52 Imported by: 0

Documentation

Overview

Package utils ...

Index

Constants

View Source
const TokenFile = "token.json"

Variables

View Source
var Auth authsrv
View Source
var Options struct {
	Debug              bool
	IsInteractive      bool
	ExtraDebug         bool
	Capture            bool
	PathCustomUserData string
}
View Source
var PackFromBase = func(pack *resource.Pack) Pack {
	b := &packBase{pack, false}
	return b
}
View Source
var RealmsEnv string

Functions

func BlendColors

func BlendColors(c1, c2 color.RGBA64) (ret color.RGBA64)

func CfbDecrypt added in v1.28.0

func CfbDecrypt(data []byte, key []byte) []byte

func Chunk2Img added in v1.28.1

func Chunk2Img(c *chunk.Chunk) *image.RGBA64

func CleanupName

func CleanupName(name string) string

CleanupName cleans name so it can be used as a filename

func DrawImgScaledPos added in v1.28.0

func DrawImgScaledPos(dst *image.RGBA, src *image.RGBA, bottomLeft image.Point, sizeScaled int)

DrawImgScaledPos draws src onto dst at bottomLeft, scaled to size

func DumpStruct added in v1.28.0

func DumpStruct(f io.StringWriter, inputStruct any)

func GetLocalIP

func GetLocalIP() string

GetLocalIP returns the non loopback local IP of the host

func GetRealmsAPI added in v1.28.0

func GetRealmsAPI() *realms.Client

func IPPrivate

func IPPrivate(ip net.IP) bool

IPPrivate checks if ip is private

func Img2rgba

func Img2rgba(img *image.RGBA) []color.RGBA

func LERP

func LERP(p1, p2, alpha float64) float64

LERP is a linear interpolation function

func LookupColor added in v1.31.1

func LookupColor(name string) color.RGBA

func NewCfb8 added in v1.31.1

func NewCfb8(r io.Reader, key []byte) io.Reader

func ParseJson added in v1.31.1

func ParseJson(s []byte, out any) error

func ParseServer added in v1.33.0

func ParseServer(ctx context.Context, server string) (address, name string, err error)

func PrintPanic added in v1.31.1

func PrintPanic(err error)

func RGBAToRGBA64 added in v1.32.0

func RGBAToRGBA64(rgba color.RGBA) color.RGBA64

func RandSeededUUID added in v1.28.0

func RandSeededUUID(str string) string

func ResolveColors added in v1.31.1

func ResolveColors(entries []protocol.BlockEntry, packs []Pack, addToBlocks bool) (*image.RGBA, map[string]color.RGBA64)

func ServerInput

func ServerInput(ctx context.Context, server string) (string, string, error)

func ShowFile added in v1.28.1

func ShowFile(path string)

func SizeofFmt added in v1.28.1

func SizeofFmt(num float32) string

func SplitExt

func SplitExt(filename string) (name, ext string)

SplitExt splits path to filename and extension

func StackToItem added in v1.32.0

func StackToItem(it protocol.ItemStack) item.Stack

stackToItem converts a network ItemStack representation back to an item.Stack.

func UploadError added in v1.31.1

func UploadError(err error)

func UploadPanic added in v1.31.1

func UploadPanic()

func UserInput added in v1.28.0

func UserInput(ctx context.Context, q string, validator func(string) bool) (string, bool)

func WriteManifest added in v1.28.0

func WriteManifest(manifest *resource.Manifest, fpath string) error

func ZipFolder

func ZipFolder(filename, folder string) error

Types

type BlockRID added in v1.32.0

type BlockRID = uint32

type DeflatePool added in v1.31.1

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

func (*DeflatePool) GetWriter added in v1.31.1

func (pool *DeflatePool) GetWriter(dst io.Writer) (writer *flate.Writer)

func (*DeflatePool) ReturnWriter added in v1.31.1

func (pool *DeflatePool) ReturnWriter(writer *flate.Writer)

type Pack added in v1.28.0

type Pack interface {
	CanDecrypt() bool
	Base() *resource.Pack
	FS() (fs.FS, []string, error)
	SetD()
}

func GetPacks

func GetPacks(server minecraft.IConn) (packs []Pack)

type Skin added in v1.28.1

type Skin struct {
	*protocol.Skin
}

func (*Skin) Complex added in v1.28.1

func (skin *Skin) Complex() bool

func (*Skin) Hash added in v1.28.1

func (skin *Skin) Hash() uuid.UUID

func (*Skin) HaveAnimations added in v1.28.1

func (skin *Skin) HaveAnimations() bool

func (*Skin) HaveCape added in v1.28.1

func (skin *Skin) HaveCape() bool

func (*Skin) HaveGeometry added in v1.28.1

func (skin *Skin) HaveGeometry() bool

func (*Skin) HaveTint added in v1.28.1

func (skin *Skin) HaveTint() bool

func (*Skin) WriteCapePng added in v1.28.1

func (skin *Skin) WriteCapePng(output_path string) error

WriteCape writes the cape as a png at output_path

type SkinGeometry added in v1.28.1

type SkinGeometry struct {
	SkinGeometryDescription
	Bones []any `json:"bones"`
}

type SkinGeometryDescription added in v1.31.0

type SkinGeometryDescription struct {
	Identifier          string    `json:"identifier,omitempty"`
	Texturewidth        int       `json:"texturewidth"`
	Textureheight       int       `json:"textureheight"`
	VisibleBoundsWidth  float64   `json:"visible_bounds_width"`
	VisibleBoundsHeight float64   `json:"visible_bounds_height"`
	VisibleBoundsOffset []float64 `json:"visible_bounds_offset,omitempty"`
}

type SkinGeometry_1_12 added in v1.31.0

type SkinGeometry_1_12 struct {
	Description SkinGeometryDescription `json:"description"`
	Bones       []any                   `json:"bones"`
}

type SkinMeta added in v1.28.1

type SkinMeta struct {
	SkinID        string
	PlayFabID     string
	PremiumSkin   bool
	PersonaSkin   bool
	CapeID        string
	SkinColour    string
	ArmSize       string
	Trusted       bool
	PersonaPieces []protocol.PersonaPiece
}

type SkinPack added in v1.28.1

type SkinPack struct {
	Name string
	// contains filtered or unexported fields
}

func NewSkinPack added in v1.28.1

func NewSkinPack(name, fpath string) *SkinPack

func (*SkinPack) AddSkin added in v1.28.1

func (s *SkinPack) AddSkin(skin *Skin) bool

func (*SkinPack) Save added in v1.28.1

func (s *SkinPack) Save(fpath string) error

type TexMapEntry added in v1.32.0

type TexMapEntry struct {
	X           uint16
	Y           uint16
	Transparent bool
}

type TexMapHash added in v1.32.0

type TexMapHash = uint64

type TexMapIdx added in v1.32.0

type TexMapIdx = uint32

type TextureMap added in v1.32.0

type TextureMap struct {
	BlockSize int
	Lookup    *image.RGBA
}

func NewTextureMap added in v1.32.0

func NewTextureMap() *TextureMap

func (*TextureMap) SetTextures added in v1.32.0

func (t *TextureMap) SetTextures(blocks []world.Block, resolvedTextures map[string]image.Image) map[BlockRID]TexMapEntry

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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