-
Notifications
You must be signed in to change notification settings - Fork 7
/
textures_skin_steve.go
62 lines (47 loc) · 4.33 KB
/
textures_skin_steve.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package minecraft
import (
"bytes"
"encoding/base64"
"image"
// If we work with PNGs we need this
_ "image/png"
"github.com/pkg/errors"
)
const SteveHash = "98903c1609352e11552dca79eb1ce3d6"
func (s *Skin) FetchSteve() error {
bytes, err := GetSteveBytes()
if err != nil {
return err
}
s.Source = "Steve"
err = s.Decode(bytes)
if err != nil {
return errors.Wrap(err, "failed to decode Steve skin")
}
return nil
}
func GetSteveBytes() (*bytes.Buffer, error) {
steveImgBytes, err := base64.StdEncoding.DecodeString(SteveBase64)
if err != nil {
return bytes.NewBuffer([]byte{}), errors.Wrap(err, "failed to GetSteveBytes")
}
return bytes.NewBuffer(steveImgBytes), nil
}
func FetchImageForSteve() (image.Image, error) {
bytes, err := GetSteveBytes()
if err != nil {
return nil, err
}
img, _, err := image.Decode(bytes)
if err != nil {
return nil, errors.Wrap(err, "failed to decode Steve image")
}
return img, nil
}
func FetchSkinForSteve() (Skin, error) {
skin := &Skin{}
return *skin, skin.FetchSteve()
}
// The constant below contains Mojang AB copyrighted content.
// The use of this imagery is subject to their copyright.
const SteveBase64 = "iVBORw0KGgoAAAANSUhEUgAAAEAAAAAgCAYAAACinX6EAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1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