Package com.samsthenerd.inline.api
Interface InlineData<Self extends InlineData<Self>>
- All Known Implementing Classes:
EntityInlineData
,ItemInlineData
,ModIconData
,PlayerHeadData
,SpriteInlineData
public interface InlineData<Self extends InlineData<Self>>
Represents some arbitrary data that should be renderered with the
specified
InlineRenderer
.
For the data to be rendered, it must be attached to some Text's Style.
Usually this is done by an InlineMatcher
on the client so that the data
can be easily attached anywhere with plain text, however in some cases it may be
more convenient to manually attach the data.
Unlike most other Inline API classes, InlineData exists on both the client and the server.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
InlineData.InlineDataType<D extends InlineData<D>>
The type of some InlineData. -
Method Summary
Modifier and TypeMethodDescriptiondefault net.minecraft.text.Style
asStyle
(boolean withExtra) Gets a Style with this data attached.default net.minecraft.text.Text
asText
(boolean withExtra) Gets Text with this data attached.default net.minecraft.text.Style
Gets a suitable Style for this data, without the data itself.net.minecraft.util.Identifier
Gets whichInlineRenderer
should be used for rendering this data.getType()
Gets the InlineDataType of this data.
-
Method Details
-
getType
InlineData.InlineDataType<Self> getType()Gets the InlineDataType of this data. Used mostly for serialization.- Returns:
- type of this data.
-
getRendererId
net.minecraft.util.Identifier getRendererId()Gets whichInlineRenderer
should be used for rendering this data.- Returns:
- id of renderer
-
getExtraStyle
default net.minecraft.text.Style getExtraStyle()Gets a suitable Style for this data, without the data itself.This is primarily used for adding hover or click events.
- Returns:
- Style with no attached data
-
asStyle
default net.minecraft.text.Style asStyle(boolean withExtra) Gets a Style with this data attached.- Parameters:
withExtra
- whether or not extra styling, such as hover or click events, should be added.- Returns:
- Style with attached data and extra styling if withExtra is true
-
asText
default net.minecraft.text.Text asText(boolean withExtra) Gets Text with this data attached.The actual Text string is left up to the implementation.
- Parameters:
withExtra
- whether or not extra styling, such as hover or click events, should be added.- Returns:
- Text with attached data and extra styling if withExtra is true
-