Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.21.3 and fixed some minor issues #20

Merged
merged 10 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.8.12'
id 'maven-publish'
}

Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21
yarn_mappings=1.21+build.2
loader_version=0.15.11
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.9
# Mod Properties
mod_version=1.2.4
mod_version=1.2.5
maven_group=io.toadlabs
archives_base_name=numeralping
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.100.1+1.21
yacl_version=3.5.0+1.21-fabric
mod_menu_version=11.0.0-rc.4
fabric_version=0.109.0+1.21.3
yacl_version=3.6.1+1.21.2-fabric
mod_menu_version=12.0.0-beta.1
devauth_version=1.2.1
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/toadlabs/numeralping/NumeralPingMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void saveConfig() {
try {
config.save(configFile);
} catch (IOException error) {
LOGGER.error("Failed to read config", error);
LOGGER.error("Failed to save config", error);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public final class ModMenuIntegration implements ModMenuApi {

@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return (parent) -> {
return parent -> {
NumeralConfig config = NumeralConfig.instance();
return YetAnotherConfigLib.createBuilder()
.title(Text.of(NumeralPingMod.NAME))
Expand All @@ -37,7 +37,7 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
.description(OptionDescription.of(Text.translatable(OPTION + ".playerList.desc")))
.binding(NumeralConfig.DEFAULTS.playerList,
() -> config.playerList,
(value) -> config.playerList = value)
value -> config.playerList = value)
.controller(TickBoxControllerBuilder::create)
.build())

Expand All @@ -47,7 +47,7 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
.description(OptionDescription.of(Text.translatable(OPTION + ".serverList.desc")))
.binding(NumeralConfig.DEFAULTS.serverList,
() -> config.serverList,
(value) -> config.serverList = value)
value -> config.serverList = value)
.controller(TickBoxControllerBuilder::create)
.build())

Expand All @@ -57,7 +57,7 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
.description(OptionDescription.of(Text.translatable(OPTION + ".smallPing.desc")))
.binding(NumeralConfig.DEFAULTS.smallPing,
() -> config.smallPing,
(value) -> config.smallPing = value)
value -> config.smallPing = value)
.controller(TickBoxControllerBuilder::create)
.build())

Expand All @@ -69,7 +69,7 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
.description(OptionDescription.of(Text.translatable(OPTION + ".defaultPingThreshold.desc")))
.binding(NumeralConfig.DEFAULTS.defaultPingThreshold,
() -> config.defaultPingThreshold,
(value) -> config.defaultPingThreshold = value)
value -> config.defaultPingThreshold = value)
.controller(IntegerFieldControllerBuilder::create)
.build())

Expand All @@ -79,7 +79,7 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
.description(OptionDescription.of(Text.translatable(OPTION + ".levelOnePingThreshold.desc")))
.binding(NumeralConfig.DEFAULTS.levelOnePingThreshold,
() -> config.levelOnePingThreshold,
(value) -> config.levelOnePingThreshold = value)
value -> config.levelOnePingThreshold = value)
.controller(IntegerFieldControllerBuilder::create)
.build())

Expand All @@ -89,7 +89,7 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
.description(OptionDescription.of(Text.translatable(OPTION + ".levelTwoPingThreshold.desc")))
.binding(NumeralConfig.DEFAULTS.levelTwoPingThreshold,
() -> config.levelTwoPingThreshold,
(value) -> config.levelTwoPingThreshold = value)
value -> config.levelTwoPingThreshold = value)
.controller(IntegerFieldControllerBuilder::create)
.build())

Expand All @@ -99,7 +99,7 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
.description(OptionDescription.of(Text.translatable(OPTION + ".levelThreePingThreshold.desc")))
.binding(NumeralConfig.DEFAULTS.levelThreePingThreshold,
() -> config.levelThreePingThreshold,
(value) -> config.levelThreePingThreshold = value)
value -> config.levelThreePingThreshold = value)
.controller(IntegerFieldControllerBuilder::create)
.build())

Expand All @@ -108,7 +108,7 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
.name(Text.translatable(OPTION + ".defaultPingColour"))
.binding(NumeralConfig.DEFAULTS.defaultPingColour,
() -> config.defaultPingColour,
(value) -> config.defaultPingColour = value)
value -> config.defaultPingColour = value)
.controller(ColorControllerBuilder::create)
.build())

