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.
  • Constructor Details

    • ViaItemBody

      public ViaItemBody(Function<String,com.viaversion.viaversion.libs.mcstructs.text.TextComponent> componentDeserializer)
      Constructor for ViaItemBody
      Parameters:
      componentDeserializer - the function to deserialize components from strings
  • Method Details

    • item

      public ViaItemBody item(ViaItem item)
      Description copied from interface: ItemBody
      Set the item for the body
      Specified by:
      item in interface ItemBody<ViaItem,ViaTextBody,ViaItemBody>
      Parameters:
      item - the item to set
      Returns:
      the instance of the item body for method chaining
    • item

      public ViaItemBody item(com.viaversion.viaversion.api.minecraft.item.Item item)
      Set the item of the body, wrapping a ViaVersion Item
      Parameters:
      item - the item to set
      Returns:
      the item body itself for method chaining
    • description

      public ViaItemBody description(@Nullable @Nullable Consumer<ViaTextBody> descriptionBuilder)
      Description copied from interface: ItemBody
      Set the description for the body
      Specified by:
      description in interface ItemBody<ViaItem,ViaTextBody,ViaItemBody>
      Parameters:
      descriptionBuilder - a consumer to build the description
      Returns:
      the instance of the item body for method chaining
    • showDecorations

      public ViaItemBody showDecorations(boolean showDecorations)
      Description copied from interface: ItemBody
      Set the option to show decorations in the body
      Specified by:
      showDecorations in interface ItemBody<ViaItem,ViaTextBody,ViaItemBody>
      Parameters:
      showDecorations - whether to show decorations
      Returns:
      the instance of the item body for method chaining
    • showTooltip

      public ViaItemBody showTooltip(boolean showTooltip)
      Description copied from interface: ItemBody
      Set the option to show a tooltip in the body
      Specified by:
      showTooltip in interface ItemBody<ViaItem,ViaTextBody,ViaItemBody>
      Parameters:
      showTooltip - whether to show a tooltip
      Returns:
      the instance of the item body for method chaining
    • width

      public ViaItemBody width(int width)
      Description copied from interface: ItemBody
      Set the width of the item body
      Specified by:
      width in interface ItemBody<ViaItem,ViaTextBody,ViaItemBody>
      Parameters:
      width - the width to set
      Returns:
      the instance of the item body for method chaining
    • height

      public ViaItemBody height(int height)
      Description copied from interface: ItemBody
      Set the height of the item body
      Specified by:
      height in interface ItemBody<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: ViaDialogBody
      Serialize this body for the given base and target serializers
      Specified by:
      toTag in interface ViaDialogBody
      Parameters:
      baseVersion - the serializer of the server version the dialog is created for
      targetVersion - the serializer of the version the dialog is sent to
      Returns:
      the dialog body tag