Class BasicItemDetailProvider<T>

java.lang.Object
dan200.computercraft.api.detail.BasicItemDetailProvider<T>
Type Parameters:
T - The type the stack's item must have.
All Implemented Interfaces:
DetailProvider<net.minecraft.world.item.ItemStack>

public abstract class BasicItemDetailProvider<T> extends Object implements DetailProvider<net.minecraft.world.item.ItemStack>
An item detail provider for ItemStack's whose Item has a specific type.
  • Constructor Details

    • BasicItemDetailProvider

      public BasicItemDetailProvider(@Nullable String namespace, Class<T> itemType)
      Create a new item detail provider. Meta will be inserted into a new sub-map named as per namespace.
      Parameters:
      itemType - The type the stack's item must have.
      namespace - The namespace to use for this provider.
    • BasicItemDetailProvider

      public BasicItemDetailProvider(Class<T> itemType)
      Create a new item detail provider. Meta will be inserted directly into the results.
      Parameters:
      itemType - The type the stack's item must have.
  • Method Details

    • provideDetails

      public abstract void provideDetails(Map<? super String,Object> data, net.minecraft.world.item.ItemStack stack, T item)
      Provide additional details for the given Item and ItemStack. 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.
      stack - The item stack to provide details for.
      item - The item to provide details for.
    • provideDetails

      public void provideDetails(Map<? super String,Object> data, net.minecraft.world.item.ItemStack stack)
      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.
      stack - The object to provide details for.