Skip to content

Commit

Permalink
1.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
LostLuma committed Sep 29, 2023
1 parent 7707890 commit 4b5c7e5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[versions]
minecraft = "1.20"
minecraft = "1.19.4"
fabric_loader = "0.14.22"

modmenu = "7.0.1"
fabric_api = "0.83.0+1.20"
modmenu = "6.1.0"
fabric_api = "0.75.3+1.19.4"

cloth_config = "11.0.99"
cloth_config = "10.0.96"

[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
Expand Down
23 changes: 8 additions & 15 deletions src/main/java/dynamic_fps/impl/util/HudInfoRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,37 @@
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.Font.DisplayMode;
import net.minecraft.network.chat.Component;

import static dynamic_fps.impl.util.Localization.localized;

import org.joml.Matrix4f;
import com.mojang.blaze3d.vertex.PoseStack;

import dynamic_fps.impl.DynamicFPSMod;

public final class HudInfoRenderer implements HudRenderCallback {
@Override
public void onHudRender(GuiGraphics drawContext, float tickDelta) {
public void onHudRender(PoseStack poseStack, float tickDelta) {
if (DynamicFPSMod.isDisabled()) {
drawCenteredText(drawContext, localized("gui", "hud.disabled"), 32);
drawCenteredText(poseStack, localized("gui", "hud.disabled"), 32);
} else if (DynamicFPSMod.isForcingLowFPS()) {
drawCenteredText(drawContext, localized("gui", "hud.reducing"), 32);
drawCenteredText(poseStack, localized("gui", "hud.reducing"), 32);
}
}

private void drawCenteredText(GuiGraphics drawContext, Component component, float y) {
private void drawCenteredText(PoseStack poseStack, Component component, float y) {
Minecraft client = Minecraft.getInstance();
Font fontRenderer = client.gui.getFont();

int windowWidth = client.getWindow().getGuiScaledWidth();
int stringWidth = fontRenderer.width(component);

fontRenderer.drawInBatch(
fontRenderer.drawShadow(
poseStack,
component,
(windowWidth - stringWidth) / 2f,
y,
0xFFFFFFFF,
true,
new Matrix4f(),
drawContext.bufferSource(),
DisplayMode.NORMAL,
0,
255
0xFFFFFFFF
);
}
}
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
],

"depends": {
"minecraft": ">=1.20.0",
"fabricloader": ">=0.14.22",
"minecraft": "=1.19.4",
"fabricloader": ">=0.14.7",
"fabric-resource-loader-v0": "*",
"fabric-rendering-v1": "*",
"fabric-lifecycle-events-v1": "*",
Expand Down

0 comments on commit 4b5c7e5

Please sign in to comment.