Class ComponentDetailProvider<T>

java.lang.Object
dan200.computercraft.api.detail.ComponentDetailProvider<T>
Type Parameters:
T - The type of the component's contents.
All Implemented Interfaces:
DetailProvider<net.minecraft.core.component.DataComponentHolder>

public abstract class ComponentDetailProvider<T> extends Object implements DetailProvider<net.minecraft.core.component.DataComponentHolder>
An item detail provider for a specific data component on ItemStacks or other DataComponentHolder.
  • Constructor Details

    • ComponentDetailProvider

      public ComponentDetailProvider(@Nullable String namespace, net.minecraft.core.component.DataComponentType<T> component)
      Create a new component detail provider. Details will be inserted into a new sub-map named as per namespace.
      Parameters:
      namespace - The namespace to use for this provider.
      component - The data component to provide details for.
    • ComponentDetailProvider

      public ComponentDetailProvider(net.minecraft.core.component.DataComponentType<T> component)
      Create a new component detail provider. Details will be inserted directly into the results.
      Parameters:
      component - The data component to provide details for.
  • Method Details

    • provideComponentDetails

      public abstract void provideComponentDetails(Map<? super String,Object> data, T component)
      Provide additional details for the given data component. This method is called by turtle.getItemDetail(). New properties should be added to the given Map, data.

      This method is always called on the server thread, so it is safe to interact with the world here, but you should take care to avoid long blocking operations as this will stall the server and other computers.

      Parameters:
      data - The full details to be returned for this item stack. New properties should be added to this map.
      component - The component to provide details for.
    • provideDetails

      public final void provideDetails(Map<? super String,Object> data, net.minecraft.core.component.DataComponentHolder holder)
      Description copied from interface: DetailProvider
      Provide additional details for the given object. This method is called by functions such as turtle.getItemDetail() and turtle.inspect(). New properties should be added to the given Map, data.

      This method is always called on the server thread, so it is safe to interact with the world here, but you should take care to avoid long blocking operations as this will stall the server and other computers.

      Specified by:
      provideDetails in interface DetailProvider<T>
      Parameters:
      data - The full details to be returned. New properties should be added to this map.
      holder - The object to provide details for.