2121
2222import com .google .common .collect .Lists ;
2323import com .google .common .collect .Maps ;
24- import com .mojang .blaze3d .systems .RenderSystem ;
2524import com .mojang .blaze3d .vertex .BufferBuilder ;
26- import com .mojang .blaze3d .vertex .Tesselator ;
27- import com .mojang .blaze3d .vertex .VertexConsumer ;
28- import me .shedaniel .clothconfig2 .api .*;
25+ import me .shedaniel .clothconfig2 .api .AbstractConfigEntry ;
26+ import me .shedaniel .clothconfig2 .api .AbstractConfigListEntry ;
27+ import me .shedaniel .clothconfig2 .api .ConfigCategory ;
28+ import me .shedaniel .clothconfig2 .api .Tooltip ;
2929import me .shedaniel .clothconfig2 .api .animator .ValueAnimator ;
3030import me .shedaniel .clothconfig2 .api .scroll .ScrollingContainer ;
3131import me .shedaniel .clothconfig2 .gui .entries .EmptyEntry ;
4040import net .minecraft .client .gui .components .AbstractWidget ;
4141import net .minecraft .client .gui .components .Button ;
4242import net .minecraft .client .gui .screens .Screen ;
43- import net .minecraft .client .renderer .GameRenderer ;
44- import net .minecraft .client .renderer .MultiBufferSource ;
45- import net .minecraft .client .renderer .RenderType ;
43+ import net .minecraft .client .renderer .RenderPipelines ;
4644import net .minecraft .client .resources .language .I18n ;
4745import net .minecraft .network .chat .Component ;
4846import net .minecraft .resources .ResourceLocation ;
@@ -162,7 +160,7 @@ public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float del
162160 childrenL ().add (buttonLeftTab = new Button (4 , 44 , 12 , 18 , Component .empty (), button -> tabsScroller .scrollTo (0 , true ), Supplier ::get ) {
163161 @ Override
164162 public void renderWidget (GuiGraphics graphics , int mouseX , int mouseY , float delta ) {
165- graphics .blit (RenderType :: guiTextured , CONFIG_TEX , getX (), getY (), 12 , 18 * (!this .isActive () ? 0 : this .isHoveredOrFocused () ? 2 : 1 ), width , height , 256 , 256 , ARGB .white (this .alpha ));
163+ graphics .blit (RenderPipelines . GUI_TEXTURED , CONFIG_TEX , getX (), getY (), 12 , 18 * (!this .isActive () ? 0 : this .isHoveredOrFocused () ? 2 : 1 ), width , height , 256 , 256 , ARGB .white (this .alpha ));
166164 }
167165 });
168166 int j = 0 ;
@@ -174,7 +172,7 @@ public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float del
174172 childrenL ().add (buttonRightTab = new Button (width - 16 , 44 , 12 , 18 , Component .empty (), button -> tabsScroller .scrollTo (tabsScroller .getMaxScroll (), true ), Supplier ::get ) {
175173 @ Override
176174 public void renderWidget (GuiGraphics graphics , int mouseX , int mouseY , float delta ) {
177- graphics .blit (RenderType :: guiTextured , CONFIG_TEX , getX (), getY (), 0 , 18 * (!this .isActive () ? 0 : this .isHoveredOrFocused () ? 2 : 1 ), width , height , 256 , 256 , ARGB .white (this .alpha ));
175+ graphics .blit (RenderPipelines . GUI_TEXTURED , CONFIG_TEX , getX (), getY (), 0 , 18 * (!this .isActive () ? 0 : this .isHoveredOrFocused () ? 2 : 1 ), width , height , 256 , 256 , ARGB .white (this .alpha ));
178176 }
179177 });
180178 } else {
@@ -228,7 +226,7 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
228226 if (this .minecraft .level == null ) {
229227 this .renderPanorama (graphics , delta );
230228 }
231- renderBlurredBackground ();
229+ renderBlurredBackground (graphics );
232230 renderMenuBackground (graphics );
233231 }
234232 listWidget .render (graphics , mouseX , mouseY , delta );
@@ -240,10 +238,11 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
240238 graphics .drawCenteredString (minecraft .font , title , width / 2 , 18 , -1 );
241239 Rectangle onlyInnerTabBounds = new Rectangle (tabsBounds .x + 20 , tabsBounds .y , tabsBounds .width - 40 , tabsBounds .height );
242240 graphics .enableScissor (onlyInnerTabBounds .x , onlyInnerTabBounds .y , onlyInnerTabBounds .getMaxX (), onlyInnerTabBounds .getMaxY ());
243- if (isTransparentBackground ())
241+ if (isTransparentBackground ()) {
244242 graphics .fillGradient (onlyInnerTabBounds .x , onlyInnerTabBounds .y , onlyInnerTabBounds .getMaxX (), onlyInnerTabBounds .getMaxY (), 0x68000000 , 0x68000000 );
245- else
246- overlayBackground (graphics , onlyInnerTabBounds , 32 , 32 , 32 , 255 , 255 );
243+ } else {
244+ overlayBackground (graphics , onlyInnerTabBounds , 32 , 32 , 32 , 255 );
245+ }
247246 tabButtons .forEach (widget -> widget .render (graphics , mouseX , mouseY , delta ));
248247 drawTabsShades (graphics , 0 , isTransparentBackground () ? 120 : 255 );
249248 graphics .disableScissor ();
@@ -264,7 +263,7 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
264263 int stringWidth = minecraft .font .width (text );
265264 graphics .fillGradient (8 , 9 , 20 + stringWidth , 14 + minecraft .font .lineHeight , 0x68000000 , 0x68000000 );
266265 }
267- graphics .blit (RenderType :: guiTextured , CONFIG_TEX , 10 , 10 , 0 , 54 , 3 , 11 , 256 , 256 );
266+ graphics .blit (RenderPipelines . GUI_TEXTURED , CONFIG_TEX , 10 , 10 , 0 , 54 , 3 , 11 , 256 , 256 );
268267 graphics .drawString (minecraft .font , text , 18 , 12 , -1 );
269268 if (errors .size () > 1 ) {
270269 int stringWidth = minecraft .font .width (text );
@@ -278,7 +277,7 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
278277 int stringWidth = minecraft .font .width (text );
279278 graphics .fillGradient (8 , 9 , 20 + stringWidth , 14 + minecraft .font .lineHeight , 0x68000000 , 0x68000000 );
280279 }
281- graphics .blit (RenderType :: guiTextured , CONFIG_TEX , 10 , 10 , 0 , 54 , 3 , 11 , 256 , 256 );
280+ graphics .blit (RenderPipelines . GUI_TEXTURED , CONFIG_TEX , 10 , 10 , 0 , 54 , 3 , 11 , 256 , 256 );
282281 graphics .drawString (minecraft .font , text , 18 , 12 , -1 );
283282 }
284283 super .render (graphics , mouseX , mouseY , delta );
@@ -289,21 +288,8 @@ public void renderBackground(GuiGraphics guiGraphics, int i, int j, float f) {
289288 }
290289
291290 private void drawTabsShades (GuiGraphics graphics , int lightColor , int darkColor ) {
292- graphics .drawSpecial (source -> {
293- drawTabsShades (source , graphics .pose ().last ().pose (), lightColor , darkColor );
294- });
295- }
296-
297- private void drawTabsShades (MultiBufferSource source , Matrix4f matrix , int lightColor , int darkColor ) {
298- VertexConsumer buffer = source .getBuffer (RenderType .gui ());
299- buffer .addVertex (matrix , tabsBounds .getMinX () + 20 , tabsBounds .getMinY () + 4 , 0.0F ).setUv (0 , 1f ).setColor (0 , 0 , 0 , lightColor );
300- buffer .addVertex (matrix , tabsBounds .getMaxX () - 20 , tabsBounds .getMinY () + 4 , 0.0F ).setUv (1f , 1f ).setColor (0 , 0 , 0 , lightColor );
301- buffer .addVertex (matrix , tabsBounds .getMaxX () - 20 , tabsBounds .getMinY (), 0.0F ).setUv (1f , 0 ).setColor (0 , 0 , 0 , darkColor );
302- buffer .addVertex (matrix , tabsBounds .getMinX () + 20 , tabsBounds .getMinY (), 0.0F ).setUv (0 , 0 ).setColor (0 , 0 , 0 , darkColor );
303- buffer .addVertex (matrix , tabsBounds .getMinX () + 20 , tabsBounds .getMaxY (), 0.0F ).setUv (0 , 1f ).setColor (0 , 0 , 0 , darkColor );
304- buffer .addVertex (matrix , tabsBounds .getMaxX () - 20 , tabsBounds .getMaxY (), 0.0F ).setUv (1f , 1f ).setColor (0 , 0 , 0 , darkColor );
305- buffer .addVertex (matrix , tabsBounds .getMaxX () - 20 , tabsBounds .getMaxY () - 4 , 0.0F ).setUv (1f , 0 ).setColor (0 , 0 , 0 , lightColor );
306- buffer .addVertex (matrix , tabsBounds .getMinX () + 20 , tabsBounds .getMaxY () - 4 , 0.0F ).setUv (0 , 0 ).setColor (0 , 0 , 0 , lightColor );
291+ graphics .blit (RenderPipelines .GUI_TEXTURED , Screen .HEADER_SEPARATOR , tabsBounds .getMinX () - 20 , tabsBounds .getMinY () - 2 , 0.0F , 0.0F , tabsBounds .getWidth () + 40 , 2 , 32 , 2 );
292+ graphics .blit (RenderPipelines .GUI_TEXTURED , Screen .FOOTER_SEPARATOR , tabsBounds .getMinX () - 20 , tabsBounds .getMaxY (), 0.0F , 0.0F , tabsBounds .getWidth () + 40 , 2 , 32 , 2 );
307293 }
308294
309295 @ Override
0 commit comments