Changed Crystalite armor tooltips registration
This commit is contained in:
parent
7f40d46ac2
commit
990dccd1b5
7 changed files with 129 additions and 33 deletions
32
src/main/java/ru/betterend/events/ItemTooltipCallback.java
Normal file
32
src/main/java/ru/betterend/events/ItemTooltipCallback.java
Normal 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue