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
FieldsModifier and TypeFieldDescriptionstatic final BlockStateAn "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 voidappendBody(ITooltip tooltip, IBlockAccessor accessor, IPluginConfig config) Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).default voidappendDataContext(IDataWriter ctx, IBlockAccessor accessor, IPluginConfig config) Callback used to send additional context toIDataProviders.default voidappendHead(ITooltip tooltip, IBlockAccessor accessor, IPluginConfig config) Callback used to add lines to one of the three sections of the tooltip (Head, Body, Tail).default voidappendTail(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 ITooltipComponentgetIcon(IBlockAccessor accessor, IPluginConfig config) Callback used to set an icon to display in the tooltip.default @Nullable BlockStategetOverride(IBlockAccessor accessor, IPluginConfig config) Callback used to override the default Waila lookup system.default ITargetRedirector.Resultredirect(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:
nullif this method doesn't redirect to anything, any result from one ofITargetRedirector's methods otherwise- See Also:
-
appendDataContext
Callback used to send additional context toIDataProviders.- 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
IDataProviderand 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:
nullif override is not required, aBlockStateotherwise- 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
IDataProviderand 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
nullif 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
IDataProviderand 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 fromWailaConstantsto 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
IDataProviderand 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 fromWailaConstantsto 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
IDataProviderand 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 fromWailaConstantsto override built-in valuesaccessor- contains most of the relevant information about the current environmentconfig- current plugin configuration- See Also:
-