Class GatherSkippedAttributeTooltipsEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.GatherSkippedAttributeTooltipsEvent

public class GatherSkippedAttributeTooltipsEvent extends net.neoforged.bus.api.Event
This event is used to collect the IDs of attribute modifiers that will not be displayed in item tooltips.

It allows hiding some (or all) of the modifiers, potentially for displaying them in an alternative way (or for hiding information from the player).

This event may be fired on both the logical client and logical server.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final AttributeTooltipContext
     
    private boolean
     
    private @Nullable Set<net.minecraft.world.entity.EquipmentSlotGroup>
     
    private @Nullable Set<net.minecraft.resources.ResourceLocation>
     
    protected final net.minecraft.world.item.ItemStack
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    GatherSkippedAttributeTooltipsEvent(net.minecraft.world.item.ItemStack stack, AttributeTooltipContext ctx)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    The current tooltip context.
    protected Set<net.minecraft.world.entity.EquipmentSlotGroup>
    Initializes skippedGroups if necessary, and returns it.
    protected Set<net.minecraft.resources.ResourceLocation>
    Initializes skippedIds if necessary, and returns it.
    net.minecraft.world.item.ItemStack
    The ItemStack with the tooltip.
    boolean
    isSkipped(net.minecraft.resources.ResourceLocation id)
    Checks if a given id is skipped or not.
    boolean
    isSkipped(net.minecraft.world.entity.EquipmentSlotGroup group)
    Checks if a given group is skipped or not.
    boolean
    Checks if the event will cause all attribute modifiers to be skipped.
    void
    setSkipAll(boolean skip)
    Sets if the event should skip displaying all attribute modifiers.
    void
    skipGroup(net.minecraft.world.entity.EquipmentSlotGroup group)
    Marks an entire EquipmentSlotGroup as skipped, preventing all modifiers for that group from showing.
    void
    skipId(net.minecraft.resources.ResourceLocation id)
    Marks the id of a specific attribute modifier as skipped, causing it to not be displayed in the tooltip.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • stack

      protected final net.minecraft.world.item.ItemStack stack
    • ctx

      protected final AttributeTooltipContext ctx
    • skippedIds

      @Nullable private @Nullable Set<net.minecraft.resources.ResourceLocation> skippedIds
    • skippedGroups

      @Nullable private @Nullable Set<net.minecraft.world.entity.EquipmentSlotGroup> skippedGroups
    • skipAll

      private boolean skipAll
  • Constructor Details

    • GatherSkippedAttributeTooltipsEvent

      public GatherSkippedAttributeTooltipsEvent(net.minecraft.world.item.ItemStack stack, AttributeTooltipContext ctx)
  • Method Details

    • getContext

      public AttributeTooltipContext getContext()
      The current tooltip context.
    • getStack

      public net.minecraft.world.item.ItemStack getStack()
      The ItemStack with the tooltip.
    • skipId

      public void skipId(net.minecraft.resources.ResourceLocation id)
      Marks the id of a specific attribute modifier as skipped, causing it to not be displayed in the tooltip.
    • skipGroup

      public void skipGroup(net.minecraft.world.entity.EquipmentSlotGroup group)
      Marks an entire EquipmentSlotGroup as skipped, preventing all modifiers for that group from showing.
    • isSkipped

      public boolean isSkipped(net.minecraft.resources.ResourceLocation id)
      Checks if a given id is skipped or not. If all modifiers are skipped, this method always returns true.
    • isSkipped

      public boolean isSkipped(net.minecraft.world.entity.EquipmentSlotGroup group)
      Checks if a given group is skipped or not. If all modifiers are skipped, this method always returns true.
    • setSkipAll

      public void setSkipAll(boolean skip)
      Sets if the event should skip displaying all attribute modifiers.
    • isSkippingAll

      public boolean isSkippingAll()
      Checks if the event will cause all attribute modifiers to be skipped.
    • getSkippedIds

      protected Set<net.minecraft.resources.ResourceLocation> getSkippedIds()
      Initializes skippedIds if necessary, and returns it.
    • getSkippedGroups

      protected Set<net.minecraft.world.entity.EquipmentSlotGroup> getSkippedGroups()
      Initializes skippedGroups if necessary, and returns it.