Switching frames now switches the animation to that frame whether you're paused or not

This commit is contained in:
luisc committed 2023-11-10 07:58:15 -06:00
1 parent f807df934a
commit 42c069aeb5
3 files changed
+5 -8

No files matched your search

@@ -2,7 +2,6 @@ package noppes.npcs.client.gui.global;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.gui.SubGuiAnimationFrame;
import noppes.npcs.client.gui.SubGuiAnimationOptions;
import noppes.npcs.controllers.data.AnimationData;
@@ -19,7 +18,6 @@ import noppes.npcs.util.ValueUtil;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
public class GuiNPCEditAnimation extends GuiModelInterface implements ITextfieldListener, ISliderListener {
private final Animation animation;
@@ -122,7 +120,7 @@ public class GuiNPCEditAnimation extends GuiModelInterface implements ITextfield
if (this.playingAnimation) {
this.animation.currentFrame = this.frameIndex;
this.animation.setPausedValues();
this.animation.jumpToCurrentFrame();
}
this.addLabel(new GuiNpcLabel(10, "animation.frames", guiLeft + 40, guiTop + 176 - 10, 0xFFFFFF));
@@ -476,7 +474,7 @@ public class GuiNPCEditAnimation extends GuiModelInterface implements ITextfield
setSubGui(new SubGuiAnimationFrame(editingFrame));
}
if (guibutton.id >= 300 && guibutton.id < 325 && (!this.playingAnimation || this.animation.paused)) {
if (guibutton.id >= 300 && guibutton.id < 325) {
int frameClicked = guibutton.id - 300;
if (frameClicked < this.animation.frames.size()) {
this.frameIndex = frameClicked;
@@ -10,7 +10,6 @@ import noppes.npcs.constants.EnumAnimationPart;
import noppes.npcs.controllers.AnimationController;
import java.util.ArrayList;
import java.util.UUID;
public class Animation implements IAnimation {
@@ -253,12 +252,12 @@ public class Animation implements IAnimation {
}
@SideOnly(Side.CLIENT)
public void setPausedValues() {
public void jumpToCurrentFrame() {
this.currentFrameTime = 0;
Frame frame = (Frame) this.currentFrame();
for (EnumAnimationPart part : EnumAnimationPart.values()) {
if (frame.frameParts.containsKey(part)) {
frame.frameParts.get(part).setPausedValues();
frame.frameParts.get(part).jumpToCurrentFrame();
}
}
}
@@ -223,7 +223,7 @@ public class FramePart implements IFramePart {
}
@SideOnly(Side.CLIENT)
public void setPausedValues() {
public void jumpToCurrentFrame() {
this.partialRotationTick = ClientEventHandler.partialRenderTick;
this.partialPivotTick = ClientEventHandler.partialRenderTick;