@@ -13,13 +13,11 @@ public class StructureSearchList extends ObjectSelectionList<StructureSearchEntr
1313
1414 private final ExplorersCompassScreen parentScreen ;
1515 private Player player ;
16- private int itemHeight ;
1716
1817 public StructureSearchList (ExplorersCompassScreen parentScreen , Minecraft mc , Player player , int width , int height , int y , int itemHeight ) {
1918 super (mc , width , height , y , itemHeight );
2019 this .parentScreen = parentScreen ;
2120 this .player = player ;
22- this .itemHeight = itemHeight ;
2321 refreshList ();
2422 }
2523
@@ -34,19 +32,33 @@ public int getRowWidth() {
3432 }
3533
3634 @ Override
37- public void renderWidget (GuiGraphics guiGraphics , int mouseX , int mouseY , float partialTicks ) {
38- enableScissor (guiGraphics );
35+ public void renderWidget (GuiGraphics guiGraphics , int mouseX , int mouseY , float partialTicks ) {
36+ enableScissor (guiGraphics );
37+ renderListBackground (guiGraphics );
38+ renderListItems (guiGraphics , mouseX , mouseY , partialTicks );
39+ guiGraphics .disableScissor ();
40+ renderScrollbar (guiGraphics , mouseX , mouseY );
41+ }
42+
43+ @ Override
44+ protected void renderListBackground (GuiGraphics guiGraphics ) {
3945 for (int i = 0 ; i < getItemCount (); ++i ) {
4046 if (getRowBottom (i ) >= getY () && getRowTop (i ) <= getBottom ()) {
4147 StructureSearchEntry entry = children ().get (i );
4248 int fillColor = RenderUtils .getBackgroundColor (entry .isEnabled (), entry == getSelected ());
43- guiGraphics .fill (getRowLeft (), getRowTop (i ), getRowLeft () + getRowWidth (), getRowTop (i ) + itemHeight , fillColor );
44- entry .renderContent (guiGraphics , mouseX , mouseY , entry == getHovered (), partialTicks );
49+ guiGraphics .fill (getRowLeft (), getRowTop (i ), getRowLeft () + getRowWidth (), getRowTop (i ) + defaultEntryHeight , fillColor );
4550 }
4651 }
47- guiGraphics .disableScissor ();
48-
49- if (maxScrollAmount () > 0 ) {
52+ }
53+
54+ @ Override
55+ protected void renderSelection (GuiGraphics guiGraphics , StructureSearchEntry entry , int backgroundColor ) {
56+ // Selection is rendered in renderListBackground()
57+ }
58+
59+ @ Override
60+ protected void renderScrollbar (GuiGraphics guiGraphics , int mouseX , int mouseY ) {
61+ if (scrollbarVisible ()) {
5062 int left = scrollBarX ();
5163 int right = left + 6 ;
5264 int height = (int ) ((float ) ((getBottom () - getY ()) * (getBottom () - getY ())) / (float ) contentHeight ());
@@ -55,22 +67,14 @@ public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float
5567 if (top < getY ()) {
5668 top = getY ();
5769 }
58-
59- guiGraphics .fill (left , getY (), right , getBottom (), (int ) (2.35F * 255.0F ) / 2 << 24 );
60- guiGraphics .fill (left , top , right , top + height , (int ) (1.9F * 255.0F ) / 2 << 24 );
70+
71+ int backgroundFillColor = RenderUtils .getBackgroundColor (false , false );
72+ int scrollbarFillColor = RenderUtils .getBackgroundColor (true , true );
73+ guiGraphics .fill (left , getY (), right , getBottom (), backgroundFillColor );
74+ guiGraphics .fill (left , top , right , top + height , scrollbarFillColor );
6175 }
6276 }
6377
64- @ Override
65- protected void enableScissor (GuiGraphics guiGraphics ) {
66- guiGraphics .enableScissor (getX (), getY (), getRight (), getBottom ());
67- }
68-
69- @ Override
70- public int getRowBottom (int index ) {
71- return getRowTop (index ) + itemHeight ;
72- }
73-
7478 public void refreshList () {
7579 clearEntries ();
7680 for (Identifier structureId : parentScreen .sortStructures ()) {
0 commit comments