Skip to content

Commit

Permalink
Added client config option to hide modifiers in advanced tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightMiner committed Jun 4, 2023
1 parent 64bfa3d commit b3c974a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ public static class Client {
public final ForgeConfigSpec.BooleanValue logMissingModifierTextures;
public final ForgeConfigSpec.BooleanValue showModifiersInJEI;
public final ForgeConfigSpec.BooleanValue renderShieldSlotItem;
public final ForgeConfigSpec.BooleanValue modifiersIDsInAdvancedTooltips;
public final ForgeConfigSpec.IntValue maxSmelteryItemQuads;

// framed modifier
Expand Down Expand Up @@ -331,6 +332,11 @@ public static class Client {
"Setting this lower will cause fewer items to be renderer (but never a partial item). Set to -1 to allow unlimited quads, and 0 to disable the item renderer.")
.defineInRange("maxSmelteryItemQuads", 3500, -1, Short.MAX_VALUE);

this.modifiersIDsInAdvancedTooltips = builder
.comment("If true, shows modifier IDs in advanced tooltips for tools and tool parts.",
"They are more intrusive than most advanced tooltip content, so this option is provided in case some mod made poor design decisions and put essential gameplay info in tooltips or for pack makers who do not need modifier info.")
.define("modifiersIDsInAdvancedTooltips", true);

builder.comment("Settings related to modifiers").push("modifiers");
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import slimeknights.mantle.client.TooltipKey;
import slimeknights.tconstruct.TConstruct;
import slimeknights.tconstruct.common.TinkerTags;
import slimeknights.tconstruct.common.config.Config;
import slimeknights.tconstruct.library.client.materials.MaterialTooltipCache;
import slimeknights.tconstruct.library.materials.IMaterialRegistry;
import slimeknights.tconstruct.library.materials.MaterialRegistry;
Expand Down Expand Up @@ -322,7 +323,7 @@ public static void addModifierNames(ItemStack stack, IToolStackView tool, List<C
for (ModifierEntry entry : tool.getModifierList()) {
if (entry.getModifier().shouldDisplay(false)) {
Component name = entry.getModifier().getDisplayName(tool, entry.getLevel());
if (flag.isAdvanced()) {
if (flag.isAdvanced() && Config.CLIENT.modifiersIDsInAdvancedTooltips.get()) {
tooltips.add(new TranslatableComponent(KEY_ID_FORMAT, name, new TextComponent(entry.getModifier().getId().toString())).withStyle(ChatFormatting.DARK_GRAY));
} else {
tooltips.add(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List<Compo
if (canUseMaterial(id)) {
for (ModifierEntry entry : MaterialRegistry.getInstance().getTraits(id, getStatType())) {
Component name = entry.getModifier().getDisplayName(entry.getLevel());
if (flag.isAdvanced()) {
if (flag.isAdvanced() && Config.CLIENT.modifiersIDsInAdvancedTooltips.get()) {
tooltip.add(new TranslatableComponent(TooltipUtil.KEY_ID_FORMAT, name, new TextComponent(entry.getModifier().getId().toString())).withStyle(ChatFormatting.DARK_GRAY));
} else {
tooltip.add(name);
Expand Down

0 comments on commit b3c974a

Please sign in to comment.