Skip to content

Commit 3ef43ba

Browse files
committed
Update to mc1.21.3
1 parent 5caf126 commit 3ef43ba

File tree

10 files changed

+94
-59
lines changed

10 files changed

+94
-59
lines changed

common/build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,24 @@ plugins {
33
id("net.neoforged.moddev")
44
}
55

6+
// Vanilla depends on ASM 9.3, MDG makes that a 'strict' version constraint,
7+
// but Mixin and MixinExtras needs newer ASM so we override that here.
8+
configurations.configureEach {
9+
resolutionStrategy.eachDependency { details ->
10+
if (details.requested.group == "org.ow2.asm") {
11+
details.useVersion(asm_version)
12+
details.because("Mixin requires new ASM")
13+
}
14+
}
15+
}
16+
617
dependencies {
18+
compileOnly "org.ow2.asm:asm:${asm_version}"
19+
compileOnly "org.ow2.asm:asm-analysis:${asm_version}"
20+
compileOnly "org.ow2.asm:asm-commons:${asm_version}"
21+
compileOnly "org.ow2.asm:asm-tree:${asm_version}"
22+
compileOnly "org.ow2.asm:asm-util:${asm_version}"
23+
724
// Mixin and MixinExtras
825
compileOnly("org.spongepowered:mixin:${mixin_version}")
926
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinextras_version}"))

