Skip to content

Commit

Permalink
fix: when reward is a simple item reward, show proper item tooltip on…
Browse files Browse the repository at this point in the history
  • Loading branch information
desht committed Nov 29, 2023
1 parent 3353453 commit b863c51
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@
import dev.ftb.mods.ftblibrary.util.TooltipList;
import dev.ftb.mods.ftblibrary.util.client.PositionedIngredient;
import dev.ftb.mods.ftbquests.client.ClientQuestFile;
import dev.ftb.mods.ftbquests.client.FTBQClientProxy;
import dev.ftb.mods.ftbquests.client.FTBQuestsClient;
import dev.ftb.mods.ftbquests.client.gui.ContextMenuBuilder;
import dev.ftb.mods.ftbquests.quest.reward.ItemReward;
import dev.ftb.mods.ftbquests.quest.reward.Reward;
import dev.ftb.mods.ftbquests.quest.theme.property.ThemeProperties;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -46,7 +50,13 @@ public void addMouseOverText(TooltipList list) {
questScreen.addInfoTooltip(list, reward);

if (reward.addTitleInMouseOverText()) {
list.add(getTitle());
if (reward instanceof ItemReward itemReward) {
TooltipFlag.Default flag = Minecraft.getInstance().options.advancedItemTooltips ? TooltipFlag.ADVANCED : TooltipFlag.NORMAL;
itemReward.getItem().getTooltipLines(FTBQuestsClient.getClientPlayer(), flag)
.forEach(list::add);
} else {
list.add(getTitle());
}
}

if (reward.isTeamReward() || questScreen.file.selfTeamData.isRewardBlocked(reward)) {
Expand Down

0 comments on commit b863c51

Please sign in to comment.