@@ -61,7 +61,7 @@ private DetailsPanel(Level addon, World world, User user) {
6161 this .levelsData = null ;
6262 }
6363
64- // By default no-filters are active.
64+ // Default Filters
6565 this .activeTab = Tab .VALUE_BLOCKS ;
6666 this .activeFilter = Filter .NAME ;
6767 this .materialCountList = new ArrayList <>(Material .values ().length );
@@ -139,12 +139,12 @@ private void updateFilters() {
139139 }
140140 // Remove any hidden blocks
141141 materialCountMap .keySet ().removeIf (this .addon .getBlockConfig ()::isHiddenBlock );
142-
143142 // Remove any zero amount items
144143 materialCountMap .values ().removeIf (i -> i < 1 );
145144
146145 if (this .activeTab == Tab .VALUE_BLOCKS ) {
147146 // Remove zero-value blocks
147+ // TODO BUG IS HERE - ALL REMOVED
148148 materialCountMap .entrySet ().removeIf (en -> Optional
149149 .ofNullable (this .addon .getBlockConfig ().getValue (world , en .getKey ())).orElse (0 ) == 0 );
150150 }
@@ -155,7 +155,7 @@ private void updateFilters() {
155155 .collect (Collectors .toList ()));
156156
157157 }
158-
158+ // Sort and filter
159159 Comparator <Pair <Object , Integer >> sorter ;
160160
161161 switch (this .activeFilter ) {
@@ -205,7 +205,6 @@ private void updateFilters() {
205205 }
206206
207207 this .materialCountList .sort (sorter );
208-
209208 this .pageIndex = 0 ;
210209 }
211210
@@ -519,7 +518,7 @@ private PanelItem createPreviousButton(ItemTemplateRecord template, TemplatedPan
519518 */
520519 private PanelItem createMaterialButton (ItemTemplateRecord template , TemplatedPanel .ItemSlot slot ) {
521520 if (this .materialCountList .isEmpty ()) {
522- // Does not contain any generators.
521+ // Nothing to show
523522 return null ;
524523 }
525524
@@ -546,45 +545,49 @@ private PanelItem createMaterialButton(ItemTemplateRecord template, Pair<Object,
546545 if (template .icon () != null ) {
547546 builder .icon (template .icon ().clone ());
548547 }
549- // Show amount, if < 64
548+ // Show amount if less than 64.
550549 if (materialCount .getValue () < 64 ) {
551550 builder .amount (materialCount .getValue ());
552551 }
553552
554553 final String reference = "level.gui.buttons.material." ;
555- String description = "" ;
554+ Object key = materialCount .getKey ();
555+ String description = Utils .prettifyDescription (key , this .user );
556556 String blockId = "" ;
557- Object key = materialCount .getKey (); // Can be a Material or EntityType
557+ int blockValue = 0 ;
558+ int blockLimit = 0 ;
559+ String value = "" ;
560+ String limit = "" ;
561+ String displayMaterial = Utils .prettifyObject (key , this .user );
562+
558563 if (key instanceof Material m ) {
564+ // Material-specific settings.
559565 builder .icon (PanelUtils .getMaterialItem (m ));
560- if (template .title () != null ) {
561- builder .name (this .user .getTranslation (this .world , template .title (), TextVariables .NUMBER ,
562- String .valueOf (materialCount .getValue ()), "[material]" , Utils .prettifyObject (m , this .user )));
563- }
564- description = Utils .prettifyDescription (m , this .user );
565566 blockId = this .user .getTranslationOrNothing (reference + "id" , "[id]" , m .name ());
566-
567+ blockValue = this .addon .getBlockConfig ().getBlockValues ().getOrDefault (m , 0 );
568+ blockLimit = this .addon .getBlockConfig ().getBlockLimits ().getOrDefault (m , 0 );
567569 } else if (key instanceof EntityType e ) {
570+ // EntityType-specific settings.
568571 builder .icon (PanelUtils .getEntityEgg (e ));
569- if (template .title () != null ) {
570- builder .name (this .user .getTranslation (this .world , template .title (), TextVariables .NUMBER ,
571- String .valueOf (materialCount .getValue ()), "[material]" , Utils .prettifyObject (e , this .user )));
572- }
573- description = Utils .prettifyDescription (e , this .user );
574- blockId = this .user .getTranslationOrNothing (reference + "id" , "[id]" , e .name ());
572+ description += this .user .getTranslation (this .world , "level.gui.buttons.spawner.block-name" ); // Put spawner on the end
573+ blockId = this .user .getTranslationOrNothing (reference + "id" , "[id]" , e .name () + "_SPAWNER" );
574+ blockValue = this .addon .getBlockConfig ().getSpawnerValues ().getOrDefault (e , 0 );
575+ blockLimit = this .addon .getBlockConfig ().getBlockLimits ().getOrDefault (Material .SPAWNER , 0 );
576+ }
577+
578+ if (template .title () != null ) {
579+ builder .name (this .user .getTranslation (this .world , template .title (), TextVariables .NUMBER ,
580+ String .valueOf (materialCount .getValue ()), "[material]" , displayMaterial ));
575581 }
576582
577- int blockValue = this .addon .getBlockConfig ().getBlockValues ().getOrDefault (key , 0 );
578- String value = blockValue > 0
583+ value = blockValue > 0
579584 ? this .user .getTranslationOrNothing (reference + "value" , TextVariables .NUMBER ,
580585 String .valueOf (blockValue ))
581- : "" ;
582-
583- int blockLimit = this .addon .getBlockConfig ().getBlockLimits ().getOrDefault (key , 0 );
584- String limit = blockLimit > 0
586+ : "" ;
587+ limit = blockLimit > 0
585588 ? this .user .getTranslationOrNothing (reference + "limit" , TextVariables .NUMBER ,
586589 String .valueOf (blockLimit ))
587- : "" ;
590+ : "" ;
588591
589592 String count = this .user .getTranslationOrNothing (reference + "count" , TextVariables .NUMBER ,
590593 String .valueOf (materialCount .getValue ()));
@@ -594,6 +597,10 @@ private PanelItem createMaterialButton(ItemTemplateRecord template, Pair<Object,
594597 String valueText = calculatedValue > 0 ? this .user .getTranslationOrNothing (reference + "calculated" ,
595598 TextVariables .NUMBER , String .valueOf (calculatedValue )) : "" ;
596599
600+ // Hide block ID unless user is an operator.
601+ if (!user .isOp ()) {
602+ blockId = "" ;
603+ }
597604 if (template .description () != null ) {
598605 builder .description (this .user
599606 .getTranslation (this .world , template .description (), "[description]" , description , "[id]" , blockId ,
0 commit comments