@@ -204,16 +204,17 @@ protected MidnightConfigScreen(Screen parent, String modid) {
204
204
public boolean reload = false ;
205
205
public TabManager tabManager = new TabManager (a -> refresh (), a -> refresh ());
206
206
public Tab prevTab ;
207
+ public ButtonWidget done ;
207
208
208
209
// Real Time config update //
209
210
@ Override
210
211
public void tick () {
211
212
super .tick ();
212
- tabManager .tick ();
213
213
if (prevTab != null && prevTab != tabManager .getCurrentTab ()) {
214
214
prevTab = tabManager .getCurrentTab ();
215
215
this .list .clear ();
216
216
fillList ();
217
+ list .setScrollAmount (0 );
217
218
}
218
219
for (EntryInfo info : entries ) {
219
220
try {info .field .set (null , info .value );} catch (IllegalAccessException ignored ) {}
@@ -283,10 +284,7 @@ public void init() {
283
284
this .list = new MidnightConfigListWidget (this .client , this .width , this .height , 32 , this .height - 32 , 25 );
284
285
if (this .client != null && this .client .world != null ) this .list .setRenderBackground (false );
285
286
this .addSelectableChild (this .list );
286
- this .fillList ();
287
- }
288
- public void fillList () {
289
- ButtonWidget done = this .addDrawableChild (ButtonWidget .builder (ScreenTexts .DONE , (button ) -> {
287
+ done = this .addDrawableChild (ButtonWidget .builder (ScreenTexts .DONE , (button ) -> {
290
288
for (EntryInfo info : entries )
291
289
if (info .id .equals (modid )) {
292
290
try {
@@ -296,6 +294,9 @@ public void fillList() {
296
294
write (modid );
297
295
Objects .requireNonNull (client ).setScreen (parent );
298
296
}).dimensions (this .width / 2 + 4 , this .height - 28 , 150 , 20 ).build ());
297
+ fillList ();
298
+ }
299
+ public void fillList () {
299
300
for (EntryInfo info : entries ) {
300
301
if (info .id .equals (modid ) && (info .tab == null || info .tab == tabManager .getCurrentTab ())) {
301
302
Text name = Objects .requireNonNullElseGet (info .name , () -> Text .translatable (translationPrefix + info .field .getName ()));
0 commit comments