Interface IBlockComponentProvider
Block
/BlockEntity
tooltip information to Waila.
All methods in this interface shouldn't to be called by the implementing mod.
An instance of the class is to be registered via the IClientRegistrar
instance provided in IWailaClientPlugin
.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final BlockState
An "empty" block state to be used withgetOverride(mcp.mobius.waila.api.IBlockAccessor, mcp.mobius.waila.api.IPluginConfig)
, effectively disabling the tooltip to be displayed. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
appendBody
(ITooltip tooltip, IBlockAccessor accessor, IPluginConfig config) Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).default void
appendDataContext
(IDataWriter ctx, IBlockAccessor accessor, IPluginConfig config) Callback used to send additional context toIDataProvider
s.default void
appendHead
(ITooltip tooltip, IBlockAccessor accessor, IPluginConfig config) Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).default void
appendTail
(ITooltip tooltip, IBlockAccessor accessor, IPluginConfig config) Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).default @Nullable ITooltipComponent
getIcon
(IBlockAccessor accessor, IPluginConfig config) Callback used to set an icon to display in the tooltip.default @Nullable BlockState
getOverride
(IBlockAccessor accessor, IPluginConfig config) Callback used to override the default Waila lookup system.default ITargetRedirector.Result
redirect
(ITargetRedirector redirect, IBlockAccessor accessor, IPluginConfig config) Redirect the ray cast hit result to target other object.
-
Field Details
-
EMPTY_BLOCK_STATE
An "empty" block state to be used withgetOverride(mcp.mobius.waila.api.IBlockAccessor, mcp.mobius.waila.api.IPluginConfig)
, effectively disabling the tooltip to be displayed.Note: Waila will use
==
instead ofObject.equals(java.lang.Object)
to check for this.
-
-
Method Details
-
redirect
@Nullable @Experimental default ITargetRedirector.Result redirect(ITargetRedirector redirect, IBlockAccessor accessor, IPluginConfig config) Redirect the ray cast hit result to target other object.- Parameters:
redirect
- the redirectoraccessor
- contains most of the relevant information about the current environment. Note thatIBlockAccessor.getData()
will always be empty at this timeconfig
- current plugin configuration- Returns:
null
if this method doesn't redirect to anything, any result from one ofITargetRedirector
's methods otherwise- See Also:
-
appendDataContext
Callback used to send additional context toIDataProvider
s.- Parameters:
ctx
- the context writeraccessor
- contains most of the relevant information about the current environment. Note thatIBlockAccessor.getData()
will always be empty at this timeconfig
- current plugin configuration- See Also:
-
getOverride
Callback used to override the default Waila lookup system.This method is only called on the client side. If you require data from the server, you should also implement
IDataProvider
and add the data there, which can then be read back usingIBlockAccessor.getData()
. If you rely on the client knowing the data you need, you are not guaranteed to have the proper values.- Parameters:
accessor
- contains most of the relevant information about the current environmentconfig
- current plugin configuration- Returns:
null
if override is not required, aBlockState
otherwise- See Also:
-
getIcon
@Nullable default @Nullable ITooltipComponent getIcon(IBlockAccessor accessor, IPluginConfig config) Callback used to set an icon to display in the tooltip.This method is only called on the client side. If you require data from the server, you should also implement
IDataProvider
and add the data there, which can then be read back usingIBlockAccessor.getData()
. If you rely on the client knowing the data you need, you are not guaranteed to have the proper values.- Parameters:
accessor
- contains most of the relevant information about the current environmentconfig
- current plugin configuration- Returns:
- the component to render or
null
if this provider doesn't decide it - See Also:
-
appendHead
Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).This method is only called on the client side. If you require data from the server, you should also implement
IDataProvider
and add the data there, which can then be read back usingIBlockAccessor.getData()
. If you rely on the client knowing the data you need, you are not guaranteed to have the proper values.- Parameters:
tooltip
- current list of tooltip lines (might have been processed by other providers and might be processed by other providers), useITooltip.setLine(net.minecraft.resources.ResourceLocation)
with tags fromWailaConstants
to override built-in valuesaccessor
- contains most of the relevant information about the current environmentconfig
- current plugin configuration- See Also:
-
appendBody
Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).This method is only called on the client side. If you require data from the server, you should also implement
IDataProvider
and add the data there, which can then be read back usingIBlockAccessor.getData()
. If you rely on the client knowing the data you need, you are not guaranteed to have the proper values.- Parameters:
tooltip
- current list of tooltip lines (might have been processed by other providers and might be processed by other providers), useITooltip.setLine(net.minecraft.resources.ResourceLocation)
with tags fromWailaConstants
to override built-in valuesaccessor
- contains most of the relevant information about the current environmentconfig
- current plugin configuration- See Also:
-
appendTail
Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).This method is only called on the client side. If you require data from the server, you should also implement
IDataProvider
and add the data there, which can then be read back usingIBlockAccessor.getData()
. If you rely on the client knowing the data you need, you are not guaranteed to have the proper values.- Parameters:
tooltip
- current list of tooltip lines (might have been processed by other providers and might be processed by other providers), useITooltip.setLine(net.minecraft.resources.ResourceLocation)
with tags fromWailaConstants
to override built-in valuesaccessor
- contains most of the relevant information about the current environmentconfig
- current plugin configuration- See Also:
-