mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 11:54:47 +00:00
If the animation data is disabled for players, their last frame of animation will gradually interpolate back to the player's vanilla animations.
This commit is contained in:
1 parent
a67604e22d
commit
bc089a4e14
4 files changed
+69
-17
No files matched your search
@@ -2,6 +2,7 @@ package noppes.npcs.controllers.data;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.api.handler.data.IAnimation;
|
||||
@@ -13,7 +14,7 @@ import java.util.ArrayList;
|
||||
|
||||
|
||||
public class Animation implements IAnimation {
|
||||
|
||||
public AnimationData parent; //Client-sided only
|
||||
public int id = -1; // Only for internal usage
|
||||
|
||||
public ArrayList<Frame> frames = new ArrayList<>();
|
||||
@@ -229,6 +230,10 @@ public class Animation implements IAnimation {
|
||||
if (paused)
|
||||
return;
|
||||
|
||||
if (this.parent != null && this.currentFrame < this.frames.size()) {
|
||||
this.parent.finishedFrame = this.currentFrame;
|
||||
}
|
||||
|
||||
this.currentFrameTime++;
|
||||
if (this.currentFrameTime == this.currentFrame().getDuration()) {
|
||||
Frame prevFrame = (Frame) this.currentFrame();
|
||||
@@ -247,6 +252,8 @@ public class Animation implements IAnimation {
|
||||
nextFrame.frameParts.get(part).prevPivots = prevFrame.frameParts.get(part).prevPivots;
|
||||
}
|
||||
}
|
||||
} else if (this.parent != null && this.currentFrame > this.loop) {
|
||||
this.parent.finishedTime = this.parent.animationEntity.getAge();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user