Revert "Revert Animation Events"

This reverts commit 1ffddd3ce9.
This commit is contained in:
Kam committed 2024-08-22 16:47:07 -04:00
1 parent 2689127787
commit 4113bcc6e9
31 files changed
+694 -206

No files matched your search

@@ -1,12 +1,10 @@
package noppes.npcs.client.gui;
import net.minecraft.client.gui.GuiButton;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.client.gui.util.*;
import noppes.npcs.controllers.data.Animation;
public class SubGuiAnimationOptions extends SubGuiInterface {
public class SubGuiAnimationOptions extends SubGuiInterface implements ITextfieldListener {
private final Animation animation;
public SubGuiAnimationOptions(Animation animation) {
@@ -20,8 +18,10 @@ public class SubGuiAnimationOptions extends SubGuiInterface {
super.initGui();
//
//ticks - button
this.addLabel(new GuiNpcLabel(10, "animation.tickType", guiLeft + 5, guiTop + 16));
this.addButton(new GuiNpcButton(10, guiLeft + 60, guiTop + 10, 75, 20, new String[]{"animation.renderTicks", "animation.mcTicks"}, animation.renderTicks ? 0 : 1));
this.addLabel(new GuiNpcLabel(10, "animation.tickDuration", guiLeft + 5, guiTop + 16));
this.addTextField(new GuiNpcTextField(10, this, guiLeft + 80, guiTop + 12, 40, 15, animation.tickDuration + ""));
this.getTextField(10).integersOnly = true;
this.getTextField(10).setMinMaxDefault(1, Integer.MAX_VALUE, 50);
//
//whileStanding - button
this.addLabel(new GuiNpcLabel(11, "animation.whileStanding", guiLeft + 5, guiTop + 36));
@@ -41,9 +41,7 @@ public class SubGuiAnimationOptions extends SubGuiInterface {
super.actionPerformed(guibutton);
int value = ((GuiNpcButton)guibutton).getValue();
if (guibutton.id == 10) {
animation.renderTicks = value == 0;
} else if (guibutton.id == 11) {
if (guibutton.id == 11) {
animation.whileStanding = value == 0;
} else if (guibutton.id == 12) {
animation.whileAttacking = value == 0;
@@ -53,4 +51,11 @@ public class SubGuiAnimationOptions extends SubGuiInterface {
initGui();
}
@Override
public void unFocused(GuiNpcTextField textfield) {
if (textfield.id == 10) {
animation.tickDuration = textfield.getInteger();
}
}
}