Skip to content

Commit 3213a85

Browse files
committed
Support for 1.20
1 parent 189e271 commit 3213a85

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
This is a Minecraft mod that overlays a timer on the Vanilla status effect HUD icons.
88

9-
This mod requires Minecraft 1.16.5-1.19.4 and the Fabric loader.
9+
This mod requires Minecraft 1.16.5-1.20.x and the Fabric loader.
1010

1111
This mod overlays the number of seconds left of the status effect, or the number of minutes (followed by "m") if it is more than 60 seconds, on the vanilla status effect indicator. If the effect has an amplifier (as in "Haste II"), the amplifier is also overlaid. That's it. This is a very minimalistic mod. No settings are required nor provided.
1212

@@ -25,7 +25,7 @@ This is what it looks like when you are using the mod.
2525

2626
The latest version is 1.2.0.
2727

28-
Direct download links for Minecraft 1.19.4:
28+
Direct download links for Minecraft 1.20.x:
2929

3030
* Download from GitHub: [statuseffecttimer-1.2.0+1.19.4.jar](https://github.com/magicus/statuseffecttimer/releases/download/v1.2.0%2B1.19.4/statuseffecttimer-1.2.0+1.19.4.jar)
3131
* Download from Modrinth: [statuseffecttimer-1.2.0+1.19.4.jar](https://cdn.modrinth.com/data/T9FDHbY5/versions/Aqavb1JB/statuseffecttimer-1.2.0%2B1.19.4.jar)

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/develop
6-
minecraft_version=1.19.4
7-
yarn_mappings=1.19.4+build.2
6+
minecraft_version=1.20
7+
yarn_mappings=1.20+build.1
88
loader_version=0.15.6
99

1010
# Mod Properties
11-
mod_version = 1.2.0+1.19.4
11+
mod_version = 1.2.0+1.20
1212
maven_group = se.icus.mag
1313
archives_base_name = statuseffecttimer
1414

1515
# Dependencies
1616
# Fabric api
17-
fabric_version=0.87.2+1.19.4
17+
fabric_version=0.83.0+1.20
1818
mixinextras_version=0.2.2

src/main/java/se/icus/mag/statuseffecttimer/mixin/StatusEffectTimerMixin.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
import net.fabricmc.api.EnvType;
55
import net.fabricmc.api.Environment;
66
import net.minecraft.client.MinecraftClient;
7-
import net.minecraft.client.gui.DrawableHelper;
7+
import net.minecraft.client.gui.DrawContext;
88
import net.minecraft.client.gui.hud.InGameHud;
99
import net.minecraft.client.resource.language.I18n;
10-
import net.minecraft.client.util.math.MatrixStack;
1110
import net.minecraft.entity.effect.StatusEffectInstance;
1211
import net.minecraft.util.math.MathHelper;
1312
import org.spongepowered.asm.mixin.Final;
@@ -28,25 +27,25 @@ public abstract class StatusEffectTimerMixin {
2827

2928
@Inject(method = "renderStatusEffectOverlay",
3029
at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", shift = At.Shift.AFTER))
31-
private void appendOverlayDrawing(MatrixStack matrices, CallbackInfo c,
30+
private void appendOverlayDrawing(DrawContext context, CallbackInfo c,
3231
@Local List<Runnable> list, @Local StatusEffectInstance statusEffectInstance,
3332
@Local(ordinal = 4) int x, @Local(ordinal = 3) int y) {
3433
list.add(() -> {
35-
drawStatusEffectOverlay(matrices, statusEffectInstance, x, y);
34+
drawStatusEffectOverlay(context, statusEffectInstance, x, y);
3635
});
3736
}
3837

39-
private void drawStatusEffectOverlay(MatrixStack matrices, StatusEffectInstance statusEffectInstance, int x, int y) {
38+
private void drawStatusEffectOverlay(DrawContext context, StatusEffectInstance statusEffectInstance, int x, int y) {
4039
String duration = getDurationAsString(statusEffectInstance);
4140
int durationLength = client.textRenderer.getWidth(duration);
42-
DrawableHelper.drawTextWithShadow(matrices, client.textRenderer, duration, x + 13 - (durationLength / 2), y + 14, 0x99FFFFFF);
41+
context.drawTextWithShadow(client.textRenderer, duration, x + 13 - (durationLength / 2), y + 14, 0x99FFFFFF);
4342

4443
int amplifier = statusEffectInstance.getAmplifier();
4544
if (amplifier > 0) {
4645
// Convert to roman numerals if possible
4746
String amplifierString = (amplifier < 10) ? I18n.translate("enchantment.level." + (amplifier + 1)) : "**";
4847
int amplifierLength = client.textRenderer.getWidth(amplifierString);
49-
DrawableHelper.drawTextWithShadow(matrices, client.textRenderer, amplifierString, x + 22 - amplifierLength, y + 3, 0x99FFFFFF);
48+
context.drawTextWithShadow(client.textRenderer, amplifierString, x + 22 - amplifierLength, y + 3, 0x99FFFFFF);
5049
}
5150
}
5251

src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525

2626
"depends": {
2727
"fabricloader": ">=0.7.4",
28-
"minecraft": "1.19.4"
28+
"minecraft": "~1.20"
2929
}
3030
}

0 commit comments

Comments
 (0)