mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-10-01 19:20:44 +00:00
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using Newtonsoft.Json.Linq;
|
|
using PckStudio.Internal;
|
|
|
|
namespace PckStudio.Extensions
|
|
{
|
|
internal static class AnimationExtensions
|
|
{
|
|
|
|
internal static JObject ConvertToJavaAnimation(this Animation animation)
|
|
{
|
|
JObject janimation = new JObject();
|
|
JObject mcmeta = new JObject();
|
|
mcmeta["comment"] = $"Animation converted with {Application.ProductName}";
|
|
mcmeta["animation"] = janimation;
|
|
JArray jframes = new JArray();
|
|
foreach (var frame in animation.GetFrames())
|
|
{
|
|
JObject jframe = new JObject();
|
|
jframe["index"] = animation.GetTextureIndex(frame.Texture);
|
|
jframe["time"] = frame.Ticks;
|
|
jframes.Add(jframe);
|
|
};
|
|
janimation["interpolation"] = animation.Interpolate;
|
|
janimation["frames"] = jframes;
|
|
return mcmeta;
|
|
}
|
|
|
|
}
|
|
}
|