@@ -30,10 +30,11 @@ public class SettingPanel extends TOptionsPanel {
3030
3131 @ SuppressWarnings ({"rawtypes" , "unchecked" })
3232 public SettingPanel () {
33+ var cfg = getConfigRead ();
3334 addOptionSplitter (Component .translatable ("gui.mp.de.setting.universal" ));
3435 addOptionSliderDoubleInit (Component .translatable ("gui.mp.de.setting.amount" ),
3536 //FIXME target value < actual value
36- 0x2000 , Math .max (1000000 , getConfigRead () .maxParticleAmountOfSingleQueue ),
37+ 0x2000 , Math .max (1000000 , cfg .maxParticleAmountOfSingleQueue ),
3738 (component , aDouble ) -> Component .literal (String .format ("%d" , aDouble .intValue ())),
3839 Component .translatable ("gui.mp.de.setting.amount.tooltip" ),
3940 (s , d ) -> {
@@ -45,15 +46,15 @@ public SettingPanel() {
4546 newQueue .addAll (particleGroup .particles );
4647 particleGroup .particles = (Queue ) newQueue ;
4748 });
48- }, getConfigRead () .maxParticleAmountOfSingleQueue , false );
49+ }, cfg .maxParticleAmountOfSingleQueue , false );
4950 addOptionCycleButtonInit (Component .translatable ("gui.mp.de.setting.real_force" ),
5051 List .of (Boolean .TRUE , Boolean .FALSE ),
5152 List .of (b -> ConfigHelper .getConfigWrite (MadParticleConfig .class , madParticleConfig -> madParticleConfig .limitMaxParticleGenerateDistance = true ),
5253 b -> ConfigHelper .getConfigWrite (MadParticleConfig .class , madParticleConfig -> madParticleConfig .limitMaxParticleGenerateDistance = false )),
53- e -> e .getContent () == getConfigRead () .limitMaxParticleGenerateDistance
54+ e -> e .getContent () == cfg .limitMaxParticleGenerateDistance
5455 )
5556 .getSecond ().setTooltip (Tooltip .create (Component .translatable ("gui.mp.de.setting.real_force.tooltip" )));
56- int amount = getConfigRead () .getBufferFillerThreads ();
57+ int amount = cfg .getBufferFillerThreads ();
5758 addOptionCycleButtonInit (Component .translatable ("gui.mp.de.setting.threads" ),
5859 //FIXME
5960 Sets .newLinkedHashSet (List .of ("gui.mp.de.setting.threads.zero" , 2 , 4 , 6 , 8 , 12 , 16 , amount == 1 ? 6 : amount )).stream ().toList (),
@@ -70,25 +71,25 @@ public SettingPanel() {
7071 method -> b -> {
7172 ConfigHelper .getConfigWrite (MadParticleConfig .class , madParticleConfig -> madParticleConfig .translucentMethod = method );
7273 b .setTooltip (Tooltip .create (Component .translatable (method .translateKey () + ".tooltip" )));
73- }, entry -> entry .getContent () == getConfigRead () .translucentMethod
74- );
74+ }, entry -> entry .getContent () == cfg .translucentMethod
75+ ). getSecond (). setTooltip ( Tooltip . create ( Component . translatable ( cfg . translucentMethod . translateKey () + ".tooltip" ))) ;
7576
7677
7778 addOptionSplitter (Component .translatable ("gui.mp.de.setting.additional" ));
7879 addOptionCycleButtonInit (Component .translatable ("gui.mp.de.setting.additional.takeover_render" ),
7980 List .of (TakeOver .values ()), takeOver -> b -> ConfigHelper .getConfigWrite (MadParticleConfig .class , madParticleConfig -> madParticleConfig .takeOverRendering = b .getSelected ().getContent ()),
80- entry -> entry .getContent () == getConfigRead () .takeOverRendering
81+ entry -> entry .getContent () == cfg .takeOverRendering
8182 )
8283 .getSecond ().setTooltip (Tooltip .create (Component .translatable ("gui.mp.de.setting.additional.takeover_render.tooltip" )));
8384 addOptionCycleButtonInit (Component .translatable ("gui.mp.de.setting.additional.takeover_tick" ),
8485 List .of (TakeOver .values ()), takeOver -> b -> ConfigHelper .getConfigWrite (MadParticleConfig .class , madParticleConfig -> madParticleConfig .takeOverTicking = b .getSelected ().getContent ()),
85- entry -> entry .getContent () == getConfigRead () .takeOverTicking
86+ entry -> entry .getContent () == cfg .takeOverTicking
8687 )
8788 .getSecond ().setTooltip (Tooltip .create (Component .translatable ("gui.mp.de.setting.additional.takeover_tick.tooltip" )));
8889 addOptionCycleButtonInit (Component .translatable ("gui.mp.de.setting.additional.optimize_command_block" ),
8990 List .of (Boolean .TRUE , Boolean .FALSE ),
9091 bool -> b -> ConfigHelper .getConfigWrite (MadParticleConfig .class , madParticleConfig -> madParticleConfig .optimizeCommandBlockEditScreen = bool ),
91- entry -> entry .getContent () == getConfigRead () .optimizeCommandBlockEditScreen
92+ entry -> entry .getContent () == cfg .optimizeCommandBlockEditScreen
9293 );
9394 addOptionCycleButton (Component .translatable ("gui.mp.de.setting.additional.counter" ),
9495 List .of (Boolean .FALSE , Boolean .TRUE ),
@@ -103,26 +104,26 @@ public SettingPanel() {
103104
104105 addOptionSplitter (Component .translatable ("gui.mp.de.setting.light" ));
105106 addOptionCycleButtonInit (Component .translatable ("gui.mp.de.setting.light.hor" ),
106- Sets .newLinkedHashSet (List .of (16 , 64 , 128 , 256 , 512 , getConfigRead () .lightCacheXZRange )).stream ().toList (),
107+ Sets .newLinkedHashSet (List .of (16 , 64 , 128 , 256 , 512 , cfg .lightCacheXZRange )).stream ().toList (),
107108 integer -> i -> ConfigHelper .getConfigWrite (MadParticleConfig .class , madParticleConfig -> madParticleConfig .lightCacheXZRange = i .getSelected ().getContent ()),
108- entry -> entry .getContent () == getConfigRead () .lightCacheXZRange ).getSecond ()
109+ entry -> entry .getContent () == cfg .lightCacheXZRange ).getSecond ()
109110 .setTooltip (Tooltip .create (Component .translatable ("gui.mp.de.setting.light.hor.tooltip" )));
110111 addOptionCycleButtonInit (Component .translatable ("gui.mp.de.setting.light.ver" ),
111- Sets .newLinkedHashSet (List .of (16 , 64 , 128 , 256 , 512 , getConfigRead () .lightCacheYRange )).stream ().toList (),
112+ Sets .newLinkedHashSet (List .of (16 , 64 , 128 , 256 , 512 , cfg .lightCacheYRange )).stream ().toList (),
112113 integer -> i -> ConfigHelper .getConfigWrite (MadParticleConfig .class , madParticleConfig -> madParticleConfig .lightCacheYRange = i .getSelected ().getContent ()),
113- entry -> entry .getContent () == getConfigRead () .lightCacheYRange ).getSecond ()
114+ entry -> entry .getContent () == cfg .lightCacheYRange ).getSecond ()
114115 .setTooltip (Tooltip .create (Component .translatable ("gui.mp.de.setting.light.ver.tooltip" )));
115116 ramUsage = addOption (Component .translatable ("gui.mp.de.setting.light.ram" ), new TLabel ()).getSecond ()
116117 .setHorizontalAlignment (HorizontalAlignment .LEFT );
117118 addOptionCycleButtonInit (Component .translatable ("gui.mp.de.setting.light.force" ),
118119 List .of (Boolean .TRUE , Boolean .FALSE ),
119120 bool -> b -> ConfigHelper .getConfigWrite (MadParticleConfig .class , madParticleConfig -> madParticleConfig .forceMaxLight = bool ),
120- entry -> entry .getContent () == getConfigRead () .forceMaxLight ).getSecond ()
121+ entry -> entry .getContent () == cfg .forceMaxLight ).getSecond ()
121122 .setTooltip (Tooltip .create (Component .translatable ("gui.mp.de.setting.light.force.tooltip" )));
122123 addOptionCycleButtonInit (Component .translatable ("gui.mp.de.setting.light.update" ),
123124 List .of (LightCacheRefreshInterval .values ()),
124125 interval -> b -> ConfigHelper .getConfigWrite (MadParticleConfig .class , madParticleConfig -> madParticleConfig .lightCacheRefreshInterval = interval ),
125- entry -> entry .getContent () == getConfigRead () .lightCacheRefreshInterval
126+ entry -> entry .getContent () == cfg .lightCacheRefreshInterval
126127 )
127128 .getSecond ().setTooltip (Tooltip .create (Component .translatable ("gui.mp.de.setting.light.update.tooltip" )));
128129
0 commit comments