Skip to content

Commit

Permalink
Improved strings
Browse files Browse the repository at this point in the history
  • Loading branch information
maxanier committed Jul 14, 2024
1 parent 43800ad commit 675cff1
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@ public interface IFactionExclusiveItem extends ItemLike {

default void addFactionToolTips(@NotNull ItemStack stack, @Nullable Item.TooltipContext context, @NotNull List<Component> tooltip, TooltipFlag flagIn, @Nullable Player player) {
addOilDescTooltip(stack, context, tooltip, flagIn, player);
tooltip.add(Component.empty());
tooltip.add(Component.translatable("text.vampirism.faction_specifics").withStyle(ChatFormatting.GRAY));
ChatFormatting color = ChatFormatting.GRAY;
IFaction<?> faction = getExclusiveFaction(stack);

if (faction != null) {
if (player != null) {
color = VampirismAPI.factionRegistry().getFaction(player) == faction ? ChatFormatting.DARK_GREEN : ChatFormatting.DARK_RED;
}
tooltip.add(Component.literal(" ").append(faction.getName()).append(Component.translatable("text.vampirism.faction_only")).withStyle(color));
tooltip.add(Component.empty());
tooltip.add(Component.translatable("text.vampirism.faction_exclusive", faction.getName().copy().withStyle(color)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ public void onItemToolTip(@NotNull ItemTooltipEvent event) {
}
List<Component> factionToolTips = new ArrayList<>();
factionToolTips.add(Component.empty());
factionToolTips.add(Component.translatable("text.vampirism.faction_specifics").withStyle(ChatFormatting.GRAY));
factionToolTips.add(Component.literal(" ").append(VReference.HUNTER_FACTION.getName()).append(Component.translatable("text.vampirism.faction_only")).withStyle(Minecraft.getInstance().player != null ? Helper.isHunter(Minecraft.getInstance().player) ? ChatFormatting.DARK_GREEN : ChatFormatting.DARK_RED : ChatFormatting.GRAY));
factionToolTips.add(Component.translatable("text.vampirism.faction_exclusive", VReference.HUNTER_FACTION.getName().copy().withStyle(Minecraft.getInstance().player != null ? Helper.isHunter(Minecraft.getInstance().player) ? ChatFormatting.DARK_GREEN : ChatFormatting.DARK_RED : ChatFormatting.GRAY)));
toolTips.addAll(Math.min(event.getToolTip().size(), position), factionToolTips);
});
}
Expand Down
Loading

0 comments on commit 675cff1

Please sign in to comment.