Package dan200.computercraft.api.detail
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 Summary
ConstructorsConstructorDescriptionBasicItemDetailProvider
(@Nullable String namespace, Class<T> itemType) Create a new item detail provider.BasicItemDetailProvider
(Class<T> itemType) Create a new item detail provider. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
provideDetails
(Map<? super String, Object> data, net.minecraft.world.item.ItemStack stack) Provide additional details for the given object.abstract void
provideDetails
(Map<? super String, Object> data, net.minecraft.world.item.ItemStack stack, T item) Provide additional details for the givenItem
andItemStack
.
-
Constructor Details
-
BasicItemDetailProvider
Create a new item detail provider. Details will be inserted into a new sub-map named as pernamespace
.- Parameters:
itemType
- The type the stack's item must have.namespace
- The namespace to use for this provider.
-
BasicItemDetailProvider
Create a new item detail provider. Details 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 givenItem
andItemStack
. This method is called byturtle.getItemDetail()
. New properties should be added to the givenMap
,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 final 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 asturtle.getItemDetail()
andturtle.inspect()
. New properties should be added to the givenMap
,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 interfaceDetailProvider<T>
- Parameters:
data
- The full details to be returned. New properties should be added to this map.stack
- The object to provide details for.
-