@@ -0,0 +1,2142 @@
+package net.darkhax.bookshelf.api.util;%0A%0Aimport net.darkhax.bookshelf.mixin.entity.AccessorEntity;%0Aimport net.minecraft.network.chat.Component;%0Aimport net.minecraft.network.chat.HoverEvent;%0Aimport net.minecraft.network.chat.MutableComponent;%0Aimport net.minecraft.network.chat.TextComponent;%0Aimport net.minecraft.network.chat.TranslatableComponent;%0Aimport net.minecraft.util.StringUtil;%0Aimport net.minecraft.world.entity.Entity;%0Aimport net.minecraft.world.item.ItemStack;%0A%0Apublic final class TextHelper %7B%0A%0A    public static MutableComponent getFormatedTime(int ticks, boolean includeHover) %7B%0A%0A        MutableComponent component = new TextComponent(StringUtil.formatTickDuration(ticks));%0A%0A        if (includeHover) %7B%0A%0A            component = setHover(component, new TranslatableComponent(%22text.bookshelf.ticks%22, ticks));%0A        %7D%0A%0A        return component;%0A    %7D%0A%0A    public static %3CT extends Component%3E T setHover(T component, Component hoverInfo) %7B%0A%0A        return setHover(component, HoverEvent.Action.SHOW_TEXT, hoverInfo);%0A    %7D%0A%0A    public static %3CT extends Component%3E T setHover(T component, ItemStack hoverInfo) %7B%0A%0A        return setHover(component, HoverEvent.Action.SHOW_ITEM, new HoverEvent.ItemStackInfo(hoverInfo));%0A    %7D%0A%0A    public static %3CT extends Component%3E T setHover(T component, Entity hoverInfo) %7B%0A%0A        if (hoverInfo instanceof AccessorEntity accessor) %7B%0A%0A            return setHover(component, accessor.bookshelf$createHoverEvent());%0A        %7D%0A%0A        return setHover(component, HoverEvent.Action.SHOW_ENTITY, new HoverEvent.EntityTooltipInfo(hoverInfo.getType(), hoverInfo.getUUID(), hoverInfo.getName()));%0A    %7D%0A%0A    public static %3CT extends Component, AT, A extends HoverEvent.Action%3CAT%3E%3E T setHover(T component, A action, AT arg) %7B%0A%0A        return setHover(component, new HoverEvent(action, arg));%0A    %7D%0A%0A    public static %3CT extends Component, AT, A extends HoverEvent.Action%3CAT%3E%3E T setHover(T component, HoverEvent hoverInfo) %7B%0A%0A        if (component instanceof MutableComponent mutable) %7B%0A%0A            mutable.withStyle(style -%3E style.withHoverEvent(hoverInfo));%0A        %7D%0A%0A        return component;%0A    %7D%0A%7D%0A

Add helper for working with text components.