common/src/main/java/dev/terminalmc/chatnotify/ChatNotify.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static void onEndTick(Minecraft mc) {
8383
// Config reset warning toast
8484
if (hasResetConfig && mc.screen instanceof TitleScreen) {
8585
hasResetConfig = false;
86-
mc.getToasts().addToast(new SystemToast(new SystemToast.SystemToastId(15000L),
86+
mc.getToastManager().addToast(new SystemToast(new SystemToast.SystemToastId(15000L),
8787
localized("toast", "reset.title"), localized("toast", "reset.message",
8888
Component.literal(Config.UNREADABLE_FILE_NAME).withStyle(ChatFormatting.GOLD))));
8989
}

common/src/main/java/dev/terminalmc/chatnotify/gui/toast/NotificationToast.java

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
import net.minecraft.client.gui.Font;
2121
import net.minecraft.client.gui.GuiGraphics;
2222
import net.minecraft.client.gui.components.toasts.Toast;
23-
import net.minecraft.client.gui.components.toasts.ToastComponent;
23+
import net.minecraft.client.gui.components.toasts.ToastManager;
24+
import net.minecraft.client.renderer.RenderType;
2425
import net.minecraft.network.chat.Component;
2526
import net.minecraft.resources.ResourceLocation;
2627
import net.minecraft.util.FormattedCharSequence;
@@ -40,19 +41,30 @@ public class NotificationToast implements Toast {
4041

4142
private final int lineHeight;
4243
private final List<FormattedCharSequence> messageLines;
44+
private Toast.Visibility wantedVisibility;
4345

4446
public NotificationToast(Component message) {
4547
this.messageLines = Minecraft.getInstance().font.split(message, WIDTH - X_MARGIN * 2);
4648
this.lineHeight = Minecraft.getInstance().font.lineHeight + LINE_SPACE;
4749
}
4850

4951
@Override
50-
public @NotNull Visibility render(@NotNull GuiGraphics graphics,
51-
@NotNull ToastComponent component, long elapsedTime) {
52-
Font font = component.getMinecraft().font;
52+
public @NotNull Visibility getWantedVisibility() {
53+
return wantedVisibility;
54+
}
55+
56+
@Override
57+
public void update(@NotNull ToastManager manager, long elapsedTime) {
58+
this.wantedVisibility =
59+
elapsedTime < DISPLAY_TIME * manager.getNotificationDisplayTimeMultiplier()
60+
? Visibility.SHOW : Visibility.HIDE;
61+
}
62+
63+
@Override
64+
public void render(@NotNull GuiGraphics graphics, @NotNull Font font, long elapsedTime) {
5365
if (messageLines.size() <= 1) {
5466
// Message fits in a single line, render a single sprite
55-
graphics.blitSprite(BACKGROUND_SPRITE, 0, 0, WIDTH, height());
67+
graphics.blitSprite(RenderType::guiTextured, BACKGROUND_SPRITE, 0, 0, WIDTH, height());
5668
} else {
5769
// Message requires multiple lines, stretch vertically by rendering
5870
// multiple sprites
@@ -88,9 +100,6 @@ public NotificationToast(Component message) {
88100
X_MARGIN, Y_MARGIN + lineHeight * j, -1, false);
89101
}
90102
}
91-
92-
return elapsedTime < DISPLAY_TIME * component.getNotificationDisplayTimeMultiplier()
93-
? Visibility.SHOW : Visibility.HIDE;
94103
}
95104

96105
private void renderBackgroundRow(GuiGraphics graphics, int width, int vOffset,
@@ -99,18 +108,18 @@ private void renderBackgroundRow(GuiGraphics graphics, int width, int vOffset,
99108
int uRemainder = Math.min(60, width - uWidth);
100109

101110
// Left border
102-
graphics.blitSprite(BACKGROUND_SPRITE, WIDTH, HEIGHT, 0, vOffset,
103-
0, y, uWidth, vHeight);
111+
graphics.blitSprite(RenderType::guiTextured, BACKGROUND_SPRITE, WIDTH, HEIGHT,
112+
0, vOffset, 0, y, uWidth, vHeight);
104113

105114
// Middle background
106115
int offset = 64;
107116
for (int x = uWidth; x < width - uRemainder; x += offset) {
108-
graphics.blitSprite(BACKGROUND_SPRITE, WIDTH, HEIGHT, HEIGHT, vOffset,
109-
x, y, Math.min(offset, width - x - uRemainder), vHeight);
117+
graphics.blitSprite(RenderType::guiTextured, BACKGROUND_SPRITE, WIDTH, HEIGHT,
118+
HEIGHT, vOffset, x, y, Math.min(offset, width - x - uRemainder), vHeight);
110119
}
111120

112121
// Right border
113-
graphics.blitSprite(BACKGROUND_SPRITE, WIDTH, HEIGHT, WIDTH - uRemainder, vOffset,
114-
width - uRemainder, y, uRemainder, vHeight);
122+
graphics.blitSprite(RenderType::guiTextured, BACKGROUND_SPRITE, WIDTH, HEIGHT,
123+
WIDTH - uRemainder, vOffset, width - uRemainder, y, uRemainder, vHeight);
115124
}
116125
}

common/src/main/java/dev/terminalmc/chatnotify/gui/widget/HorizontalList.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import net.minecraft.client.gui.narration.NarratedElementType;
2828
import net.minecraft.client.gui.narration.NarrationElementOutput;
2929
import net.minecraft.client.gui.screens.Screen;
30+
import net.minecraft.client.renderer.RenderType;
3031
import net.minecraft.network.chat.Component;
3132
import net.minecraft.resources.ResourceLocation;
3233
import net.minecraft.util.Mth;
@@ -223,7 +224,7 @@ protected void renderWidget(@NotNull GuiGraphics graphics, int mouseX, int mouse
223224
*/
224225
protected void renderListBackground(GuiGraphics graphics) {
225226
RenderSystem.enableBlend();
226-
graphics.blit(MENU_LIST_BACKGROUND, getX(), getY(), 0, 0,
227+
graphics.blit(RenderType::guiTextured, MENU_LIST_BACKGROUND, getX(), getY(), 0, 0,
227228
getWidth(), getHeight(), 32, 32);
228229
RenderSystem.disableBlend();
229230
}
@@ -273,8 +274,10 @@ protected void renderScrollbar(GuiGraphics graphics) {
273274
+ getX());
274275

275276
RenderSystem.enableBlend();
276-
graphics.blitSprite(SCROLLER_BACKGROUND_SPRITE, getX(), y, getWidth(), SCROLLBAR_HEIGHT);
277-
graphics.blitSprite(SCROLLER_SPRITE, scrollerPos, y, scrollerWidth, SCROLLBAR_HEIGHT);
277+
graphics.blitSprite(RenderType::guiTextured, SCROLLER_BACKGROUND_SPRITE,
278+
getX(), y, getWidth(), SCROLLBAR_HEIGHT);
279+
graphics.blitSprite(RenderType::guiTextured, SCROLLER_SPRITE,
280+
scrollerPos, y, scrollerWidth, SCROLLBAR_HEIGHT);
278281
RenderSystem.disableBlend();
279282
}
280283
}
@@ -291,10 +294,14 @@ protected boolean scrollbarVisible() {
291294
*/
292295
protected void renderSeparators(GuiGraphics guiGraphics) {
293296
RenderSystem.enableBlend();
294-
guiGraphics.blit(LEFT_SEPARATOR, getX() - 2, getY() - 1, 0.0F, 0.0F, 2, getHeight() + 2, 2, 32);
295-
guiGraphics.blit(RIGHT_SEPARATOR, getRight(), getY() - 1, 0.0F, 0.0F, 2, getHeight() + 2, 2, 32);
296-
guiGraphics.blit(Screen.HEADER_SEPARATOR, getX() - 1, getY() - 2, 0.0F, 0.0F, getWidth() + 2, 2, 32, 2);
297-
guiGraphics.blit(Screen.FOOTER_SEPARATOR, getX() - 1, getBottom(), 0.0F, 0.0F, getWidth() + 2, 2, 32, 2);
297+
guiGraphics.blit(RenderType::guiTextured, LEFT_SEPARATOR,
298+
getX() - 2, getY() - 1, 0.0F, 0.0F, 2, getHeight() + 2, 2, 32);
299+
guiGraphics.blit(RenderType::guiTextured, RIGHT_SEPARATOR,
300+
getRight(), getY() - 1, 0.0F, 0.0F, 2, getHeight() + 2, 2, 32);
301+
guiGraphics.blit(RenderType::guiTextured, Screen.HEADER_SEPARATOR,
302+
getX() - 1, getY() - 2, 0.0F, 0.0F, getWidth() + 2, 2, 32, 2);
303+
guiGraphics.blit(RenderType::guiTextured, Screen.FOOTER_SEPARATOR,
304+
getX() - 1, getBottom(), 0.0F, 0.0F, getWidth() + 2, 2, 32, 2);
298305
RenderSystem.disableBlend();
299306
}
300307

common/src/main/java/dev/terminalmc/chatnotify/gui/widget/HsvColorPicker.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
import net.minecraft.client.gui.GuiGraphics;
2828
import net.minecraft.client.gui.components.AbstractWidget;
2929
import net.minecraft.client.gui.components.Button;
30-
import net.minecraft.client.renderer.GameRenderer;
30+
import net.minecraft.client.renderer.CoreShaders;
3131
import net.minecraft.network.chat.CommonComponents;
3232
import net.minecraft.network.chat.Component;
3333
import net.minecraft.network.chat.TextColor;
34-
import net.minecraft.util.FastColor;
34+
import net.minecraft.util.ARGB;
3535
import net.minecraft.util.Mth;
3636
import org.jetbrains.annotations.NotNull;
3737

@@ -223,8 +223,8 @@ public int getMaxHeight() {
223223

224224
public void updateColorFromSource() {
225225
int color = source.get();
226-
Color.RGBtoHSB(FastColor.ARGB32.red(color), FastColor.ARGB32.green(color),
227-
FastColor.ARGB32.blue(color), hsv);
226+
Color.RGBtoHSB(ARGB.red(color), ARGB.green(color),
227+
ARGB.blue(color), hsv);
228228
oldColor = color;
229229
if (hexField != null) {
230230
hexField.setValue(TextColor.fromRgb(color).formatValue());
@@ -243,8 +243,8 @@ private void updateColorFromHexField(String s) {
243243
if (textColor != null) {
244244
int color = textColor.getValue();
245245
if (!updateFromCursor) {
246-
Color.RGBtoHSB(FastColor.ARGB32.red(color), FastColor.ARGB32.green(color),
247-
FastColor.ARGB32.blue(color), hsv);
246+
Color.RGBtoHSB(ARGB.red(color), ARGB.green(color),
247+
ARGB.blue(color), hsv);
248248
updateHCursor();
249249
updateSvCursor();
250250
}
@@ -401,7 +401,7 @@ protected void renderWidget(@NotNull GuiGraphics graphics, int mouseX, int mouse
401401

402402
private void drawQuads(GuiGraphics graphics) {
403403
// Setup
404-
RenderSystem.setShader(GameRenderer::getPositionColorShader);
404+
RenderSystem.setShader(CoreShaders.POSITION_COLOR);
405405
RenderSystem.depthFunc(GlConst.GL_ALWAYS);
406406
RenderSystem.depthMask(false);
407407
RenderSystem.enableBlend();
@@ -546,9 +546,9 @@ private void drawQuads(GuiGraphics graphics) {
546546

547547
// New color
548548
int color = Mth.hsvToRgb(hsv[0], hsv[1], hsv[2]);
549-
int colorR = FastColor.ARGB32.red(color);
550-
int colorG = FastColor.ARGB32.green(color);
551-
int colorB = FastColor.ARGB32.blue(color);
549+
int colorR = ARGB.red(color);
550+
int colorG = ARGB.green(color);
551+
int colorB = ARGB.blue(color);
552552
builder.addVertex(x+newCFieldX, y+newCFieldY, 0F).setColor(colorR, colorG, colorB, 255);
553553
builder.addVertex(x+newCFieldX, y+newCFieldY+newCFieldHeight, 0F).setColor(colorR, colorG, colorB, 255);
554554
builder.addVertex(x+newCFieldX+newCFieldWidth, y+newCFieldY+newCFieldHeight, 0F).setColor(colorR, colorG, colorB, 255);
@@ -561,9 +561,9 @@ private void drawQuads(GuiGraphics graphics) {
561561
builder.addVertex(x+oldCFieldX+oldCFieldWidth+OUTLINE, y+oldCFieldY-OUTLINE, 0F).setColor(GUI_LIGHT, GUI_LIGHT, GUI_LIGHT, 255);
562562

563563
// Old color
564-
colorR = FastColor.ARGB32.red(oldColor);
565-
colorG = FastColor.ARGB32.green(oldColor);
566-
colorB = FastColor.ARGB32.blue(oldColor);
564+
colorR = ARGB.red(oldColor);
565+
colorG = ARGB.green(oldColor);
566+
colorB = ARGB.blue(oldColor);
567567
builder.addVertex(x+oldCFieldX, y+oldCFieldY, 0F).setColor(colorR, colorG, colorB, 255);
568568
builder.addVertex(x+oldCFieldX, y+oldCFieldY+oldCFieldHeight, 0F).setColor(colorR, colorG, colorB, 255);
569569
builder.addVertex(x+oldCFieldX+oldCFieldWidth, y+oldCFieldY+oldCFieldHeight, 0F).setColor(colorR, colorG, colorB, 255);

common/src/main/java/dev/terminalmc/chatnotify/gui/widget/list/FilterList.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import net.minecraft.network.chat.Component;
4040
import net.minecraft.network.chat.MutableComponent;
4141
import net.minecraft.network.chat.TextColor;
42-
import net.minecraft.util.FastColor;
42+
import net.minecraft.util.ARGB;
4343
import net.minecraft.util.StringUtil;
4444
import org.jetbrains.annotations.Nullable;
4545

@@ -825,9 +825,9 @@ public NotifOptions(
825825
int color = textColor.getValue();
826826
notif.textStyle.color = color;
827827
float[] hsv = new float[3];
828-
Color.RGBtoHSB(FastColor.ARGB32.red(color),
829-
FastColor.ARGB32.green(color),
830-
FastColor.ARGB32.blue(color), hsv);
828+
Color.RGBtoHSB(ARGB.red(color),
829+
ARGB.green(color),
830+
ARGB.blue(color), hsv);
831831
if (hsv[2] < 0.1) colorField.setTextColor(0xFFFFFF);
832832
else colorField.setTextColor(color);
833833
// Update status button color

common/src/main/java/dev/terminalmc/chatnotify/gui/widget/list/root/DefaultList.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import net.minecraft.network.chat.Style;
3333
import net.minecraft.network.chat.TextColor;
3434
import net.minecraft.resources.ResourceLocation;
35-
import net.minecraft.util.FastColor;
35+
import net.minecraft.util.ARGB;
3636

3737
import java.awt.*;
3838

@@ -104,8 +104,8 @@ private static class DefaultColor extends Entry {
104104
mainButton.setMessage(localized("option", "default.color")
105105
.setStyle(Style.EMPTY.withColor(textColor)));
106106
float[] hsv = new float[3];
107-
Color.RGBtoHSB(FastColor.ARGB32.red(color), FastColor.ARGB32.green(color),
108-
FastColor.ARGB32.blue(color), hsv);
107+
Color.RGBtoHSB(ARGB.red(color), ARGB.green(color),
108+
ARGB.blue(color), hsv);
109109
if (hsv[2] < 0.1) colorField.setTextColor(0xFFFFFF);
110110
else colorField.setTextColor(color);
111111
}

common/src/main/java/dev/terminalmc/chatnotify/gui/widget/list/root/notif/FormatList.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import net.minecraft.network.chat.Component;
3030
import net.minecraft.network.chat.MutableComponent;
3131
import net.minecraft.network.chat.TextColor;
32-
import net.minecraft.util.FastColor;
32+
import net.minecraft.util.ARGB;
3333

3434
import java.awt.Color;
3535
import java.time.Duration;
@@ -112,8 +112,8 @@ private static class ColorOptions extends Entry {
112112
// Update color of main button and field
113113
mainButton.setMessage(mainButton.getMessage().copy().withColor(color));
114114
float[] hsv = new float[3];
115-
Color.RGBtoHSB(FastColor.ARGB32.red(color), FastColor.ARGB32.green(color),
116-
FastColor.ARGB32.blue(color), hsv);
115+
Color.RGBtoHSB(ARGB.red(color), ARGB.green(color),
116+
ARGB.blue(color), hsv);
117117
if (hsv[2] < 0.1) colorField.setTextColor(0xFFFFFF);
118118
else colorField.setTextColor(color);
119119
}

common/src/main/java/dev/terminalmc/chatnotify/util/MessageUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ private static void showToastMsg(Notification notif, Component msg, Matcher matc
417417
Component displayMsg = notif.toastMsg.isBlank()
418418
? msg
419419
: convertMsg(notif.toastMsg, matcher);
420-
Minecraft.getInstance().getToasts().addToast(new NotificationToast(displayMsg));
420+
Minecraft.getInstance().getToastManager().addToast(new NotificationToast(displayMsg));
421421
}
422422
}
423423

gradle.properties

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,26 @@ java_versions_fabric=>=21
2727
java_versions_neoforge=[21,)
2828

2929
# Minecraft
30-
minecraft_version=1.21
31-
minecraft_versions_fabric=>1.20.6 <1.22
32-
minecraft_versions_neoforge=(1.20.6, 1.22)
30+
minecraft_version=1.21.3
31+
minecraft_versions_fabric=>1.21.1 <1.22
32+
minecraft_versions_neoforge=(1.21.1, 1.22)
3333

3434
# Parchment https://parchmentmc.org/docs/getting-started#choose-a-version
35-
parchment_minecraft_version=1.21
36-
parchment_version=2024.11.10
35+
parchment_minecraft_version=1.21.3
36+
parchment_version=2024.12.07
3737

3838
# Fabric https://fabricmc.net/develop
3939
fabric_loader_version=0.16.9
4040
fabric_loader_versions=>=0.15.0
41-
fabric_api_version=0.102.0+1.21
41+
fabric_api_version=0.114.0+1.21.3
4242
fabric_api_versions=*
4343

4444
# NeoForge https://projects.neoforged.net/neoforged/neoforge
4545
neoforge_loader_versions=[1,)
46-
neoforge_version=21.0.167
47-
neoforge_versions=[21.0.143, 22)
46+
neoforge_version=21.3.58
47+
neoforge_versions=[21.2.0-beta, 22)
4848
# NeoForm https://projects.neoforged.net/neoforged/neoform
49-
neoform_version=1.21-20240613.152323
49+
neoform_version=1.21.3-20241023.131943
5050

5151
# CommandKeys https://modrinth.com/mod/65UyswbY/versions
5252
commandkeys_version=2.3.4+1.21
@@ -55,8 +55,8 @@ commandkeys_version=2.3.4+1.21
5555
chatheads_version=0.13.7
5656

5757
# ModMenu https://modrinth.com/mod/mOgUt4GM/versions
58-
modmenu_version=11.0.3
59-
modmenu_versions_fabric=>=11.0.0-beta.1
58+
modmenu_version=12.0.0
59+
modmenu_versions_fabric=>=12.0.0-beta.1
6060

6161
# GitHub, Modrinth, CurseForge releases
6262
# Plural properties expect CSV lists
@@ -68,17 +68,19 @@ curseforge_slug=chatnotify
6868
release_type=STABLE
6969
# Fabric
7070
release_mod_loaders_fabric=fabric
71-
release_game_versions_fabric=1.21,1.21.1
71+
release_game_versions_fabric=1.21.2,1.21.3
7272
release_required_dep_ids_fabric_mr=P7dR8mSH,mOgUt4GM
7373
release_required_dep_ids_fabric_cf=fabric-api,modmenu
7474
# NeoForge
7575
release_mod_loaders_neoforge=neoforge
76-
release_game_versions_neoforge=1.21,1.21.1
76+
release_game_versions_neoforge=1.21.2,1.21.3
7777

7878
# Mixin https://mvnrepository.com/artifact/org.spongepowered/mixin
7979
mixin_version=0.8.7
8080
# MixinExtras https://github.com/LlamaLad7/MixinExtras/releases
8181
mixinextras_version=0.4.1
82+
# ASM https://mvnrepository.com/artifact/org.ow2.asm/asm
83+
asm_version=9.7
8284

8385
# Plugins
8486
# Fabric Loom https://mvnrepository.com/artifact/net.fabricmc/fabric-loom

0 commit comments

Comments
 (0)