Updated totem tooltip to display general durability information.

This commit is contained in:
2026-01-18 00:35:15 +01:00
parent 27634a9bdf
commit ef50e0084c
3 changed files with 12 additions and 6 deletions

View File

@ -12,7 +12,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.core.component.DataComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.players.PlayerList;
import net.minecraft.stats.Stats;
@ -215,6 +214,14 @@ public abstract class TotemItem extends Item {
Component.literal(String.format("%d / %d", totemData.getCharge(), getMaxCharge())).withStyle(ChatFormatting.WHITE)
).withStyle(ChatFormatting.GRAY));
tooltipComponents.add(
stack.isDamageableItem()
? LangAsset.TOOLTIP_TOTEM_DURABILITY.getComponent(
Component.literal(String.format("%d / %d", stack.getMaxDamage() - stack.getDamageValue(), stack.getMaxDamage())).withStyle(ChatFormatting.WHITE)
).withStyle(ChatFormatting.GRAY)
: LangAsset.GENERAL_UNBREAKABLE.getComponent().withStyle(ChatFormatting.WHITE)
);
tooltipComponents.add(Component.empty());
if (isChargeCostDynamic()) {
tooltipComponents.add(LangAsset.TOOLTIP_TOTEM_DYNAMIC_COST.getComponent(
@ -227,9 +234,6 @@ public abstract class TotemItem extends Item {
if (getConfig().getCanReviveAcrossDimensions()) {
tooltipComponents.add(LangAsset.TOOLTIP_TOTEM_CAN_REVIVE_ACROSS_DIMENSIONS.getComponent().withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC));
}
if (!stack.isDamageableItem()) {
tooltipComponents.add(LangAsset.TOOLTIP_TOTEM_IS_UNBREAKABLE.getComponent().withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC));
}
tooltipComponents.add(Component.empty());

View File

@ -18,10 +18,10 @@ public enum LangAsset {
TOOLTIP_TOTEM_TARGET("tooltip", "totem_target"),
TOOLTIP_TOTEM_TARGET_COST("tooltip", "totem_target_cost"),
TOOLTIP_TOTEM_CHARGES("tooltip", "totem_charges"),
TOOLTIP_TOTEM_DURABILITY("tooltip", "totem_durability"),
TOOLTIP_TOTEM_DYNAMIC_COST("tooltip", "totem_dynamic_cost"),
TOOLTIP_TOTEM_CAN_REVIVE_MORE_EXPENSIVE_TARGETS("tooltip", "totem_can_revive_more_expensive_targets"),
TOOLTIP_TOTEM_CAN_REVIVE_ACROSS_DIMENSIONS("tooltip", "totem_can_revive_across_dimensions"),
TOOLTIP_TOTEM_IS_UNBREAKABLE("tooltip", "totem_is_unbreakable"),
TOOLTIP_TOTEM_REVIVE_INSTRUCTION("tooltip", "totem_revive_instruction"),
TOOLTIP_TOTEM_CHARGE_INSTRUCTION("tooltip", "totem_charge_instruction"),
TOOLTIP_TOTEM_CHANGE_TARGET_INSTRUCTION("tooltip", "totem_change_target_instructions"),
@ -29,6 +29,7 @@ public enum LangAsset {
TOOLTIP_ADVANCED_TOOLTIP_HIDDEN("tooltip", "advanced_tooltip_hidden"),
TOOLTIP_ADVANCED_TOOLTIP_SHOWN("tooltip", "advanced_tooltip_shown"),
GENERAL_NA("general", "na"),
GENERAL_UNBREAKABLE("general", "unbreakable"),
MESSAGE_UNABLE_TO_FIND_PLAYER("message", "unable_to_find_player"),
MESSAGE_PLAYER_IS_NOT_DEAD("message", "player_is_not_dead"),
MESSAGE_PLAYER_IS_IN_ANOTHER_DIMENSION("message", "player_is_in_another_dimension"),

View File

@ -11,10 +11,10 @@
"tooltip.totem_of_reviving.totem_target": "Target: %s",
"tooltip.totem_of_reviving.totem_target_cost": "Cost: %s",
"tooltip.totem_of_reviving.totem_charges": "Charges: %s",
"tooltip.totem_of_reviving.totem_durability": "Durability: %s",
"tooltip.totem_of_reviving.totem_dynamic_cost": "Dynamic cost (Multiplier: %s).",
"tooltip.totem_of_reviving.totem_can_revive_more_expensive_targets": "Can revive more expensive targets.",
"tooltip.totem_of_reviving.totem_can_revive_across_dimensions": "Can revive across dimensions.",
"tooltip.totem_of_reviving.totem_is_unbreakable": "Unbreakable.",
"tooltip.totem_of_reviving.totem_revive_instruction": "When second hand is empty: revive target.",
"tooltip.totem_of_reviving.totem_charge_instruction": "When second hand has a reviving charge: charge totem.",
"tooltip.totem_of_reviving.totem_change_target_instructions": "Change target.",
@ -22,6 +22,7 @@
"tooltip.totem_of_reviving.advanced_tooltip_hidden": "Hold %s for advanced tooltip.",
"tooltip.totem_of_reviving.advanced_tooltip_shown": "Showing advanced tooltip:",
"general.totem_of_reviving.na": "N/A",
"general.totem_of_reviving.unbreakable": "Unbreakable.",
"message.totem_of_reviving.unable_to_find_player": "Unable to find player!",
"message.totem_of_reviving.player_is_not_dead": "%s is not dead!",
"message.totem_of_reviving.player_is_in_another_dimension": "%s is in a different dimension!",