Class ViaItemBody
java.lang.Object
io.github.projectunified.unidialog.viaversion.body.ViaItemBody
- All Implemented Interfaces:
ItemBody<ViaItem,,ViaTextBody, ViaItemBody> ViaDialogBody
public class ViaItemBody
extends Object
implements ItemBody<ViaItem,ViaTextBody,ViaItemBody>, ViaDialogBody
A ViaVersion-based implementation of
ItemBody for building item bodies.-
Field Summary
Fields inherited from interface io.github.projectunified.unidialog.core.body.ItemBody
DEFAULT_HEIGHT, DEFAULT_WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionViaItemBody(Function<String, com.viaversion.viaversion.libs.mcstructs.text.TextComponent> componentDeserializer) Constructor for ViaItemBody -
Method Summary
Modifier and TypeMethodDescriptiondescription(@Nullable Consumer<ViaTextBody> descriptionBuilder) Set the description for the bodyheight(int height) Set the height of the item bodyitem(com.viaversion.viaversion.api.minecraft.item.Item item) Set the item of the body, wrapping a ViaVersionItemSet the item for the bodyshowDecorations(boolean showDecorations) Set the option to show decorations in the bodyshowTooltip(boolean showTooltip) Set the option to show a tooltip in the bodycom.viaversion.nbt.tag.CompoundTagtoTag(com.viaversion.viaversion.util.SerializerVersion baseVersion, com.viaversion.viaversion.util.SerializerVersion targetVersion) Serialize this body for the given base and target serializerswidth(int width) Set the width of the item body
-
Constructor Details
-
Method Details
-
item
Description copied from interface:ItemBodySet the item for the body- Specified by:
itemin interfaceItemBody<ViaItem,ViaTextBody, ViaItemBody> - Parameters:
item- the item to set- Returns:
- the instance of the item body for method chaining
-
item
Set the item of the body, wrapping a ViaVersionItem- Parameters:
item- the item to set- Returns:
- the item body itself for method chaining
-
description
Description copied from interface:ItemBodySet the description for the body- Specified by:
descriptionin interfaceItemBody<ViaItem,ViaTextBody, ViaItemBody> - Parameters:
descriptionBuilder- a consumer to build the description- Returns:
- the instance of the item body for method chaining
-
showDecorations
Description copied from interface:ItemBodySet the option to show decorations in the body- Specified by:
showDecorationsin interfaceItemBody<ViaItem,ViaTextBody, ViaItemBody> - Parameters:
showDecorations- whether to show decorations- Returns:
- the instance of the item body for method chaining
-
showTooltip
Description copied from interface:ItemBodySet the option to show a tooltip in the body- Specified by:
showTooltipin interfaceItemBody<ViaItem,ViaTextBody, ViaItemBody> - Parameters:
showTooltip- whether to show a tooltip- Returns:
- the instance of the item body for method chaining
-
width
Description copied from interface:ItemBodySet the width of the item body- Specified by:
widthin interfaceItemBody<ViaItem,ViaTextBody, ViaItemBody> - Parameters:
width- the width to set- Returns:
- the instance of the item body for method chaining
-
height
Description copied from interface:ItemBodySet the height of the item body- Specified by:
heightin interfaceItemBody<ViaItem,ViaTextBody, ViaItemBody> - Parameters:
height- the height to set- Returns:
- the instance of the item body for method chaining
-
toTag
public com.viaversion.nbt.tag.CompoundTag toTag(com.viaversion.viaversion.util.SerializerVersion baseVersion, com.viaversion.viaversion.util.SerializerVersion targetVersion) Description copied from interface:ViaDialogBodySerialize this body for the given base and target serializers- Specified by:
toTagin interfaceViaDialogBody- Parameters:
baseVersion- the serializer of the server version the dialog is created fortargetVersion- the serializer of the version the dialog is sent to- Returns:
- the dialog body tag
-