Skip to content

Commit

Permalink
Port to Minecraft 1.14.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Grayray75 committed Jul 18, 2023
1 parent 2021b1c commit d54e9b4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies {
includeFabricApiModule "fabric-key-binding-api-v1"
includeFabricApiModule "fabric-lifecycle-events-v1"

modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"
modImplementation "io.github.prospector:modmenu:${project.modmenu_version}"

modApi("me.shedaniel.cloth:config-2:${project.cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
Expand Down Expand Up @@ -92,7 +92,7 @@ modrinth {
changelog = "A changelog can be found at https://github.com/Grayray75/FPS-Display/blob/v3/CHANGELOG.md"

uploadFile = remapJar
gameVersions = ["1.15", "1.15.1", "1.15.2"]
gameVersions = ["1.14.2", "1.14.3", "1.14.4"]
loaders = ["fabric"]
dependencies {
optional.project "modmenu"
Expand All @@ -110,9 +110,9 @@ curseforge {
releaseType = "release"
changelog = "A changelog can be found at https://github.com/Grayray75/FPS-Display/blob/v3/CHANGELOG.md"

addGameVersion "1.15"
addGameVersion "1.15.1"
addGameVersion "1.15.2"
addGameVersion "1.14.2"
addGameVersion "1.14.3"
addGameVersion "1.14.4"
addGameVersion "Fabric"
addGameVersion "Java 8"

Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ org.gradle.jvmargs=-Xmx2G

# Fabric Properties
# https://fabricmc.net/develop/
minecraft_version=1.15.2
yarn_mappings=1.15.2+build.17
minecraft_version=1.14.4
yarn_mappings=1.14.4+build.18
loader_version=0.14.21

# Mod Properties
mod_version=3.0.1
maven_group=io.grayray75.mods
archives_base_name=fpsdisplay
minecraft_version_supported=1.15.x
minecraft_version_supported=1.14.x

# Dependencies
# https://linkie.shedaniel.dev/
fabric_version=0.28.5+1.15
modmenu_version=1.10.7
cloth_config_version=2.14.2
fabric_version=0.28.5+1.14
modmenu_version=1.7.17+build.1
cloth_config_version=1.8
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static Screen generateScreen(Screen parent) {
.setDefaultValue(configDefaults.textSize)
.setSaveConsumer(newValue -> config.textSize = newValue)
.build());
general.addEntry(entryBuilder.startColorField(new TranslatableText("text.fpsdisplay.options.textColor").asString(), config.textColor)
general.addEntry(entryBuilder.startIntField(new TranslatableText("text.fpsdisplay.options.textColor").asString(), config.textColor)
.setDefaultValue(configDefaults.textColor)
.setSaveConsumer(newValue -> config.textColor = newValue)
.build());
Expand All @@ -63,7 +63,7 @@ public static Screen generateScreen(Screen parent) {

general.addEntry(entryBuilder.startEnumSelector(new TranslatableText("text.fpsdisplay.options.keybindMode").asString(), ConfigData.KeyMode.class, config.keybindMode)
.setDefaultValue(configDefaults.keybindMode)
.setSaveConsumer(newValue -> config.keybindMode = newValue)
.setSaveConsumer(newValue -> config.keybindMode = (ConfigData.KeyMode) newValue)
.build());

return builder.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.grayray75.mods.fpsdisplay.mixin;

import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.platform.GlStateManager;
import io.grayray75.mods.fpsdisplay.FpsDisplayMod;
import io.grayray75.mods.fpsdisplay.config.ConfigData;
import io.grayray75.mods.fpsdisplay.config.ConfigManager;
Expand Down Expand Up @@ -32,15 +32,15 @@ public void render(float tickDelta, CallbackInfo info) {
int textPosX = config.offsetLeft;
int textPosY = config.offsetTop;

double guiScale = client.getWindow().getScaleFactor();
double guiScale = client.window.getScaleFactor();
if (guiScale > 0) {
textPosX /= guiScale;
textPosY /= guiScale;
}

// Prevent text to render outside screenspace
int maxTextPosX = client.getWindow().getScaledWidth() - client.textRenderer.getStringWidth(text);
int maxTextPosY = client.getWindow().getScaledHeight() - client.textRenderer.fontHeight;
int maxTextPosX = client.window.getScaledWidth() - client.textRenderer.getStringWidth(text);
int maxTextPosY = client.window.getScaledHeight() - client.textRenderer.fontHeight;
textPosX = Math.min(textPosX, maxTextPosX);
textPosY = Math.min(textPosY, maxTextPosY);

Expand All @@ -52,18 +52,18 @@ public void render(float tickDelta, CallbackInfo info) {

private void renderText(TextRenderer textRenderer, String text, int x, int y, int color, float scale, boolean shadowed) {
if (scale != 1.0f) {
RenderSystem.pushMatrix();
RenderSystem.translatef(x, y, 0);
RenderSystem.scalef(scale, scale, scale);
RenderSystem.translatef(-x, -y, 0);
GlStateManager.pushMatrix();
GlStateManager.translatef(x, y, 0);
GlStateManager.scalef(scale, scale, scale);
GlStateManager.translatef(-x, -y, 0);

if (shadowed) {
textRenderer.drawWithShadow(text, x, y, color);
} else {
textRenderer.draw(text, x, y, color);
}

RenderSystem.popMatrix();
GlStateManager.popMatrix();
}
else {
if (shadowed) {
Expand Down

0 comments on commit d54e9b4

Please sign in to comment.