Changed Crystalite armor tooltips registration

This commit is contained in:
Aleksey 2021-05-18 09:43:31 +03:00
parent 7f40d46ac2
commit 990dccd1b5
7 changed files with 129 additions and 33 deletions

View file

@ -0,0 +1,32 @@
package ru.betterend.events;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import java.util.List;
@Environment(EnvType.CLIENT)
public interface ItemTooltipCallback {
/**
* Fired after the game has appended all base tooltip lines to the list.
*/
Event<ItemTooltipCallback> EVENT = EventFactory.createArrayBacked(ItemTooltipCallback.class, callbacks -> (player, stack, context, lines) -> {
for (ItemTooltipCallback callback : callbacks) {
callback.getTooltip(player, stack, context, lines);
}
});
/**
* Called when an item stack's tooltip is rendered. Text added to {@code lines} will be
* rendered with the tooltip.
*
* @param lines the list containing the lines of text displayed on the stack's tooltip
*/
void getTooltip(Player player, ItemStack stack, TooltipFlag context, List<Component> lines);
}