1818import io .github .axolotlclient .config .screen .widgets .ColorOptionWidget ;
1919import io .github .axolotlclient .config .screen .widgets .EnumOptionWidget ;
2020import io .github .axolotlclient .config .screen .widgets .OptionSliderWidget ;
21+ import io .github .axolotlclient .config .screen .widgets .OptionWidgetProvider ;
2122import io .github .axolotlclient .config .screen .widgets .StringOptionWidget ;
2223import io .github .axolotlclient .modules .hud .util .Rectangle ;
2324import io .github .axolotlclient .util .Util ;
@@ -52,10 +53,10 @@ public ButtonWidgetList(MinecraftClient minecraftClient, int width, int height,
5253 if (!category .getSubCategories ().isEmpty ()) {
5354 for (int i = 0 ; i < category .getSubCategories ().size (); i += 2 ) {
5455 OptionCategory subCat = category .getSubCategories ().get (i );
55- CategoryWidget buttonWidget = this .createCategoryWidget (width / 2 - 155 , subCat );
56+ AbstractButtonWidget buttonWidget = this .createCategoryWidget (width / 2 - 155 , subCat );
5657
5758 OptionCategory subCat2 = i < category .getSubCategories ().size () - 1 ? category .getSubCategories ().get (i + 1 ) : null ;
58- CategoryWidget buttonWidget2 = this .createCategoryWidget (width / 2 - 155 + 160 , subCat2 );
59+ AbstractButtonWidget buttonWidget2 = this .createCategoryWidget (width / 2 - 155 + 160 , subCat2 );
5960
6061 this .addEntry (new CategoryPair (subCat , buttonWidget , subCat2 , buttonWidget2 ));
6162 this .entries .add (new CategoryPair (subCat , buttonWidget , subCat2 , buttonWidget2 ));
@@ -81,23 +82,23 @@ protected int addEntry(ButtonEntry entry) {
8182 return super .addEntry (entry );
8283 }
8384
84- private CategoryWidget createCategoryWidget (int x , OptionCategory cat ){
85+ private AbstractButtonWidget createCategoryWidget (int x , OptionCategory cat ){
8586 if (cat ==null ) {
8687 return null ;
8788 } else {
88- return new CategoryWidget ( cat , x , 0 ,150 , 20 );
89+ return OptionWidgetProvider . getCategoryWidget ( x , 0 ,150 , 20 , cat );
8990 }
9091 }
9192
9293 private AbstractButtonWidget createWidget (int x , Option option ) {
9394 if (option != null ) {
94- if (option instanceof FloatOption ) return new OptionSliderWidget (x , 0 , (FloatOption ) option );
95- else if (option instanceof IntegerOption ) return new OptionSliderWidget (x , 0 , (IntegerOption ) option );
96- else if (option instanceof DoubleOption ) return new OptionSliderWidget (x , 0 , (DoubleOption ) option );
97- else if (option instanceof BooleanOption ) return new BooleanWidget (x , 0 , 35 , 20 , (BooleanOption ) option );
98- else if (option instanceof StringOption ) return new StringOptionWidget (x , 0 , (StringOption ) option );
99- else if (option instanceof ColorOption ) return new ColorOptionWidget (x , 0 , (ColorOption ) option );
100- else if (option instanceof EnumOption ) return new EnumOptionWidget (x , 0 , (EnumOption ) option );
95+ if (option instanceof FloatOption ) return OptionWidgetProvider . getFloatWidget (x , 0 , (FloatOption ) option );
96+ else if (option instanceof IntegerOption ) return OptionWidgetProvider . getIntegerWidget (x , 0 , (IntegerOption ) option );
97+ else if (option instanceof DoubleOption ) return OptionWidgetProvider . getDoubleWidget (x , 0 , (DoubleOption ) option );
98+ else if (option instanceof BooleanOption ) return OptionWidgetProvider . getBooleanWidget (x , 0 , 35 , 20 , (BooleanOption ) option );
99+ else if (option instanceof StringOption ) return OptionWidgetProvider . getStringWidget (x , 0 , (StringOption ) option );
100+ else if (option instanceof ColorOption ) return OptionWidgetProvider . getColorWidget (x , 0 , (ColorOption ) option );
101+ else if (option instanceof EnumOption ) return OptionWidgetProvider . getEnumWidget (x , 0 , (EnumOption ) option );
101102 }
102103 return null ;
103104 }
@@ -135,7 +136,7 @@ public void render(MatrixStack matrixStack, int i, int j, float f) {
135136 this .renderList (matrixStack , m , n , i , j , f );
136137
137138 RenderSystem .disableTexture ();
138- int q = Math .max (0 , this .getMaxPosition () - (this .bottom - this .top - 4 ));;
139+ int q = Math .max (0 , this .getMaxPosition () - (this .bottom - this .top - 4 ));
139140 if (q > 0 ) {
140141 int r = (int )((float )((this .bottom - this .top ) * (this .bottom - this .top )) / (float )this .getMaxPosition ());
141142 r = MathHelper .clamp (r , 32 , this .bottom - this .top - 8 );
@@ -321,7 +322,7 @@ public class CategoryPair extends Pair {
321322 protected OptionCategory left ;
322323 protected OptionCategory right ;
323324
324- public CategoryPair (OptionCategory catLeft , CategoryWidget btnLeft , OptionCategory catRight , CategoryWidget btnRight ) {
325+ public CategoryPair (OptionCategory catLeft , AbstractButtonWidget btnLeft , OptionCategory catRight , AbstractButtonWidget btnRight ) {
325326 super (btnLeft , btnRight );
326327 left = catLeft ;
327328 right = catRight ;
0 commit comments