diff --git a/PCK-Studio/Internals/SkinBOX.cs b/PCK-Studio/Internals/SkinBOX.cs index d32948e8..764444e7 100644 --- a/PCK-Studio/Internals/SkinBOX.cs +++ b/PCK-Studio/Internals/SkinBOX.cs @@ -20,7 +20,7 @@ using System.Numerics; namespace PckStudio.Internal { - public class SkinBOX + public class SkinBOX : ICloneable, IEquatable { public string Type; public Vector3 Pos; @@ -86,5 +86,28 @@ namespace PckStudio.Internal float.TryParse(arguments[startIndex + 2], out float z); return new Vector3(vec2, z); } + + public override int GetHashCode() + { + return Type.GetHashCode() % Pos.GetHashCode() * UV.GetHashCode() % Size.GetHashCode(); + } + + public override bool Equals(object obj) + { + return obj is SkinBOX box && Equals(box); + } + + public bool Equals(SkinBOX other) + { + return Type.Equals(other.Type) && + Pos.Equals(other.Pos) && + Size.Equals(other.Size) && + UV.Equals(other.UV); + } + + public object Clone() + { + return new SkinBOX((string)Type.Clone(), Pos, Size, UV, HideWithArmor, Mirror, Scale); + } } }