mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 20:07:32 +00:00
Changed animation and frame GUIs to be able to edit tick durations.
This commit is contained in:
1 parent
799631eece
commit
cf4e5f22b1
3 files changed
+38
-23
No files matched your search
@@ -18,33 +18,38 @@ public class SubGuiAnimationFrame extends SubGuiInterface implements ITextfieldL
|
||||
//
|
||||
//customized - button, enables all the following options.
|
||||
this.addLabel(new GuiNpcLabel(10, "animation.customized", guiLeft + 5, guiTop + 16));
|
||||
this.addButton(new GuiNpcButton(10, guiLeft + 65, guiTop + 10, 30, 20, new String[]{"gui.yes", "gui.no"}, editingFrame.isCustomized() ? 0 : 1));
|
||||
this.addButton(new GuiNpcButton(10, guiLeft + 75, guiTop + 10, 30, 20, new String[]{"gui.yes", "gui.no"}, editingFrame.isCustomized() ? 0 : 1));
|
||||
if (editingFrame.isCustomized()) {
|
||||
//
|
||||
//speed - textfield
|
||||
this.addLabel(new GuiNpcLabel(11, "stats.speed", guiLeft + 5, guiTop + 36));
|
||||
this.addTextField(new GuiNpcTextField(11, this, guiLeft + 65, guiTop + 32, 30, 15, editingFrame.speed + ""));
|
||||
this.addLabel(new GuiNpcLabel(11, "stats.speed", guiLeft + 5, guiTop + 42));
|
||||
this.addTextField(new GuiNpcTextField(11, this, guiLeft + 75, guiTop + 37, 30, 15, editingFrame.speed + ""));
|
||||
this.getTextField(11).floatsOnly = true;
|
||||
this.getTextField(11).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 1.0F);
|
||||
//
|
||||
//smooth - button
|
||||
this.addLabel(new GuiNpcLabel(12, "animation.smoothing", guiLeft + 5, guiTop + 58));
|
||||
this.addButton(new GuiNpcButton(12, guiLeft + 65, guiTop + 52, 60, 20, new String[]{"animation.smooth", "animation.linear", "gui.none"}, editingFrame.smooth));
|
||||
this.addLabel(new GuiNpcLabel(12, "animation.smoothing", guiLeft + 5, guiTop + 63));
|
||||
this.addButton(new GuiNpcButton(12, guiLeft + 75, guiTop + 55, 60, 20, new String[]{"animation.smooth", "animation.linear", "gui.none"}, editingFrame.smooth));
|
||||
//
|
||||
//ticks - button
|
||||
this.addLabel(new GuiNpcLabel(13, "animation.tickType", guiLeft + 5, guiTop + 78));
|
||||
//this.addButton(new GuiNpcButton(13, guiLeft + 65, guiTop + 72, 75, 20, new String[]{"animation.renderTicks", "animation.mcTicks"}, editingFrame.renderTicks ? 0 : 1));
|
||||
//tick duration - textfield
|
||||
this.addLabel(new GuiNpcLabel(13, "animation.tickDuration", guiLeft + 5, guiTop + 84));
|
||||
this.addTextField(new GuiNpcTextField(13, this, guiLeft + 75, guiTop + 79, 40, 15, editingFrame.tickDuration + ""));
|
||||
this.getTextField(13).integersOnly = true;
|
||||
this.getTextField(13).setMinMaxDefault(1, Integer.MAX_VALUE, 50);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
super.actionPerformed(guibutton);
|
||||
int value = ((GuiNpcButton)guibutton).getValue();
|
||||
if (this.editingFrame == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (guibutton.id == 10 && editingFrame != null) {
|
||||
int value = ((GuiNpcButton)guibutton).getValue();
|
||||
if (guibutton.id == 10) {
|
||||
editingFrame.setCustomized(!editingFrame.isCustomized());
|
||||
} else if (guibutton.id == 12 && editingFrame != null) {
|
||||
} else if (guibutton.id == 12) {
|
||||
editingFrame.smooth = (byte) value;
|
||||
}
|
||||
|
||||
@@ -53,8 +58,14 @@ public class SubGuiAnimationFrame extends SubGuiInterface implements ITextfieldL
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if (textfield.id == 11 && this.editingFrame != null) {
|
||||
if (this.editingFrame == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (textfield.id == 11) {
|
||||
this.editingFrame.speed = textfield.getFloat();
|
||||
} else if (textfield.id == 13) {
|
||||
this.editingFrame.tickDuration = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
@@ -19,7 +17,10 @@ public class SubGuiAnimationOptions extends SubGuiInterface {
|
||||
super.initGui();
|
||||
//
|
||||
//ticks - button
|
||||
this.addLabel(new GuiNpcLabel(10, "animation.tickType", guiLeft + 5, guiTop + 16));
|
||||
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));
|
||||
@@ -39,9 +40,7 @@ public class SubGuiAnimationOptions extends SubGuiInterface {
|
||||
super.actionPerformed(guibutton);
|
||||
int value = ((GuiNpcButton)guibutton).getValue();
|
||||
|
||||
if (guibutton.id == 10) {
|
||||
|
||||
} else if (guibutton.id == 11) {
|
||||
if (guibutton.id == 11) {
|
||||
animation.whileStanding = value == 0;
|
||||
} else if (guibutton.id == 12) {
|
||||
animation.whileAttacking = value == 0;
|
||||
@@ -51,4 +50,11 @@ public class SubGuiAnimationOptions extends SubGuiInterface {
|
||||
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if (textfield.id == 10) {
|
||||
animation.tickDuration = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user