2929
3030public class OptionListWidget extends ElementListWidget <OptionListWidget .Entry > {
3131 private final YACLScreen yaclScreen ;
32+ private boolean singleCategory = false ;
3233
3334 public OptionListWidget (YACLScreen screen , MinecraftClient client , int width , int height ) {
3435 super (client , width / 3 * 2 , height , 0 , height , 22 );
@@ -48,6 +49,7 @@ public void refreshOptions() {
4849 } else {
4950 categories .add (yaclScreen .config .categories ().get (yaclScreen .currentCategoryIdx ));
5051 }
52+ singleCategory = categories .size () == 1 ;
5153
5254 for (ConfigCategory category : categories ) {
5355 for (OptionGroup group : category .groups ()) {
@@ -63,7 +65,7 @@ public void refreshOptions() {
6365
6466 List <OptionEntry > optionEntries = new ArrayList <>();
6567 for (Option <?> option : group .options ()) {
66- OptionEntry entry = new OptionEntry (option .controller ().provideWidget (yaclScreen , Dimension .ofInt (getRowLeft (), 0 , getRowWidth (), 20 )), viewableSupplier );
68+ OptionEntry entry = new OptionEntry (category , group , option .controller ().provideWidget (yaclScreen , Dimension .ofInt (getRowLeft (), 0 , getRowWidth (), 20 )), viewableSupplier );
6769 addEntry (entry );
6870 optionEntries .add (entry );
6971 }
@@ -229,11 +231,16 @@ protected boolean isHovered() {
229231 }
230232 }
231233
232- private class OptionEntry extends Entry {
234+ public class OptionEntry extends Entry {
235+ public final ConfigCategory category ;
236+ public final OptionGroup group ;
237+
233238 public final AbstractWidget widget ;
234239 private final Supplier <Boolean > viewableSupplier ;
235240
236- public OptionEntry (AbstractWidget widget , Supplier <Boolean > viewableSupplier ) {
241+ private OptionEntry (ConfigCategory category , OptionGroup group , AbstractWidget widget , Supplier <Boolean > viewableSupplier ) {
242+ this .category = category ;
243+ this .group = group ;
237244 this .widget = widget ;
238245 this .viewableSupplier = viewableSupplier ;
239246 }
@@ -267,7 +274,7 @@ public boolean charTyped(char chr, int modifiers) {
267274
268275 @ Override
269276 public boolean isViewable () {
270- return viewableSupplier .get () && widget . matchesSearch ( yaclScreen .searchFieldWidget .getText (). trim () );
277+ return viewableSupplier .get () && yaclScreen .searchFieldWidget .matches ( this , singleCategory );
271278 }
272279
273280 @ Override
0 commit comments