Skip to content

Commit b268852

Browse files
committed
Update to 1.21.6
1 parent b86863d commit b268852

22 files changed

+96
-159
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ on:
2525
- v16
2626
- v17
2727
- v18
28+
- v19
2829

2930
jobs:
3031
build:

common/src/main/java/me/shedaniel/clothconfig2/api/AbstractConfigListEntry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void setEditable(boolean editable) {
5656
}
5757

5858
public final int getPreferredTextColor() {
59-
return getConfigError().isPresent() ? 16733525 : 16777215;
59+
return getConfigError().isPresent() ? 0xffff5555 : 0xffffffff;
6060
}
6161

6262
public Rectangle getEntryArea(int x, int y, int entryWidth, int entryHeight) {

common/src/main/java/me/shedaniel/clothconfig2/api/ScrollingContainer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import me.shedaniel.clothconfig2.impl.EasingMethod;
3030
import me.shedaniel.math.Rectangle;
3131
import net.minecraft.client.gui.GuiGraphics;
32-
import net.minecraft.client.renderer.RenderType;
32+
import net.minecraft.client.renderer.RenderPipelines;
3333
import net.minecraft.util.ARGB;
3434
import net.minecraft.util.Mth;
3535

@@ -144,8 +144,8 @@ public void renderScrollBar(GuiGraphics graphics, int background, float alpha, f
144144
int minY = Math.min(Math.max((int) scrollAmount * (bounds.height - height) / maxScroll + bounds.y, bounds.y), bounds.getMaxY() - height);
145145

146146
int scrollbarPositionMinX = getScrollBarX();
147-
graphics.blitSprite(RenderType::guiTextured, SCROLLER_BACKGROUND_SPRITE, scrollbarPositionMinX, bounds.y, 6, bounds.height, background);
148-
graphics.blitSprite(RenderType::guiTextured, SCROLLER_SPRITE, scrollbarPositionMinX, minY, 6, height, ARGB.white(alpha));
147+
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, SCROLLER_BACKGROUND_SPRITE, scrollbarPositionMinX, bounds.y, 6, bounds.height, background);
148+
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, SCROLLER_SPRITE, scrollbarPositionMinX, minY, 6, height, ARGB.white(alpha));
149149
}
150150
}
151151

common/src/main/java/me/shedaniel/clothconfig2/api/scroll/ScrollingContainer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import me.shedaniel.clothconfig2.gui.widget.DynamicEntryListWidget;
3131
import me.shedaniel.math.Rectangle;
3232
import net.minecraft.client.gui.GuiGraphics;
33-
import net.minecraft.client.renderer.RenderType;
33+
import net.minecraft.client.renderer.RenderPipelines;
3434
import net.minecraft.resources.ResourceLocation;
3535
import net.minecraft.util.ARGB;
3636
import net.minecraft.util.Mth;
@@ -158,8 +158,8 @@ public void renderScrollBar(GuiGraphics graphics, int background, float alpha) {
158158
int minY = Math.min(Math.max((int) scrollAmount() * (bounds.height - height) / maxScroll + bounds.y, bounds.y), bounds.getMaxY() - height);
159159

160160
int scrollbarPositionMinX = getScrollBarX(bounds.getMaxX());
161-
graphics.blitSprite(RenderType::guiTextured, SCROLLER_BACKGROUND_SPRITE, scrollbarPositionMinX, bounds.y, 6, bounds.height, background);
162-
graphics.blitSprite(RenderType::guiTextured, SCROLLER_SPRITE, scrollbarPositionMinX, minY, 6, height, ARGB.white(alpha));
161+
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, SCROLLER_BACKGROUND_SPRITE, scrollbarPositionMinX, bounds.y, 6, bounds.height, background);
162+
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, SCROLLER_SPRITE, scrollbarPositionMinX, minY, 6, height, ARGB.white(alpha));
163163
}
164164
}
165165

common/src/main/java/me/shedaniel/clothconfig2/gui/AbstractConfigScreen.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121

