Added tick duration read/write nbt

This commit is contained in:
Luis C.M committed 2024-03-24 03:56:14 -05:00
1 parent d1ca49fc3b
commit a564bcdb0e
2 files changed
+13 -2

No files matched your search

@@ -183,6 +183,12 @@ public class Animation implements IAnimation {
smooth = compound.getByte("Smooth");
loop = compound.getInteger("Loop");
if (compound.hasKey("TickDuration")) {
this.tickDuration = compound.getInteger("TickDuration");
} else if(compound.hasKey("RenderTicks")){
this.tickDuration = compound.getBoolean("RenderTicks") ? 20 : 50;
}
ArrayList<Frame> frames = new ArrayList<Frame>();
NBTTagList list = compound.getTagList("Frames", 10);
for (int i = 0; i < list.tagCount(); i++) {
@@ -206,6 +212,7 @@ public class Animation implements IAnimation {
compound.setFloat("Speed", speed);
compound.setByte("Smooth", smooth);
compound.setInteger("Loop",loop);
compound.setInteger("TickDuration", tickDuration);
NBTTagList list = new NBTTagList();
for(Frame frame : frames){
@@ -135,9 +135,13 @@ public class Frame implements IFrame {
customized = true;
smooth = compound.getByte("Smooth");
}
if(compound.hasKey("RenderTicks")){
if (compound.hasKey("TickDuration")) {
customized = true;
this.tickDuration = compound.getInteger("TickDuration");
} else if(compound.hasKey("RenderTicks")){
customized = true;
this.tickDuration = 20;
this.tickDuration = compound.getBoolean("RenderTicks") ? 20 : 50;
}
if (!customized) {