mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 12:14:25 +00:00
Implemented animation GUI
This commit is contained in:
1 parent
30d73f91cf
commit
cfca59a48e
15 files changed
+818
-23
No files matched your search
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.api.handler.data.IAnimation;
|
||||
@@ -12,7 +14,7 @@ import java.util.ArrayList;
|
||||
|
||||
public class Animation implements IAnimation {
|
||||
|
||||
public ArrayList<Frame> frames = new ArrayList<Frame>();
|
||||
public ArrayList<Frame> frames = new ArrayList<>();
|
||||
public int currentFrame = 0;
|
||||
public int currentFrameTime = 0;
|
||||
|
||||
@@ -26,6 +28,9 @@ public class Animation implements IAnimation {
|
||||
public boolean whileAttacking = true;
|
||||
public boolean whileMoving = true;
|
||||
|
||||
//Client-sided
|
||||
public boolean paused;
|
||||
|
||||
public Animation(){}
|
||||
|
||||
public Animation(String name){
|
||||
@@ -196,7 +201,11 @@ public class Animation implements IAnimation {
|
||||
return compound;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void increaseTime() {
|
||||
if (paused)
|
||||
return;
|
||||
|
||||
this.currentFrameTime++;
|
||||
if (this.currentFrameTime == this.currentFrame().getDuration()) {
|
||||
Frame prevFrame = (Frame) this.currentFrame();
|
||||
|
||||
@@ -8,7 +8,7 @@ import noppes.npcs.client.ClientEventHandler;
|
||||
import noppes.npcs.constants.EnumAnimationPart;
|
||||
|
||||
public class FramePart implements IFramePart {
|
||||
|
||||
public Animation parent;
|
||||
public EnumAnimationPart part;
|
||||
public float[] rotation = {0, 0, 0};
|
||||
public float[] pivot = {0, 0, 0};
|
||||
@@ -149,6 +149,9 @@ public class FramePart implements IFramePart {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void interpolateAngles() {
|
||||
if (parent != null && parent.paused)
|
||||
return;
|
||||
|
||||
float pi = (float) Math.PI / 180;
|
||||
if (this.smooth == 2) {
|
||||
this.prevRotations[0] = this.rotation[0] * pi;
|
||||
@@ -179,6 +182,9 @@ public class FramePart implements IFramePart {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void interpolateOffset() {
|
||||
if (parent != null && parent.paused)
|
||||
return;
|
||||
|
||||
if (this.smooth == 2) {
|
||||
this.prevPivots[0] = this.pivot[0];
|
||||
this.prevPivots[1] = this.pivot[1];
|
||||
|
||||
Reference in new issue
Block a user