Skip to content

Commit 273f68c

Browse files
Update code to 1.21.7
1 parent 85866bf commit 273f68c

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

fabric/1.21.7/src/main/java/computer/heather/advancedbackups/client/BackupToast.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import computer.heather.advancedbackups.core.config.ClientConfigManager;
55
import net.minecraft.client.font.TextRenderer;
6+
import net.minecraft.client.gl.RenderPipelines;
67
import net.minecraft.client.gui.DrawContext;
78
import net.minecraft.client.render.RenderLayer;
89
import net.minecraft.client.resource.language.I18n;
@@ -13,7 +14,7 @@
1314
import net.minecraft.util.Identifier;
1415

1516
public class BackupToast implements Toast {
16-
17+
1718
public static boolean starting;
1819
public static boolean started;
1920
public static boolean failed;
@@ -29,7 +30,7 @@ public class BackupToast implements Toast {
2930
private static boolean timeSet = false;
3031

3132
public static final ItemStack stack = new ItemStack(Items.PAPER);
32-
private static final Identifier TEXTURE = Identifier.of("toast/advancement");
33+
private static final Identifier TEXTURE = Identifier.of("toast/advancement");
3334

3435
public static String title = "You shouldn't see this!";
3536
public static int textColour = 0;
@@ -38,12 +39,12 @@ public class BackupToast implements Toast {
3839

3940
@Override
4041
public void draw(DrawContext context, TextRenderer renderer, long startTime) {
41-
context.drawGuiTexture(RenderLayer::getGuiTextured, TEXTURE, 0, ClientConfigManager.darkMode.get() ? 0 : this.getHeight(), this.getWidth(), this.getHeight());
42+
context.drawGuiTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, 0, ClientConfigManager.darkMode.get() ? 0 : this.getHeight(), this.getWidth(), this.getHeight());
4243

4344
context.drawItemWithoutEntity(stack, 8, 8);;
44-
45+
4546
float percent = finished ? 100 : (float) progress / (float) max;
46-
47+
4748
context.fill(4, 28, 156, 29, ColourHelper.colour
4849
(255, (int) ClientConfigManager.progressBackgroundRed.get(), (int) ClientConfigManager.progressBackgroundGreen.get(), (int) ClientConfigManager.progressBackgroundBlue.get()));
4950

@@ -68,7 +69,7 @@ public void draw(DrawContext context, TextRenderer renderer, long startTime) {
6869

6970
title = "You shouldn't see this!";
7071

71-
72+
7273
if (starting) {
7374
textColour = ColourHelper.colour(255, (int) ClientConfigManager.progressTextRed.get(), (int) ClientConfigManager.progressTextGreen.get(), (int) ClientConfigManager.progressTextBlue.get());
7475
title = I18n.translate("advancedbackups.backup_starting");
@@ -119,11 +120,11 @@ else if (cancelled) {
119120

120121
context.fill(4, 28, Math.max(4, (int) f), 29, ColourHelper.colour
121122
(255, (int) ClientConfigManager.progressBarRed.get(), (int) ClientConfigManager.progressBarGreen.get(), (int) ClientConfigManager.progressBarBlue.get()));
122-
123+
123124
visibility = Visibility.SHOW;
124125
}
125-
126-
126+
127+
127128
private static String round (float value) {
128129
return String.format("%.1f", value);
129130
}

fabric/1.21.7/src/main/java/computer/heather/advancedbackups/network/PacketToastSubscribe.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
import net.minecraft.util.Identifier;
1111

1212
public record PacketToastSubscribe(boolean enable) implements CustomPayload {
13-
13+
1414
public static final Id<PacketToastSubscribe> ID = new CustomPayload.Id<PacketToastSubscribe>(Identifier.of("advancedbackups:toast_subscribe"));
15-
15+
1616
public PacketToastSubscribe(boolean enable) {
1717
this.enable = enable;
1818
}
1919

20-
public static final PacketCodec<PacketByteBuf, PacketToastSubscribe> CODEC = PacketCodec.tuple(PacketCodecs.BOOL, PacketToastSubscribe::enable, PacketToastSubscribe::new);
20+
public static final PacketCodec<PacketByteBuf, PacketToastSubscribe> CODEC = PacketCodec.tuple(PacketCodecs.BOOLEAN, PacketToastSubscribe::enable, PacketToastSubscribe::new);
2121

2222

2323
public static void handle(PacketToastSubscribe message, ServerPlayNetworking.Context context) {
@@ -30,16 +30,16 @@ public static void handle(PacketToastSubscribe message, ServerPlayNetworking.Con
3030
else if (!message.enable()) {
3131
AdvancedBackups.players.remove(player.getUuidAsString());
3232
}
33-
33+
3434
}
35-
35+
3636

3737

3838
@Override
3939
public Id<? extends CustomPayload> getId() {
4040
return ID;
4141
}
42-
43-
44-
45-
}
42+
43+
44+
45+
}

0 commit comments

Comments
 (0)