ignore skin id changes without new data

This commit is contained in:
olebeck 2023-03-24 23:29:53 +01:00
parent ae496e9238
commit 1b1bddc17f
2 changed files with 5 additions and 7 deletions

View File

@ -1,7 +1,6 @@
package skins
import (
"crypto/sha256"
"encoding/json"
"errors"
"fmt"
@ -28,12 +27,8 @@ type SkinGeometry struct {
}
func (skin *Skin) Hash() uuid.UUID {
h := sha256.New()
h.Write(skin.SkinData)
h.Write(skin.SkinGeometry)
h.Write(skin.CapeData)
h.Write([]byte(skin.SkinID))
return uuid.NewSHA1(uuid.NameSpaceURL, h.Sum(nil))
h := append(skin.CapeData, append(skin.SkinData, skin.SkinGeometry...)...)
return uuid.NewSHA1(uuid.NameSpaceURL, h)
}
func (skin *Skin) getGeometry() (*SkinGeometry, string, error) {

View File

@ -18,6 +18,9 @@ type _skinWithIndex struct {
}
func (s _skinWithIndex) Name(name string) string {
if s.i == 1 {
return name
}
return fmt.Sprintf("%s-%d", name, s.i)
}