add sealing descriptions to tooltips/names as appropriate

This commit is contained in:
yrsegal@gmail.com 2022-04-23 16:45:36 -04:00
parent 7dabb7ef09
commit d6287187be
18 changed files with 52 additions and 8 deletions

View file

@ -40,6 +40,11 @@ public class ItemFocus extends Item implements DataHolderItem {
return tag.getCompound(TAG_DATA);
}
@Override
public String getDescriptionId(ItemStack stack) {
return super.getDescriptionId(stack) + (stack.hasTag() && stack.getTag().getBoolean(TAG_SEALED) ? ".sealed" : "");
}
@Override
public @Nullable SpellDatum<?> emptyDatum(ItemStack stack) {
return SpellDatum.make(Widget.NULL);

View file

@ -40,20 +40,38 @@ public class ItemSpellbook extends Item implements DataHolderItem {
@Override
public void appendHoverText(ItemStack stack, @Nullable Level level, List<Component> tooltip,
TooltipFlag isAdvanced) {
boolean sealed = IsSealed(stack);
var tag = stack.getOrCreateTag();
if (tag.contains(TAG_SELECTED_PAGE, Tag.TAG_ANY_NUMERIC)) {
var pageIdx = tag.getInt(TAG_SELECTED_PAGE);
int highest = HighestPage(stack);
if (highest != 0) {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.page",
new TextComponent(String.valueOf(pageIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(highest)).withStyle(ChatFormatting.WHITE))
.withStyle(ChatFormatting.GRAY));
if (sealed)
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.page.sealed",
new TextComponent(String.valueOf(pageIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(highest)).withStyle(ChatFormatting.WHITE),
new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD))
.withStyle(ChatFormatting.GRAY));
else
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.page",
new TextComponent(String.valueOf(pageIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(highest)).withStyle(ChatFormatting.WHITE))
.withStyle(ChatFormatting.GRAY));
} else {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.empty").withStyle(ChatFormatting.GRAY));
if (sealed)
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.empty.sealed",
new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD))
.withStyle(ChatFormatting.GRAY));
else
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.empty").withStyle(ChatFormatting.GRAY));
}
} else {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.empty").withStyle(ChatFormatting.GRAY));
if (sealed)
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.empty.sealed",
new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD))
.withStyle(ChatFormatting.GRAY));
else
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.empty").withStyle(ChatFormatting.GRAY));
}
DataHolderItem.appendHoverText(this, stack, tooltip, isAdvanced);

View file

@ -62,14 +62,30 @@ public record MsgShiftScrollSyn(InteractionHand hand, double scrollDelta, boolea
var newIdx = tag.getInt(ItemSpellbook.TAG_SELECTED_PAGE);
var len = ItemSpellbook.HighestPage(stack);
var sealed = ItemSpellbook.IsSealed(stack);
MutableComponent component;
if (hand == InteractionHand.OFF_HAND && stack.hasCustomHoverName()) {
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page_with_name",
if (sealed)
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page_with_name.sealed",
new TextComponent(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(len)).withStyle(ChatFormatting.WHITE),
new TextComponent("").withStyle(stack.getRarity().color, ChatFormatting.ITALIC).append(stack.getHoverName()),
new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD));
else
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page_with_name",
new TextComponent(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(len)).withStyle(ChatFormatting.WHITE),
new TextComponent("").withStyle(stack.getRarity().color, ChatFormatting.ITALIC).append(stack.getHoverName()));
} else {
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page",
if (sealed)
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page.sealed",
new TextComponent(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(len)).withStyle(ChatFormatting.WHITE),
new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD));
else
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page",
new TextComponent(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(len)).withStyle(ChatFormatting.WHITE));
}

View file

@ -10,6 +10,7 @@
"item.hexcasting.wand_warped": "Warped Staff",
"item.hexcasting.wand_akashic": "Edified Staff",
"item.hexcasting.focus": "Focus",
"item.hexcasting.focus.sealed": "Sealed Focus",
"item.hexcasting.spellbook": "Spellbook",
"item.hexcasting.cypher": "Cypher",
"item.hexcasting.trinket": "Trinket",
@ -97,8 +98,12 @@
"itemGroup.hexcasting": "Hexcasting",
"hexcasting.tooltip.spellbook.page": "Selected Page %d/%d",
"hexcasting.tooltip.spellbook.page.sealed": "Selected Page %d/%d (%s)",
"hexcasting.tooltip.spellbook.page_with_name": "Selected Page %d/%d (\"%s\")",
"hexcasting.tooltip.spellbook.page_with_name.sealed": "Selected Page %d/%d (\"%s\") (%s)",
"hexcasting.tooltip.spellbook.sealed": "Sealed",
"hexcasting.tooltip.spellbook.empty": "Empty",
"hexcasting.tooltip.spellbook.empty.sealed": "Empty (%s)",
"hexcasting.tooltip.abacus": "%d",
"hexcasting.tooltip.abacus.reset": "Reset to 0",
"hexcasting.tooltip.abacus.reset.nice": "nice",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 568 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 566 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 570 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 572 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 535 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 566 B

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB