TotemItem:
- Replaced old TextComponents with Component.literal.
This commit is contained in:
@ -9,7 +9,6 @@ import dev.micle.totemofreviving.network.client.ReviveTargetPacket;
|
||||
import dev.micle.totemofreviving.setup.ModKeyMappings;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.stats.Stats;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
@ -167,38 +166,38 @@ public abstract class TotemItem extends Item {
|
||||
|
||||
if (getConfig(stack).getIsEnabled()) {
|
||||
if (targetUUID == null) {
|
||||
tooltip.add(new TextComponent(ChatFormatting.RED + "Target: " + ChatFormatting.DARK_RED + "NONE"));
|
||||
tooltip.add(Component.literal(ChatFormatting.RED + "Target: " + ChatFormatting.DARK_RED + "NONE"));
|
||||
} else {
|
||||
tooltip.add(new TextComponent(ChatFormatting.WHITE + "Target: " + ChatFormatting.GRAY + targetName));
|
||||
tooltip.add(Component.literal(ChatFormatting.WHITE + "Target: " + ChatFormatting.GRAY + targetName));
|
||||
}
|
||||
tooltip.add(new TextComponent(""));
|
||||
tooltip.add(Component.literal(""));
|
||||
if (!canTotemAffordTarget(stack)) {
|
||||
tooltip.add(new TextComponent(ChatFormatting.RED + "Charges: " + ChatFormatting.DARK_RED + "(" + charge + "/" + targetCost + ") " +
|
||||
tooltip.add(Component.literal(ChatFormatting.RED + "Charges: " + ChatFormatting.DARK_RED + "(" + charge + "/" + targetCost + ") " +
|
||||
ChatFormatting.RED + "[Max: " + ChatFormatting.DARK_RED + maxCharge + ChatFormatting.RED + "] [Multi: " + ChatFormatting.DARK_RED + multiplier + ChatFormatting.RED + "]"));
|
||||
} else {
|
||||
tooltip.add(new TextComponent(ChatFormatting.WHITE + "Charges: " + ChatFormatting.GRAY + "(" + charge + "/" + targetCost + ") " +
|
||||
tooltip.add(Component.literal(ChatFormatting.WHITE + "Charges: " + ChatFormatting.GRAY + "(" + charge + "/" + targetCost + ") " +
|
||||
ChatFormatting.WHITE + "[Max: " + ChatFormatting.GRAY + maxCharge + ChatFormatting.WHITE + "] [Multi: " + ChatFormatting.GRAY + multiplier + ChatFormatting.WHITE + "]"));
|
||||
}
|
||||
if (canReviveMoreExpensiveTargets(stack)) {
|
||||
tooltip.add(new TextComponent(ChatFormatting.WHITE + "Can revive more expensive targets."));
|
||||
tooltip.add(Component.literal(ChatFormatting.WHITE + "Can revive more expensive targets."));
|
||||
}
|
||||
if (canReviveAcrossDimensions(stack)) {
|
||||
tooltip.add(new TextComponent(ChatFormatting.WHITE + "Can revive targets across dimensions."));
|
||||
tooltip.add(Component.literal(ChatFormatting.WHITE + "Can revive targets across dimensions."));
|
||||
}
|
||||
tooltip.add(new TextComponent(""));
|
||||
tooltip.add(Component.literal(""));
|
||||
if (ModKeyMappings.ADVANCED_TOOLTIP.isDown()) {
|
||||
tooltip.add(new TextComponent(ChatFormatting.GRAY + "Showing advanced tooltip."));
|
||||
tooltip.add(new TextComponent(ChatFormatting.WHITE + "[" + ChatFormatting.GRAY + "R-CLICK" + ChatFormatting.WHITE + "]"));
|
||||
tooltip.add(new TextComponent(ChatFormatting.WHITE + "When second hand is empty: revive target."));
|
||||
tooltip.add(new TextComponent(ChatFormatting.WHITE + "When second hand is holding a reviving charge: charge totem."));
|
||||
tooltip.add(new TextComponent(""));
|
||||
tooltip.add(new TextComponent(ChatFormatting.WHITE + "[" + ChatFormatting.GRAY + "L-SHIFT + R-CLICK" + ChatFormatting.WHITE + "]"));
|
||||
tooltip.add(new TextComponent(ChatFormatting.WHITE + "Change target."));
|
||||
tooltip.add(Component.literal(ChatFormatting.GRAY + "Showing advanced tooltip."));
|
||||
tooltip.add(Component.literal(ChatFormatting.WHITE + "[" + ChatFormatting.GRAY + "R-CLICK" + ChatFormatting.WHITE + "]"));
|
||||
tooltip.add(Component.literal(ChatFormatting.WHITE + "When second hand is empty: revive target."));
|
||||
tooltip.add(Component.literal(ChatFormatting.WHITE + "When second hand is holding a reviving charge: charge totem."));
|
||||
tooltip.add(Component.literal(""));
|
||||
tooltip.add(Component.literal(ChatFormatting.WHITE + "[" + ChatFormatting.GRAY + "L-SHIFT + R-CLICK" + ChatFormatting.WHITE + "]"));
|
||||
tooltip.add(Component.literal(ChatFormatting.WHITE + "Change target."));
|
||||
} else {
|
||||
tooltip.add(new TextComponent(ChatFormatting.GRAY + "Hold [" + ChatFormatting.DARK_GRAY + "L-SHIFT" + ChatFormatting.GRAY + "] for advanced tooltip."));
|
||||
tooltip.add(Component.literal(ChatFormatting.GRAY + "Hold [" + ChatFormatting.DARK_GRAY + "L-SHIFT" + ChatFormatting.GRAY + "] for advanced tooltip."));
|
||||
}
|
||||
} else {
|
||||
tooltip.add(new TextComponent(ChatFormatting.RED + "Totem is disabled!"));
|
||||
tooltip.add(Component.literal(ChatFormatting.RED + "Totem is disabled!"));
|
||||
}
|
||||
super.appendHoverText(stack, world, tooltip, tooltipFlag);
|
||||
}
|
||||
|
Reference in New Issue
Block a user