Skip to content

Commit

Permalink
refactor(client): check debug mod and shift key before adding lines t…
Browse files Browse the repository at this point in the history
…o advanced tooltip
  • Loading branch information
WakelessSloth56 committed Aug 10, 2022
1 parent edda7c0 commit 44d33d3
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -2,10 +2,10 @@

import static org.auioc.mcmod.arnicalib.utils.game.TextUtils.I18nText;
import static org.auioc.mcmod.arnicalib.utils.game.TextUtils.StringText;
import com.mojang.blaze3d.platform.InputConstants;
import org.auioc.mcmod.arnicalib.ArnicaLib;
import org.auioc.mcmod.arnicalib.client.config.ClientConfig;
import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.platform.InputConstants;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.nbt.NbtUtils;
Expand All @@ -25,6 +25,8 @@ public class TooltipEventHandler {

public static void handle(ItemTooltipEvent event) {
if (!ClientConfig.EnableAdvancedTooltip.get()) return;
if (ClientConfig.AdvancedTooltipOnlyOnDebug.get() && !isDebugMode()) return;
if (ClientConfig.AdvancedTooltipOnlyOnShift.get() && !isShiftKeyDown()) return;

ItemStack itemStack = event.getItemStack();
if (itemStack.isEmpty()) return;
Expand Down Expand Up @@ -55,8 +57,6 @@ public static void handle(ItemTooltipEvent event) {
}

private static void addLine(ItemTooltipEvent event, Component tooltip) {
if (ClientConfig.AdvancedTooltipOnlyOnDebug.get() && !isDebugMode()) return;
if (ClientConfig.AdvancedTooltipOnlyOnShift.get() && !isShiftKeyDown()) return;
event.getToolTip().add(tooltip);
}

Expand Down

0 comments on commit 44d33d3

Please sign in to comment.