mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 02:37:27 +00:00
Fix to setting animation names.
This commit is contained in:
1 parent
354c9808e4
commit
e65ba59b8e
2 files changed
+9
-2
No files matched your search
@@ -888,9 +888,10 @@ public class PacketHandlerServer{
|
||||
}
|
||||
else if (type == EnumPacketServer.AnimationSave) {
|
||||
String prevName = Server.readString(buffer);
|
||||
AnimationController.instance.animations.remove(prevName);
|
||||
Animation animation = new Animation();
|
||||
animation.readFromNBT(Server.readNBT(buffer));
|
||||
if (prevName != null && !prevName.equals(animation.getName()) && AnimationController.instance.has(animation.getName())) {
|
||||
if (AnimationController.instance.has(animation.getName())) {
|
||||
animation.name = prevName;
|
||||
}
|
||||
animation.save();
|
||||
|
||||
@@ -450,7 +450,13 @@ public class GuiNPCManageAnimations extends GuiModelInterface implements IScroll
|
||||
FramePart part = this.editingPart();
|
||||
|
||||
if (textfield.id == 30 && !text.isEmpty()) {
|
||||
animation.name = text.replaceAll("[^a-zA-Z0-9_-]", "_");
|
||||
String nameText = text.replaceAll("[^a-zA-Z0-9_-]", "_");
|
||||
if (!scroll.getList().contains(nameText)) {
|
||||
animation.name = nameText;
|
||||
Client.sendData(EnumPacketServer.AnimationSave, prevSelected, animation.writeToNBT());
|
||||
} else {
|
||||
textfield.setText(animation.name);
|
||||
}
|
||||
} else if (textfield.id == 32) {
|
||||
if (editingMode == 0) {
|
||||
animation.speed = textfield.getFloat();
|
||||
|
||||
Reference in new issue
Block a user