2222
import com.google.common.collect.Lists;
2323
import com.mojang.blaze3d.platform.InputConstants;
24-
import com.mojang.blaze3d.vertex.VertexConsumer;
2524
import it.unimi.dsi.fastutil.booleans.BooleanConsumer;
2625
import me.shedaniel.clothconfig2.api.*;
2726
import me.shedaniel.clothconfig2.gui.entries.KeyCodeEntry;
27+
import me.shedaniel.math.Color;
2828
import me.shedaniel.math.Rectangle;
2929
import net.minecraft.Util;
3030
import net.minecraft.client.Minecraft;
@@ -34,14 +34,13 @@
3434
import net.minecraft.client.gui.screens.ConfirmLinkScreen;
3535
import net.minecraft.client.gui.screens.ConfirmScreen;
3636
import net.minecraft.client.gui.screens.Screen;
37-
import net.minecraft.client.renderer.RenderType;
37+
import net.minecraft.client.renderer.RenderPipelines;
3838
import net.minecraft.network.chat.ClickEvent;
3939
import net.minecraft.network.chat.Component;
4040
import net.minecraft.network.chat.Style;
4141
import net.minecraft.resources.ResourceLocation;
4242
import org.jetbrains.annotations.ApiStatus;
4343
import org.jetbrains.annotations.Nullable;
44-
import org.joml.Matrix4f;
4544

4645
import java.net.URI;
4746
import java.util.List;
@@ -352,7 +351,7 @@ protected AbstractWidget getQuitButton() {
352351
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
353352
super.render(graphics, mouseX, mouseY, delta);
354353
for (Tooltip tooltip : tooltips) {
355-
graphics.renderTooltip(Minecraft.getInstance().font, tooltip.getText(), tooltip.getX(), tooltip.getY());
354+
graphics.setTooltipForNextFrame(Minecraft.getInstance().font, tooltip.getText(), tooltip.getX(), tooltip.getY());
356355
}
357356
this.tooltips.clear();
358357
}
@@ -363,15 +362,8 @@ public void addTooltip(Tooltip tooltip) {
363362
}
364363

365364
@Deprecated
366-
protected void overlayBackground(GuiGraphics graphics, Rectangle rect, int red, int green, int blue, int startAlpha, int endAlpha) {
367-
graphics.drawSpecial(source -> {
368-
VertexConsumer buffer = source.getBuffer(RenderType.guiTextured(getBackgroundLocation()));
369-
Matrix4f matrix = graphics.pose().last().pose();
370-
buffer.addVertex(matrix, rect.getMinX(), rect.getMaxY(), 0.0F).setUv(rect.getMinX() / 32.0F, rect.getMaxY() / 32.0F).setColor(red, green, blue, endAlpha);
371-
buffer.addVertex(matrix, rect.getMaxX(), rect.getMaxY(), 0.0F).setUv(rect.getMaxX() / 32.0F, rect.getMaxY() / 32.0F).setColor(red, green, blue, endAlpha);
372-
buffer.addVertex(matrix, rect.getMaxX(), rect.getMinY(), 0.0F).setUv(rect.getMaxX() / 32.0F, rect.getMinY() / 32.0F).setColor(red, green, blue, startAlpha);
373-
buffer.addVertex(matrix, rect.getMinX(), rect.getMinY(), 0.0F).setUv(rect.getMinX() / 32.0F, rect.getMinY() / 32.0F).setColor(red, green, blue, startAlpha);
374-
});
365+
protected void overlayBackground(GuiGraphics graphics, Rectangle rect, int red, int green, int blue, int alpha) {
366+
graphics.blit(RenderPipelines.GUI_TEXTURED, getBackgroundLocation(), rect.getMinX(), rect.getMinY(), rect.getMaxX(), rect.getMaxY(), rect.getWidth(), rect.getHeight(), rect.getWidth(), rect.getHeight(), 32, 32, Color.ofRGBA(red, green, blue, alpha).getColor());
375367
}
376368

377369
@Override

common/src/main/java/me/shedaniel/clothconfig2/gui/ClothConfigScreen.java

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121

2222
import com.google.common.collect.Lists;
2323
import com.google.common.collect.Maps;
24-
import com.mojang.blaze3d.systems.RenderSystem;
2524
import 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;
2929
import me.shedaniel.clothconfig2.api.animator.ValueAnimator;
3030
import me.shedaniel.clothconfig2.api.scroll.ScrollingContainer;
3131
import me.shedaniel.clothconfig2.gui.entries.EmptyEntry;
@@ -40,9 +40,7 @@
4040
import net.minecraft.client.gui.components.AbstractWidget;
4141
import net.minecraft.client.gui.components.Button;
4242
import 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;
4644
import net.minecraft.client.resources.language.I18n;
4745
import net.minecraft.network.chat.Component;
4846
import 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

Comments
 (0)