diff --git a/src/main/java/noppes/npcs/client/ClientEventHandler.java b/src/main/java/noppes/npcs/client/ClientEventHandler.java index 97f5c31e8..7fb6300ae 100644 --- a/src/main/java/noppes/npcs/client/ClientEventHandler.java +++ b/src/main/java/noppes/npcs/client/ClientEventHandler.java @@ -87,7 +87,7 @@ public class ClientEventHandler { if (data != null && data.isActive()) { Animation animation = data.animation; - if (animation.renderTicks && data.isActive()) { + if (data.isActive() && animation.currentFrame().useRenderTicks()) { animation.increaseTime(); } } @@ -105,7 +105,7 @@ public class ClientEventHandler { if (data != null && data.isActive()) { Animation animation = data.animation; - if (!animation.renderTicks && data.isActive()) { + if (data.isActive() && !animation.currentFrame().useRenderTicks()) { animation.increaseTime(); } } diff --git a/src/main/java/noppes/npcs/controllers/data/Frame.java b/src/main/java/noppes/npcs/controllers/data/Frame.java index 122c5e7e5..9fbf9b0fe 100644 --- a/src/main/java/noppes/npcs/controllers/data/Frame.java +++ b/src/main/java/noppes/npcs/controllers/data/Frame.java @@ -2,6 +2,7 @@ package noppes.npcs.controllers.data; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import noppes.npcs.api.handler.data.IAnimation; import noppes.npcs.api.handler.data.IFrame; import noppes.npcs.api.handler.data.IFramePart; import noppes.npcs.constants.EnumAnimationPart; @@ -17,6 +18,7 @@ public class Frame implements IFrame { boolean customized = false; public float speed = 1.0F; public byte smooth = 0; + public boolean renderTicks = false; // If true, MC ticks are used. If false, render ticks are used. public Frame(){} @@ -99,6 +101,15 @@ public class Frame implements IFrame { return this; } + public IFrame useRenderTicks(boolean renderTicks) { + this.renderTicks = renderTicks; + return this; + } + + public boolean useRenderTicks() { + return this.renderTicks; + } + public void readFromNBT(NBTTagCompound compound){ duration = compound.getInteger("Duration"); @@ -111,10 +122,15 @@ public class Frame implements IFrame { customized = true; smooth = compound.getByte("Smooth"); } + if(compound.hasKey("RenderTicks")){ + customized = true; + renderTicks = compound.getBoolean("RenderTicks"); + } if (!customized) { this.speed = parent.speed; this.smooth = parent.smooth; + this.renderTicks = parent.renderTicks; } HashMap frameParts = new HashMap<>(); @@ -138,6 +154,7 @@ public class Frame implements IFrame { if(customized){ compound.setFloat("Speed", speed); compound.setByte("Smooth", smooth); + compound.setBoolean("RenderTicks", renderTicks); } NBTTagList list = new NBTTagList();