2023-11-08 18:21:14 -06:00
|
|
|
package noppes.npcs.client.gui;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.client.gui.GuiButton;
|
|
|
|
|
import noppes.npcs.client.gui.util.*;
|
|
|
|
|
import noppes.npcs.controllers.data.Frame;
|
|
|
|
|
|
|
|
|
|
public class SubGuiAnimationFrame extends SubGuiInterface implements ITextfieldListener {
|
|
|
|
|
private final Frame editingFrame;
|
|
|
|
|
|
|
|
|
|
public SubGuiAnimationFrame(Frame editingFrame) {
|
|
|
|
|
this.editingFrame = editingFrame;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void initGui() {
|
|
|
|
|
super.initGui();
|
|
|
|
|
//
|
|
|
|
|
//customized - button, enables all the following options.
|
2023-11-08 21:09:07 -06:00
|
|
|
this.addLabel(new GuiNpcLabel(10, "animation.customized", guiLeft, guiTop + 44, 0xFFFFFF));
|
|
|
|
|
this.addButton(new GuiNpcButton(10, guiLeft + 60, guiTop + 38, 30, 20, new String[]{"gui.yes", "gui.no"}, editingFrame.isCustomized() ? 0 : 1));
|
2023-11-08 18:21:14 -06:00
|
|
|
if (editingFrame.isCustomized()) {
|
|
|
|
|
//
|
|
|
|
|
//speed - textfield
|
2023-11-08 21:09:07 -06:00
|
|
|
this.addLabel(new GuiNpcLabel(11, "stats.speed", guiLeft, guiTop + 64, 0xFFFFFF));
|
|
|
|
|
this.addTextField(new GuiNpcTextField(11, this, guiLeft + 60, guiTop + 60, 30, 15, editingFrame.speed + ""));
|
|
|
|
|
this.getTextField(11).floatsOnly = true;
|
|
|
|
|
this.getTextField(11).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 1.0F);
|
2023-11-08 18:21:14 -06:00
|
|
|
//
|
|
|
|
|
//smooth - button
|
2023-11-08 21:09:07 -06:00
|
|
|
this.addLabel(new GuiNpcLabel(12, "animation.smoothing", guiLeft, guiTop + 84, 0xFFFFFF));
|
|
|
|
|
this.addButton(new GuiNpcButton(12, guiLeft + 55, guiTop + 78, 60, 20, new String[]{"animation.smooth", "animation.linear", "gui.none"}, editingFrame.smooth));
|
2023-11-08 18:21:14 -06:00
|
|
|
//
|
|
|
|
|
//ticks - button
|
2023-11-08 21:09:07 -06:00
|
|
|
this.addLabel(new GuiNpcLabel(13, "animation.tickType", guiLeft, guiTop + 104, 0xFFFFFF));
|
|
|
|
|
this.addButton(new GuiNpcButton(13, guiLeft + 55, guiTop + 98, 75, 20, new String[]{"animation.renderTicks", "animation.mcTicks"}, editingFrame.renderTicks ? 0 : 1));
|
2023-11-08 18:21:14 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void actionPerformed(GuiButton guibutton) {
|
|
|
|
|
super.actionPerformed(guibutton);
|
|
|
|
|
int value = ((GuiNpcButton)guibutton).getValue();
|
|
|
|
|
|
2023-11-08 21:09:07 -06:00
|
|
|
if (guibutton.id == 10 && editingFrame != null) {
|
2023-11-08 18:21:14 -06:00
|
|
|
editingFrame.setCustomized(!editingFrame.isCustomized());
|
2023-11-08 21:09:07 -06:00
|
|
|
} else if (guibutton.id == 12 && editingFrame != null) {
|
2023-11-08 18:21:14 -06:00
|
|
|
editingFrame.smooth = (byte) value;
|
2023-11-08 21:09:07 -06:00
|
|
|
} else if (guibutton.id == 13 && editingFrame != null) {
|
2023-11-08 18:21:14 -06:00
|
|
|
editingFrame.renderTicks = value == 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void unFocused(GuiNpcTextField textfield) {
|
2023-11-08 21:09:07 -06:00
|
|
|
if (textfield.id == 11 && this.editingFrame != null) {
|
2023-11-08 18:21:14 -06:00
|
|
|
this.editingFrame.speed = textfield.getFloat();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|