diff --git a/betterstats-3-fabric-1.20.1/gradle.properties b/betterstats-3-fabric-1.20.1/gradle.properties index 64de0715..979509e8 100644 --- a/betterstats-3-fabric-1.20.1/gradle.properties +++ b/betterstats-3-fabric-1.20.1/gradle.properties @@ -16,7 +16,7 @@ org.gradle.jvmargs=-Xmx1G mod_name = Better Statistics Screen mod_description = Improves the statistics screen and makes it more useful. mod_author = TheCSDev - mod_version = 3.0.0+fabric-1.20.1 + mod_version = 3.1+fabric-1.20.1 mod_contact_homepage = https://github.com/TheCSMods mod_contact_sources = https://github.com/TheCSMods/mc-better-stats @@ -38,7 +38,7 @@ org.gradle.jvmargs=-Xmx1G mod_depends_minecraft = >=1.20 mod_depends_java = >=17 - mod_jar_tcdcommons = META-INF/jarjar/tcdcommons-3.0.0+fabric-1.20.1.jar + mod_jar_tcdcommons = META-INF/jarjar/tcdcommons-3.1+fabric-1.20.1.jar pack_mcmeta_format = 15 diff --git a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/util/stats/SUGeneralStat.java b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/util/stats/SUGeneralStat.java index 0422fb72..a5aa49cc 100644 --- a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/util/stats/SUGeneralStat.java +++ b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/util/stats/SUGeneralStat.java @@ -8,9 +8,11 @@ import java.util.Comparator; import java.util.List; import java.util.Objects; +import java.util.Optional; import java.util.function.Predicate; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.ApiStatus.Internal; import io.github.thecsdev.betterstats.api.util.io.IStatsProvider; import it.unimi.dsi.fastutil.objects.ObjectArrayList; @@ -39,12 +41,19 @@ public final class SUGeneralStat extends SUStat // ================================================== public SUGeneralStat(IStatsProvider statsProvider, Stat stat) { - super(statsProvider, Registries.CUSTOM_STAT.get(stat.getValue()), getGeneralStatText(stat)); + super(statsProvider, id(stat), getGeneralStatText(stat)); this.stat = Objects.requireNonNull(stat); this.value = statsProvider.getStatValue(stat); this.valueText = fLiteral(stat.format(this.value)); this.isEmpty = this.value == 0; } + // -------------------------------------------------- + private static final @Internal Identifier id(Stat stat) + { + //not the intended way of dealing with this, but has to be done to deal with incompatibilities, + //and by incompatibilities i mean mod devs. not registering their stats because... idk either + return Optional.ofNullable(Registries.CUSTOM_STAT.get(stat.getValue())).orElse(ID_NULL); + } // ================================================== /** * Returns the "general" {@link Stat} that corresponds with this {@link SUGeneralStat}. @@ -88,7 +97,8 @@ public static String getGeneralStatTranslationKey(Stat stat) statsList.sort(Comparator.comparing(stat -> translatable(getGeneralStatTranslationKey(stat)).getString())); for(final var stat : statsList) result.add(new SUGeneralStat(statsProvider, stat)); - if(filter != null) result.removeIf(filter.negate()); + //filter out stats with NULL IDs and stats the filter filters out + result.removeIf(stat -> Objects.equals(ID_NULL, stat.getStatID()) || (filter != null && !filter.test(stat))); //return the result list return result; diff --git a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/util/stats/SUStat.java b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/util/stats/SUStat.java index 3b73e417..8f385a92 100644 --- a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/util/stats/SUStat.java +++ b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/util/stats/SUStat.java @@ -24,6 +24,8 @@ public abstract @Internal class SUStat extends Object { // ================================================== + public static final Identifier ID_NULL = new Identifier("null"); + // -------------------------------------------------- protected final IStatsProvider statsProvider; protected final Identifier statId; protected final Text statLabel; diff --git a/betterstats-3-fabric-1.20.1/src/main/resources/META-INF/jarjar/tcdcommons-3.0.0+fabric-1.20.1.jar b/betterstats-3-fabric-1.20.1/src/main/resources/META-INF/jarjar/tcdcommons-3.1+fabric-1.20.1.jar similarity index 72% rename from betterstats-3-fabric-1.20.1/src/main/resources/META-INF/jarjar/tcdcommons-3.0.0+fabric-1.20.1.jar rename to betterstats-3-fabric-1.20.1/src/main/resources/META-INF/jarjar/tcdcommons-3.1+fabric-1.20.1.jar index 02224d55..5d54f9db 100644 Binary files a/betterstats-3-fabric-1.20.1/src/main/resources/META-INF/jarjar/tcdcommons-3.0.0+fabric-1.20.1.jar and b/betterstats-3-fabric-1.20.1/src/main/resources/META-INF/jarjar/tcdcommons-3.1+fabric-1.20.1.jar differ