mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 21:54:08 +00:00
Field Def Size Fixes
This commit is contained in:
1 parent
675c4ef4f9
commit
3bbde1f748
3 files changed
+20
-6
No files matched your search
@@ -187,19 +187,27 @@ public class FieldDef {
|
||||
idSetter.accept(-1);
|
||||
} else {
|
||||
idSetter.accept(sel.selectedAnimationId);
|
||||
nameSetter.accept("");
|
||||
String customName = sel.getSelectedName();
|
||||
nameSetter.accept(customName != null ? customName : "");
|
||||
}
|
||||
})
|
||||
.buttonLabel(() -> {
|
||||
String name = nameGetter.get();
|
||||
if (name != null && !name.isEmpty()) return name;
|
||||
int id = idGetter.get();
|
||||
if (id < 0 && name != null && !name.isEmpty()) {
|
||||
// Built-in animation: show just the name
|
||||
return name;
|
||||
}
|
||||
if (id >= 0) {
|
||||
// Custom animation: show (X) Name
|
||||
if (name != null && !name.isEmpty()) {
|
||||
return "(" + id + ") " + name;
|
||||
}
|
||||
Animation anim = AnimationController.Instance != null
|
||||
? (Animation) AnimationController.Instance.get(id) : null;
|
||||
String animName = anim != null ? anim.getName() : "";
|
||||
return animName != null && !animName.isEmpty()
|
||||
? "(ID: " + id + ") " + animName : "ID: " + id;
|
||||
? "(" + id + ") " + animName : String.valueOf(id);
|
||||
}
|
||||
return "gui.none";
|
||||
})
|
||||
|
||||
@@ -347,9 +347,14 @@ public class GuiFieldBuilder {
|
||||
String translated = StatCollector.translateToLocal(def.getLabel());
|
||||
int labelW = fontRenderer.getStringWidth(translated);
|
||||
int fieldX = colLLabel + labelW + labelPadding;
|
||||
// Clamp field width so it doesn't extend under the scrollbar
|
||||
// Available width before the scrollbar
|
||||
int maxW = contentRight - fieldX - 15;
|
||||
if (maxW > 0 && fieldW > maxW) fieldW = maxW;
|
||||
if (def.getType() == FieldType.SUB_GUI && maxW > 0) {
|
||||
// SUB_GUI fields fill all available width up to the scrollbar
|
||||
fieldW = maxW;
|
||||
} else if (maxW > 0 && fieldW > maxW) {
|
||||
fieldW = maxW;
|
||||
}
|
||||
renderFieldAt(def, colLLabel, fieldX, fieldW, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -145,11 +145,12 @@ public class GuiSoundSelection extends SubGuiInterface implements ICustomScrollL
|
||||
scrollSounds.resetScroll();
|
||||
getTextField(66).setText("");
|
||||
soundSearch = "";
|
||||
initGui();
|
||||
}
|
||||
if (guiCustomScroll.id == 1) {
|
||||
selectedResource = new ResourceLocation(selectedDomain, guiCustomScroll.getSelected());
|
||||
getButton(1).enabled = true;
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user