5151public class Glossary extends Screen {
5252 private final Font font ;
5353 private final Screen priorScreen ;
54- public final PanelWidget targetedObject ;
54+ public PanelWidget targetedObject = new PanelWidget ( 0xFF000000 , 400 ) ;
5555
56- public Glossary (PanelWidget inbound ) {this (null , inbound );}
57- public Glossary () {this (null , null );}
58- public Glossary (Screen priorScreen , PanelWidget targetedObject ) {
56+ public Glossary () {this (null );}
57+ public Glossary (Screen priorScreen ) {
5958 super (Component .literal ("glossary" ));
6059 this .priorScreen = priorScreen ;
6160 this .font = Minecraft .getInstance ().font ;
61+ }
62+
63+ public Glossary withTarget (PanelWidget targetedObject ) {
6264 this .targetedObject = targetedObject ;
65+ return this ;
6366 }
6467
6568 //widgets
@@ -147,17 +150,22 @@ private SelectionWidget<SelectionWidget.SelectionEntry<String>> createSkillsWidg
147150 }
148151
149152 private void buildContent (ResponsiveLayout layout , int width ) {
153+ var profiler = Minecraft .getInstance ().getProfiler ();
154+ profiler .push ("glossary start" );
150155 if (targetedObject != null )
151156 layout .addChild ((AbstractWidget ) targetedObject , PositionType .STATIC .constraint , SizeConstraints .builder ().internalHeight ().build ());
157+ profiler .popPush ("glossary server config" );
152158 layout .addChild ((ResponsiveLayout )
153159 new ServerConfigPanelWidget (width ),
154160 PositionType .STATIC .constraint ,
155161 SizeConstraints .builder ().internalHeight ().build ());
162+ profiler .popPush ("glossary skills" );
156163 Config .skills ().skills ().forEach ((skill , data ) -> layout .addChild ((AbstractWidget )
157164 new SkillsConfigPanelWidget (width , skill , data ),
158165 PositionType .STATIC .constraint ,
159166 SizeConstraints .builder ().internalHeight ().build ()
160167 ));
168+ profiler .popPush ("glossary anticheese" );
161169 layout .addChild ((ResponsiveLayout )
162170 AntiCheesePanelWidget .AFK (0x88394045 , width , Config .anticheese ().afk (), Config .anticheese ().afkSubtract ()),
163171 PositionType .STATIC .constraint ,
@@ -173,51 +181,60 @@ private void buildContent(ResponsiveLayout layout, int width) {
173181 PositionType .STATIC .constraint ,
174182 SizeConstraints .builder ().internalHeight ().build ()
175183 );
184+ profiler .popPush ("glossary items" );
176185 CreativeModeTabs .searchTab ().getDisplayItems ().forEach (stack -> layout .addChild ((ResponsiveLayout )
177186 new ItemObjectPanelWidget (0x882e332e , width , stack ),
178187 PositionType .STATIC .constraint ,
179188 SizeConstraints .builder ().internalHeight ().build ())
180189 );
190+ profiler .popPush ("glossary blocks" );
181191 RegistryAccess access = Minecraft .getInstance ().player .registryAccess ();
182192 access .lookupOrThrow (Registries .BLOCK ).listElements ().forEach (ref -> layout .addChild ((ResponsiveLayout )
183193 new BlockObjectPanelWidget (0x882e2f33 , width , ref .value ()),
184194 PositionType .STATIC .constraint ,
185195 SizeConstraints .builder ().internalHeight ().build ()
186196 ));
197+ profiler .popPush ("glossary entities" );
187198 access .lookupOrThrow (Registries .ENTITY_TYPE ).listElements ()
188199 .map (ref -> ref .value ().create (Minecraft .getInstance ().level ))
189200 .filter (Objects ::nonNull )
190201 .forEach (entity -> layout .addChild ((ResponsiveLayout )
191202 new EntityObjectPanelWidget (0x88394045 , width , entity ),
192203 PositionType .STATIC .constraint ,
193204 SizeConstraints .builder ().internalHeight ().build ()));
205+ profiler .popPush ("glossary biomes" );
194206 access .lookupOrThrow (Registries .BIOME ).listElements ()
195207 .filter (Objects ::nonNull )
196208 .forEach (biome -> layout .addChild ((ResponsiveLayout )
197209 new BiomeObjectPanelWidget (0x88394045 , width , biome ),
198210 PositionType .STATIC .constraint ,
199211 SizeConstraints .builder ().internalHeight ().build ()));
212+ profiler .popPush ("glossary dimensions" );
200213 Minecraft .getInstance ().getConnection ().levels ().stream ()
201214 .filter (Objects ::nonNull )
202215 .forEach (key -> layout .addChild ((ResponsiveLayout )
203216 new DimensionObjectPanelWidget (0x88394045 , width , key ),
204217 PositionType .STATIC .constraint ,
205218 SizeConstraints .builder ().internalHeight ().build ()));
219+ profiler .popPush ("glossary effects" );
206220 access .lookupOrThrow (Registries .MOB_EFFECT ).listElements ()
207221 .filter (Objects ::nonNull )
208222 .forEach (holder -> layout .addChild ((ResponsiveLayout )
209223 new EffectsObjectPanelWidget (0x88394045 , width , holder .value ()),
210224 PositionType .STATIC .constraint ,
211225 SizeConstraints .builder ().internalHeight ().build ()));
226+ profiler .popPush ("glossary enchantments" );
212227 access .lookupOrThrow (Registries .ENCHANTMENT ).listElements ()
213228 .filter (Objects ::nonNull )
214229 .forEach (enchant -> layout .addChild ((ResponsiveLayout )
215230 new EnchantmentsObjectPanelWidget (0x88394045 , width , enchant .value ()),
216231 PositionType .STATIC .constraint ,
217232 SizeConstraints .builder ().internalHeight ().build ()));
233+ profiler .popPush ("glossary perks" );
218234 Config .perks ().perks ().forEach ((event , configs ) -> layout .addChild ((ResponsiveLayout )
219235 new PerkObjectPanelWidget (0x88394045 , width , event , configs ),
220236 PositionType .STATIC .constraint ,
221237 SizeConstraints .builder ().internalHeight ().build ()));
238+ profiler .pop ();
222239 }
223240}
0 commit comments