Interface PreviewProviderRegistry
@NonExtendable
public interface PreviewProviderRegistry
Provides a way to register preview providers for items and a way to access them.
- Since:
- 3.0.0
-
Method Summary
Modifier and TypeMethodDescriptionget(net.minecraft.resources.ResourceLocation id) Attempts to get the corresponding preview provider associated with the given item stack.get(net.minecraft.world.item.Item item) Gets the associated provider for the given item.get(net.minecraft.world.item.ItemStack stack) Gets the associated provider for the given item stack.net.minecraft.resources.ResourceLocationgetId(PreviewProvider provider) Attempts to get the corresponding identifier associated with the given preview provider.Set<net.minecraft.resources.ResourceLocation> getIds()Gets the set of all the registered identifiers.static PreviewProviderRegistryGets the preview provider registry instance.Set<net.minecraft.world.item.Item> getItems(PreviewProvider provider) Returns the set of items the givenPreviewProviderworks with.Gets the set of all registeredpreview providers.voidregister(net.minecraft.resources.ResourceLocation id, PreviewProvider provider, Iterable<net.minecraft.world.item.Item> items) Registers aPreviewProvider.voidregister(net.minecraft.resources.ResourceLocation id, PreviewProvider provider, net.minecraft.world.item.Item... items) Registers aPreviewProvider.
-
Method Details
-
getInstance
Gets the preview provider registry instance.- Returns:
- The registry instance.
- Since:
- 3.0.0
-
register
void register(net.minecraft.resources.ResourceLocation id, PreviewProvider provider, Iterable<net.minecraft.world.item.Item> items) Registers aPreviewProvider. New preview providers can only be registered inside theShulkerBoxTooltipApi.registerProviders(PreviewProviderRegistry)method.- Parameters:
id- The id of the preview provider.provider- The provider.items- The items for which this provider will work. When multiple providers are registered for the same item, the one with the highest priority is chosen.- Since:
- 3.0.0
-
register
void register(net.minecraft.resources.ResourceLocation id, PreviewProvider provider, net.minecraft.world.item.Item... items) Registers aPreviewProvider. New preview providers can only be registered inside theShulkerBoxTooltipApi.registerProviders(PreviewProviderRegistry)method.- Parameters:
id- The id of the preview provider.provider- The provider.items- The items for which this provider will work. When multiple providers are registered for the same item, the one with the highest priority is chosen.- Since:
- 3.0.0
-
get
Attempts to get the corresponding preview provider associated with the given item stack.- Parameters:
id- The id the provider was registered with.- Returns:
- The associated provider, can be null.
- Since:
- 3.0.0
-
get
Gets the associated provider for the given item stack.- Parameters:
stack- The target item stack.- Returns:
- The associated provider, or
nullif the stack does not have a preview provider. - Since:
- 3.0.0
-
get
Gets the associated provider for the given item.- Parameters:
item- The target item.- Returns:
- The associated provider, or
nullif the item does not have a preview provider. - Since:
- 3.0.0
-
getId
Attempts to get the corresponding identifier associated with the given preview provider.- Parameters:
provider- The preview provider- Returns:
- The id of given provider, or
nullif it was not registered. - Since:
- 3.0.0
-
getItems
Returns the set of items the givenPreviewProviderworks with.The set of items may be smaller than the one given in
register(ResourceLocation, PreviewProvider, Iterable)if the provider's priority was lower than other providers for each missing item.- Parameters:
provider- The preview provider- Returns:
- The immutable set of items, will be empty if provider was not registered.
- Since:
- 3.0.0
-
getProviders
Gets the set of all registeredpreview providers.- Returns:
- The set of all registered preview providers.
- Since:
- 3.0.0
-
getIds
Gets the set of all the registered identifiers.- Returns:
- the set of all registered ids.
- Since:
- 3.0.0
-