Class ConditionalTooltip
java.lang.Object
net.dillon.dillonlib.screen.ConditionalTooltip
Holds two tooltips based on the result of a boolean supplier.
- Since:
- 1.2
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConditionalTooltipempty()Uses an empty tooltip.net.minecraft.network.chat.ComponentgetTooltip(boolean shouldBeActive) Returns the tooltip based on the supplied condition.booleanisEmptyOrNullTooltip(net.minecraft.network.chat.Component tooltip) static ConditionalTooltipof(net.minecraft.network.chat.Component trueTooltip, net.minecraft.network.chat.Component falseTooltip) Uses the widget's active state as the condition.static ConditionalTooltipofActive(net.minecraft.network.chat.Component trueTooltip) Uses a constant active tooltip.static ConditionalTooltipofCondition(BooleanSupplier condition, net.minecraft.network.chat.Component trueTooltip, net.minecraft.network.chat.Component falseTooltip) Uses a custom condition instead of the widget's active state.
-
Method Details
-
ofCondition
public static ConditionalTooltip ofCondition(BooleanSupplier condition, net.minecraft.network.chat.Component trueTooltip, net.minecraft.network.chat.Component falseTooltip) Uses a custom condition instead of the widget's active state. -
of
public static ConditionalTooltip of(net.minecraft.network.chat.Component trueTooltip, net.minecraft.network.chat.Component falseTooltip) Uses the widget's active state as the condition. -
empty
Uses an empty tooltip. -
ofActive
Uses a constant active tooltip. -
getTooltip
public net.minecraft.network.chat.Component getTooltip(boolean shouldBeActive) Returns the tooltip based on the supplied condition.- Parameters:
shouldBeActive- the widget's active-state supplier, used when no custom condition was supplied
-
isEmptyOrNullTooltip
public boolean isEmptyOrNullTooltip(net.minecraft.network.chat.Component tooltip) - Returns:
- whether the tooltip is empty or null.
-