Interface ObjectComponent

All Superinterfaces:
Component, ComponentBuilderApplicable, ComponentLike, HoverEventSource<Component>, ScopedComponent<ObjectComponent>, StyleGetter, StyleSetter<Component>

public sealed interface ObjectComponent extends ScopedComponent<ObjectComponent>
Displays a non-text object.
Since:
4.25.0
Since Minecraft:
1.21.9
  • Method Details

    • contents

      ObjectContents contents()
      Gets the contents of this object component.
      Returns:
      the contents
      Since:
      4.25.0
    • contents

      ObjectComponent contents(ObjectContents contents)
      Creates a copy of this object component with the given contents.
      Parameters:
      contents - the contents to set
      Returns:
      new object component
      Since:
      4.25.0
    • fallback

      @Nullable Component fallback()
      Gets the fallback component.

      The client displays this instead of this component in areas where object components are not supported, such as server MOTDs.

      Returns:
      the fallback component, if any
      Since:
      5.0.0
      Since Minecraft:
      26.1
    • fallback

      ObjectComponent fallback(@Nullable ComponentLike fallback)
      Creates a copy of this object component with the given fallback.

      The client displays this instead of this component in areas where object components are not supported, such as server MOTDs.

      Parameters:
      fallback - the fallback component, or null to clear the fallback
      Returns:
      the new object component
      Since:
      5.0.0
      Since Minecraft:
      26.1
    • toBuilder

      Description copied from interface: Component
      Returns a builder for this component.
      Specified by:
      toBuilder in interface Component
      Specified by:
      toBuilder in interface ScopedComponent<ObjectComponent>
      Returns:
      the builder