Interface EventHelper
public interface EventHelper
A modloader agnostic helper for registering status effect tooltip events.
*
Example: *
* EffectTooltips.EVENTS.addListener((effect, tooltip, compact, flag) -> {
* tooltip.add(Component.literal("Custom tooltip line"));
* });
* -
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddListener(StatusEffectTooltipListener listener) Registers an event listener that will be notified when the status effect tooltip entries are built.voidaddListener(TooltipLayout layout, StatusEffectTooltipListener listener) Registers an event listener that will be notified when the status effect tooltip entries are built.voidbuildTooltipContents(net.minecraft.world.effect.MobEffectInstance effect, List<net.minecraft.network.chat.Component> entries, boolean compact, net.minecraft.world.item.TooltipFlag flag) Posts an event for gathering status effect tooltip entries.
-
Method Details
-
buildTooltipContents
void buildTooltipContents(net.minecraft.world.effect.MobEffectInstance effect, List<net.minecraft.network.chat.Component> entries, boolean compact, net.minecraft.world.item.TooltipFlag flag) Posts an event for gathering status effect tooltip entries.- Parameters:
effect- The effect to gather entries for.entries- The list of entries to populate.compact- Is the status effect being rendered in compact mode?flag- The current flags for rendering tooltips.
-
addListener
Registers an event listener that will be notified when the status effect tooltip entries are built.- Parameters:
listener- The event listener to register.
-
addListener
Registers an event listener that will be notified when the status effect tooltip entries are built.- Parameters:
layout- Determines the ordering and priority of the event listener.listener- The event listener to register.
-