Fixed animation track not updating correctly.

This commit is contained in:
luisc committed 2025-03-25 13:09:49 -05:00
1 parent 82c2a0f10f
commit e641823178
1 file changed
+10 -6
@@ -486,7 +486,9 @@ public class GuiNPCEditAnimation extends GuiModelInterface implements ITextfield
if (guibutton.id >= 300 && guibutton.id < 325) {
int frameClicked = guibutton.id - 300;
if (frameClicked < this.animation.frames.size()) {
this.frameIndex = frameClicked + this.frameOffset;
Animation playingAnim = data.animation != null && this.playingAnimation ? data.animation : this.animation;
int frameOffset = this.playingAnimation ? playingAnim.currentFrame - 24 : this.frameOffset;
this.frameIndex = frameClicked + Math.max(0, frameOffset);
overrideFrame = true;
}
}
@@ -531,18 +533,20 @@ public class GuiNPCEditAnimation extends GuiModelInterface implements ITextfield
super.drawScreen(par1, par2, par3);
Animation playingAnim = data.animation != null && this.playingAnimation ? data.animation : this.animation;
for (int i = 0; i < this.visibleFrames; i++) {
if (getButton(300 + i) != null) {
GuiTexturedButton button = (GuiTexturedButton) getButton(300 + i);
int sliderFrame = i + this.frameOffset;
if (sliderFrame >= this.animation.frames.size()) {
int frameOffset = this.playingAnimation ? playingAnim.currentFrame - 24 : this.frameOffset;
int sliderFrame = i + Math.max(0, frameOffset);
if (sliderFrame >= playingAnim.frames.size()) {
button.color = 0x0;
button.alpha = 0.3F;
} else {
button.color = this.animation.frames.get(sliderFrame).getColorMarker();
if ((sliderFrame == this.animation.currentFrame && this.playingAnimation) || sliderFrame == this.frameIndex) {
if ((sliderFrame == this.animation.currentFrame && this.playingAnimation)) {
button.color = playingAnim.frames.get(sliderFrame).getColorMarker();
if ((sliderFrame == playingAnim.currentFrame && this.playingAnimation) || sliderFrame == this.frameIndex) {
if ((sliderFrame == playingAnim.currentFrame && this.playingAnimation)) {
button.color = 0xfcf232;
} else {
button.color = 0x32a852;