diff --git a/README.md b/README.md index 3271bdf..3ac5a09 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This is a Minecraft mod that overlays a timer on the Vanilla status effect HUD icons. -This mod requires Minecraft 1.16.5-1.19.4 and the Fabric loader. +This mod requires Minecraft 1.16.5-1.20.x and the Fabric loader. 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. @@ -25,7 +25,7 @@ This is what it looks like when you are using the mod. The latest version is 1.2.0. -Direct download links for Minecraft 1.19.4: +Direct download links for Minecraft 1.20.x: * 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) * 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) diff --git a/gradle.properties b/gradle.properties index f7d5c99..e21da78 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.19.4 -yarn_mappings=1.19.4+build.2 +minecraft_version=1.20 +yarn_mappings=1.20+build.1 loader_version=0.15.6 # Mod Properties -mod_version = 1.2.0+1.19.4 +mod_version = 1.2.0+1.20 maven_group = se.icus.mag archives_base_name = statuseffecttimer # Dependencies # Fabric api -fabric_version=0.87.2+1.19.4 +fabric_version=0.83.0+1.20 mixinextras_version=0.2.2 \ No newline at end of file diff --git a/src/main/java/se/icus/mag/statuseffecttimer/mixin/StatusEffectTimerMixin.java b/src/main/java/se/icus/mag/statuseffecttimer/mixin/StatusEffectTimerMixin.java index ee66872..da65ed3 100644 --- a/src/main/java/se/icus/mag/statuseffecttimer/mixin/StatusEffectTimerMixin.java +++ b/src/main/java/se/icus/mag/statuseffecttimer/mixin/StatusEffectTimerMixin.java @@ -4,10 +4,9 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.resource.language.I18n; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.util.math.MathHelper; import org.spongepowered.asm.mixin.Final; @@ -28,25 +27,25 @@ public abstract class StatusEffectTimerMixin { @Inject(method = "renderStatusEffectOverlay", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", shift = At.Shift.AFTER)) - private void appendOverlayDrawing(MatrixStack matrices, CallbackInfo c, + private void appendOverlayDrawing(DrawContext context, CallbackInfo c, @Local List list, @Local StatusEffectInstance statusEffectInstance, @Local(ordinal = 4) int x, @Local(ordinal = 3) int y) { list.add(() -> { - drawStatusEffectOverlay(matrices, statusEffectInstance, x, y); + drawStatusEffectOverlay(context, statusEffectInstance, x, y); }); } - private void drawStatusEffectOverlay(MatrixStack matrices, StatusEffectInstance statusEffectInstance, int x, int y) { + private void drawStatusEffectOverlay(DrawContext context, StatusEffectInstance statusEffectInstance, int x, int y) { String duration = getDurationAsString(statusEffectInstance); int durationLength = client.textRenderer.getWidth(duration); - DrawableHelper.drawTextWithShadow(matrices, client.textRenderer, duration, x + 13 - (durationLength / 2), y + 14, 0x99FFFFFF); + context.drawTextWithShadow(client.textRenderer, duration, x + 13 - (durationLength / 2), y + 14, 0x99FFFFFF); int amplifier = statusEffectInstance.getAmplifier(); if (amplifier > 0) { // Convert to roman numerals if possible String amplifierString = (amplifier < 10) ? I18n.translate("enchantment.level." + (amplifier + 1)) : "**"; int amplifierLength = client.textRenderer.getWidth(amplifierString); - DrawableHelper.drawTextWithShadow(matrices, client.textRenderer, amplifierString, x + 22 - amplifierLength, y + 3, 0x99FFFFFF); + context.drawTextWithShadow(client.textRenderer, amplifierString, x + 22 - amplifierLength, y + 3, 0x99FFFFFF); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 5c055b8..fb2429c 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -25,6 +25,6 @@ "depends": { "fabricloader": ">=0.7.4", - "minecraft": "1.19.4" + "minecraft": "~1.20" } }