Skip to content

Commit

Permalink
1.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
LostLuma committed Feb 18, 2024
1 parent 8bbabf5 commit c412009
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 36 deletions.
16 changes: 8 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
[versions]
minecraft = "1.20.4"
minecraft = "1.19.4"

# Platform libraries

fabric_loader = "0.15.6"
fabric_api = "0.96.1+1.20.4"
fabric_api = "0.75.3+1.19.4"

forge = "1.20.4-49.0.30"
forge = "1.19.4-45.2.8"

neoforge = "20.4.160-beta"
# neoforge = "20.4.160-beta"

quilt_loader = "0.23.1"
quilt_standard_libraries = "7.0.0-alpha.10+1.20.2"
quilt_standard_libraries = "5.0.0-beta.11+1.19.4"

# Third-party libraries

modmenu = "9.0.0"
cloth_config = "13.0.121"
modmenu = "6.1.0"
cloth_config = "10.1.117"

mixinextras = "0.3.5"

Expand All @@ -30,7 +30,7 @@ fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric_l

forge = { module = "net.minecraftforge:forge", version.ref = "forge" }

neoforge = { module = "net.neoforged:neoforge", version.ref = "neoforge" }
# neoforge = { module = "net.neoforged:neoforge", version.ref = "neoforge" }

quilt_loader = { module = "org.quiltmc:quilt-loader", version.ref = "quilt_loader" }
qsl_lifecycle_events = { module = "org.quiltmc.qsl.core:lifecycle_events", version.ref = "quilt_standard_libraries" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,37 @@

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 {
private static final Minecraft minecraft = Minecraft.getInstance();

public static void renderInfo(GuiGraphics guiGraphics) {
public static void renderInfo(PoseStack poseStack) {
if (DynamicFPSMod.disabledByUser()) {
drawCenteredText(guiGraphics, localized("gui", "hud.disabled"), 32);
drawCenteredText(poseStack, localized("gui", "hud.disabled"), 32);
} else if (DynamicFPSMod.isForcingLowFPS()) {
drawCenteredText(guiGraphics, localized("gui", "hud.reducing"), 32);
drawCenteredText(poseStack, localized("gui", "hud.reducing"), 32);
}
}

private static void drawCenteredText(GuiGraphics guiGraphics, Component component, float y) {
private static void drawCenteredText(PoseStack poseStack, Component component, float y) {
Font fontRenderer = minecraft.gui.getFont();

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

fontRenderer.drawInBatch(
fontRenderer.drawShadow(
poseStack,
component,
(windowWidth - stringWidth) / 2f,
y,
0xFFFFFFFF,
true,
new Matrix4f(),
guiGraphics.bufferSource(),
DisplayMode.NORMAL,
0,
255
0xFFFFFFFF
);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package net.lostluma.dynamic_fps.impl.fabric.mixin;

import com.llamalad7.mixinextras.sugar.Local;
import com.mojang.blaze3d.vertex.PoseStack;
import dynamic_fps.impl.util.HudInfoRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiGraphics;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -18,10 +18,10 @@ public class GuiMixin {
method = "render",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/Gui;renderSavingIndicator(Lnet/minecraft/client/gui/GuiGraphics;)V"
target = "Lnet/minecraft/client/gui/Gui;renderSavingIndicator(Lcom/mojang/blaze3d/vertex/PoseStack;)V"
)
)
private void render(CallbackInfo callbackInfo, @Local GuiGraphics guiGraphics) {
HudInfoRenderer.renderInfo(guiGraphics);
private void render(CallbackInfo callbackInfo, @Local PoseStack poseStack) {
HudInfoRenderer.renderInfo(poseStack);
}
}
2 changes: 1 addition & 1 deletion platforms/fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"depends": {
"fabricloader": ">=0.15.0",
"minecraft": ">=1.20.0",
"minecraft": "=1.19.4",
"mixinextras": ">=0.3.2",
"fabric-resource-loader-v0": "*",
"fabric-lifecycle-events-v1": "*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public DynamicFPSForgeMod() {
}

public void renderGuiOverlay(RenderGuiOverlayEvent event) {
HudInfoRenderer.renderInfo(event.getGuiGraphics());
HudInfoRenderer.renderInfo(event.getPoseStack());
}

public void registerKeyMappings(RegisterKeyMappingsEvent event) {
Expand Down
2 changes: 1 addition & 1 deletion platforms/forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ file="META-INF/accesstransformer.cfg"
[[dependencies.dynamic_fps]]
modId = "minecraft"
mandatory = true
versionRange = "[1.20.0,)"
versionRange = "[1.19.4]"
ordering = "NONE"
side = "CLIENT"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package net.lostluma.dynamic_fps.impl.quilt.mixin;

import com.llamalad7.mixinextras.sugar.Local;
import com.mojang.blaze3d.vertex.PoseStack;
import dynamic_fps.impl.util.HudInfoRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiGraphics;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -18,10 +18,10 @@ public class GuiMixin {
method = "render",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/Gui;renderSavingIndicator(Lnet/minecraft/client/gui/GuiGraphics;)V"
target = "Lnet/minecraft/client/gui/Gui;renderSavingIndicator(Lcom/mojang/blaze3d/vertex/PoseStack;)V"
)
)
private void render(CallbackInfo callbackInfo, @Local GuiGraphics guiGraphics) {
HudInfoRenderer.renderInfo(guiGraphics);
private void render(CallbackInfo callbackInfo, @Local PoseStack poseStack) {
HudInfoRenderer.renderInfo(poseStack);
}
}
2 changes: 1 addition & 1 deletion platforms/quilt/src/main/resources/quilt.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
{
"id": "minecraft",
"versions": ">=1.20.0"
"versions": "=1.19.4"
},
{
"id": "mixinextras",
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ rootProject.name = "dynamic-fps"
include(":platforms:common")
include(":platforms:fabric")
include(":platforms:forge")
include(":platforms:neoforge")
// include(":platforms:neoforge")
include(":platforms:quilt")

0 comments on commit c412009

Please sign in to comment.