Package net.neoforged.neoforge.event
Class AddAttributeTooltipsEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.AddAttributeTooltipsEvent
public class AddAttributeTooltipsEvent
extends net.neoforged.bus.api.Event
This event is fired after attribute tooltip lines have been added to an item stack's tooltip in
AttributeUtil.addAttributeTooltips(net.minecraft.world.item.ItemStack, java.util.function.Consumer<net.minecraft.network.chat.Component>, net.minecraft.world.item.component.TooltipDisplay, net.neoforged.neoforge.common.util.AttributeTooltipContext)
.
It can be used to add additional tooltip lines adjacent to the attribute lines without having to manually locate the inject point.
This event may be fired on both the logical client and logical server.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AttributeTooltipContext
protected final net.minecraft.world.item.ItemStack
protected final Consumer
<net.minecraft.network.chat.Component> -
Constructor Summary
ConstructorsConstructorDescriptionAddAttributeTooltipsEvent
(net.minecraft.world.item.ItemStack stack, Consumer<net.minecraft.network.chat.Component> tooltip, AttributeTooltipContext ctx) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTooltipLines
(net.minecraft.network.chat.Component... comps) Adds one or moreComponent
s to the tooltip.The current tooltip context.net.minecraft.world.item.ItemStack
getStack()
TheItemStack
with the tooltip.boolean
Checks if the attribute tooltips should be shown on the current item stack.
-
Field Details
-
stack
protected final net.minecraft.world.item.ItemStack stack -
tooltip
-
ctx
-
-
Constructor Details
-
AddAttributeTooltipsEvent
public AddAttributeTooltipsEvent(net.minecraft.world.item.ItemStack stack, Consumer<net.minecraft.network.chat.Component> tooltip, AttributeTooltipContext ctx)
-
-
Method Details
-
getContext
The current tooltip context. -
getStack
public net.minecraft.world.item.ItemStack getStack()TheItemStack
with the tooltip. -
addTooltipLines
public void addTooltipLines(net.minecraft.network.chat.Component... comps) Adds one or moreComponent
s to the tooltip. -
shouldShow
public boolean shouldShow()Checks if the attribute tooltips should be shown on the current item stack.This event is fired even if the component would prevent the normal tooltip lines from showing.
-