Expand All @@ -117,7 +117,7 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
.name(Text.translatable(OPTION + ".levelOnePingColour"))
.binding(NumeralConfig.DEFAULTS.levelOnePingColour,
() -> config.levelOnePingColour,
(value) -> config.levelOnePingColour = value)
value -> config.levelOnePingColour = value)
.controller(ColorControllerBuilder::create)
.build())

Expand All @@ -126,7 +126,7 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
.name(Text.translatable(OPTION + ".levelTwoPingColour"))
.binding(NumeralConfig.DEFAULTS.levelTwoPingColour,
() -> config.levelTwoPingColour,
(value) -> config.levelTwoPingColour = value)
value -> config.levelTwoPingColour = value)
.controller(ColorControllerBuilder::create)
.build())

Expand All @@ -135,7 +135,7 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
.name(Text.translatable(OPTION + ".levelThreePingColour"))
.binding(NumeralConfig.DEFAULTS.levelThreePingColour,
() -> config.levelThreePingColour,
(value) -> config.levelThreePingColour = value)
value -> config.levelThreePingColour = value)
.controller(ColorControllerBuilder::create)
.build())

Expand All @@ -145,7 +145,7 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
.description(OptionDescription.of(Text.translatable(OPTION + ".levelFourPingColour.desc")))
.binding(NumeralConfig.DEFAULTS.levelFourPingColour,
() -> config.levelFourPingColour,
(value) -> config.levelFourPingColour = value)
value -> config.levelFourPingColour = value)
.controller(ColorControllerBuilder::create)
.build())

Expand All @@ -154,7 +154,7 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
.name(Text.translatable(OPTION + ".levelFivePingColour"))
.binding(NumeralConfig.DEFAULTS.levelFivePingColour,
() -> config.levelFivePingColour,
(value) -> config.levelFivePingColour = value)
value -> config.levelFivePingColour = value)
.controller(ColorControllerBuilder::create)
.build())

Expand Down
14 changes: 11 additions & 3 deletions src/main/java/io/toadlabs/numeralping/mixin/ServerEntryMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget;
import net.minecraft.client.network.ServerInfo;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableTextContent;
import net.minecraft.util.Identifier;
Expand All @@ -20,6 +21,8 @@
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;

import java.util.function.Function;

// a priority of 2000 means it will apply later
// this is combined with `require = 0` to allow other mods to apply more integral functionality first without the game crashing
@Mixin(value = MultiplayerServerListWidget.ServerEntry.class, priority = 0)
Expand All @@ -40,8 +43,13 @@ public boolean hideTooltip(MultiplayerScreen instance, Text text) {
return !(NumeralConfig.instance().serverList && text.getContent() instanceof TranslatableTextContent content && content.getKey().equalsIgnoreCase("multiplayer.status.ping"));
}

@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V", ordinal = 0))
public void renderDetailedLatency(DrawContext instance, Identifier texture, int x, int y, int width, int height) {
@Redirect(
method = "render",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIII)V",
ordinal = 0))
public void renderDetailedLatency(DrawContext instance, Function<Identifier, RenderLayer> renderLayers, Identifier texture, int x, int y, int width, int height) {
NumeralConfig config = NumeralConfig.instance();

if (server.ping >= 0 && config.serverList) {
Expand All @@ -58,7 +66,7 @@ public void renderDetailedLatency(DrawContext instance, Identifier texture, int
return;
}

instance.drawGuiTexture(texture, x, y, width, height);
instance.drawGuiTexture(renderLayers, texture, x, y, width, height);
}

@Unique
Expand Down
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,9 +33,9 @@
"numeralping.mixins.json"
],
"depends": {
"fabricloader": ">=0.15",
"fabricloader": ">=0.16",
"fabric-api": "*",
"minecraft": "~1.21",
"minecraft": "~1.21.3",
"yet_another_config_lib_v3": "*"
},
"suggests": {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/numeralping.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"required": false,
"minVersion": "0.8",
"package": "io.toadlabs.numeralping.mixin",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_21",
"mixins": [
],
"client": [
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/resourcepacks/font_fix/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 34,
"pack_format": 42,
"description": "Fix for illegible font.\nThis is the low-res version."
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 34,
"pack_format": 42,
"description": "Fix for illegible/low-res font.\nThis is the high-res version."
}
}
Loading