diff --git a/common/src/main/java/gripe/_90/megacells/definition/MEGAConfig.java b/common/src/main/java/gripe/_90/megacells/definition/MEGAConfig.java index 75ed7a4e..d08b72ba 100644 --- a/common/src/main/java/gripe/_90/megacells/definition/MEGAConfig.java +++ b/common/src/main/java/gripe/_90/megacells/definition/MEGAConfig.java @@ -10,15 +10,16 @@ @SuppressWarnings({"FieldCanBeLocal", "FieldMayBeFinal"}) @Config(name = MEGACells.MODID) -public class MEGAConfig implements ConfigData { +public final class MEGAConfig implements ConfigData { @ConfigEntry.Gui.Excluded public static MEGAConfig INSTANCE; + @ConfigEntry.Gui.Tooltip @ConfigEntry.BoundedDiscrete(min = 2, max = 12) - private int CompressionChainLength = 3; + private int CompressionChainLimit = 3; - public int getCompressionChainLength() { - return CompressionChainLength; + public int getCompressionChainLimit() { + return CompressionChainLimit; } public static void load() { diff --git a/common/src/main/java/gripe/_90/megacells/definition/MEGATranslations.java b/common/src/main/java/gripe/_90/megacells/definition/MEGATranslations.java index cc54b80d..6c915d39 100644 --- a/common/src/main/java/gripe/_90/megacells/definition/MEGATranslations.java +++ b/common/src/main/java/gripe/_90/megacells/definition/MEGATranslations.java @@ -8,7 +8,6 @@ public enum MEGATranslations implements LocalizationEnum { AcceleratorThreads("Provides 4 co-processing threads per block.", Type.TOOLTIP), ALot("A lot.", Type.TOOLTIP), Compression("Compression: %s", Type.TOOLTIP), - CompressionChainLength("Bulk Compression chain length", Type.CONFIG), Contains("Contains: %s", Type.TOOLTIP), Disabled("Disabled", Type.TOOLTIP), Empty("Empty", Type.TOOLTIP), @@ -19,14 +18,26 @@ public enum MEGATranslations implements LocalizationEnum { PartitionedFor("Partitioned for: %s", Type.TOOLTIP), ProcessingOnly("Supports processing patterns only.", Type.TOOLTIP), Quantity("Quantity: %s", Type.TOOLTIP), - NotPartitioned("Not Partitioned", Type.TOOLTIP); + NotPartitioned("Not Partitioned", Type.TOOLTIP), + + CompressionChainLimit("Bulk Compression chain limit", Type.CONFIG_OPTION), + CompressionChainLimitTooltip( + "The maximum number of variants that a compression-enabled Bulk Cell may report as being stored.", + Type.CONFIG_TOOLTIP, + CompressionChainLimit); private final String englishText; private final Type type; + private final MEGATranslations associated; MEGATranslations(String englishText, Type type) { + this(englishText, type, null); + } + + MEGATranslations(String englishText, Type type, MEGATranslations associated) { this.englishText = englishText; this.type = type; + this.associated = associated; } @Override @@ -36,15 +47,18 @@ public String getEnglishText() { @Override public String getTranslationKey() { - return type == Type.CONFIG - ? type.root.formatted(MEGACells.MODID) + "." + name() - : String.format("%s.%s.%s", type.root, MEGACells.MODID, name()); + return switch (type) { + case CONFIG_OPTION -> type.root.formatted(MEGACells.MODID) + "." + name(); + case CONFIG_TOOLTIP -> type.root.formatted(MEGACells.MODID) + "." + associated.name() + ".@Tooltip"; + default -> String.format("%s.%s.%s", type.root, MEGACells.MODID, name()); + }; } private enum Type { GUI("gui"), TOOLTIP("gui.tooltips"), - CONFIG("text.autoconfig.%s.option"); + CONFIG_OPTION("text.autoconfig.%s.option"), + CONFIG_TOOLTIP("text.autoconfig.%s.option"); private final String root; diff --git a/common/src/main/java/gripe/_90/megacells/util/CompressionChain.java b/common/src/main/java/gripe/_90/megacells/util/CompressionChain.java index ad21cfb7..7546a40b 100644 --- a/common/src/main/java/gripe/_90/megacells/util/CompressionChain.java +++ b/common/src/main/java/gripe/_90/megacells/util/CompressionChain.java @@ -50,7 +50,7 @@ public CompressionChain lastMultiplierSwapped() { } public CompressionChain limited() { - var chainLength = MEGAConfig.INSTANCE.getCompressionChainLength(); + var chainLength = MEGAConfig.INSTANCE.getCompressionChainLimit(); if (size <= chainLength) { return this;