ChargeItem:

- Replaced old TextComponents with Component.literal.
This commit is contained in:
Micle
2022-11-03 21:30:56 +00:00
parent 600cd282df
commit 274d0c8af0

View File

@ -4,7 +4,6 @@ import dev.micle.totemofreviving.TotemOfReviving;
import dev.micle.totemofreviving.setup.Config;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -31,9 +30,9 @@ public class ChargeItem extends Item {
@ParametersAreNonnullByDefault
public void appendHoverText(ItemStack stack, @Nullable Level world, List<Component> tooltip, TooltipFlag tooltipFlag) {
if (isEnabled(stack)) {
tooltip.add(new TextComponent(ChatFormatting.WHITE + "Used for charging its corresponding totem."));
tooltip.add(Component.literal(ChatFormatting.WHITE + "Used for charging its corresponding totem."));
} 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);
}