Interface ShulkerBoxTooltipApi


public interface ShulkerBoxTooltipApi
Implement this interface and use this as your entrypoint.

Example plugin: register a preview for barrels


   public class MyModShulkerBoxTooltipPlugin implements ShulkerBoxTooltipApi {
     @Override
     public void registerProviders(PreviewProviderRegistry registry) {
       registry.register(new Identifier("mymod", "barrel_example"),
           new BlockEntityPreviewProvider(27, true), Items.BARREL);
     }
   }
 

Registering a plugin (on NeoForge):


 ModLoadingContext.get().registerExtensionPoint(ShulkerBoxTooltipPlugin.class,
     () -> new ShulkerBoxTooltipPlugin(MyModShulkerBoxTooltipPlugin::new));
 

Registering a plugin (on Forge):


 FMLJavaModLoadingContext context = // get instance from your mod's constructor
 context.registerExtensionPoint(ShulkerBoxTooltipPlugin.class,
     () -> new ShulkerBoxTooltipPlugin(MyModShulkerBoxTooltipPlugin::new));
 

Registering a plugin (on Fabric): Inside the fabric.mod.json file, add:


 {
   "entrypoints": {
     "shulkerboxtooltip": [
       "com.mymod.MyModShulkerBoxTooltipPlugin"
     ]
   }
 }
Since:
1.3.0
  • Method Details

    • getPreviewProviderForStack

      @Nullable static PreviewProvider getPreviewProviderForStack(net.minecraft.world.item.ItemStack stack)
      Attempts to get the corresponding preview provider associated with the given item stack, ignoring data-driven overrides.
      Parameters:
      stack - The stack
      Returns:
      the associated PreviewProvider for the passed ItemStack
      Since:
      2.0.0
    • getPreviewProviderForStackWithOverrides

      @Nullable static PreviewProvider getPreviewProviderForStackWithOverrides(net.minecraft.world.item.ItemStack stack)
      Attempts to get the corresponding preview provider associated with the given item stack using data-driven overrides if available.
      Parameters:
      stack - The stack
      Returns:
      the associated PreviewProvider for the passed ItemStack.
      Since:
      4.2.0
    • isPreviewAvailable

      @Environment(CLIENT) static boolean isPreviewAvailable(PreviewContext context)
      Returns whether a preview is requested (see getCurrentPreviewType(boolean)) and a preview is available for the given context.
      Parameters:
      context - The preview context.
      Returns:
      true if the requested preview is available for display.
      Since:
      2.0.0
    • getCurrentPreviewType

      @Environment(CLIENT) @Nonnull static PreviewType getCurrentPreviewType(boolean hasFullPreviewMode)
      Returns the currently requested preview type.

      The requested preview type depends on factors like whether the preview keys are pressed, or the preview is force-enabled through the config.

      Parameters:
      hasFullPreviewMode - Is the full preview mode available?
      Returns:
      The preview type
      Since:
      2.0.0
    • hasModAvailable

      static boolean hasModAvailable(net.minecraft.server.level.ServerPlayer player)
      Checks whether the given player has ShulkerBoxTooltip installed and enabled server integration.
      Parameters:
      player - The player.
      Returns:
      true if the player has the mod installed and server integration turned on.
      Since:
      2.0.0
    • registerColors

      @Environment(CLIENT) default void registerColors(ColorRegistry registry)
      Called on each entrypoint to register color keys and categories.

      While registering color keys is optional, it allows them to be customized be the users though the configuration screen/file.

      ShulkerBoxTooltip is guaranteed to always call this method on all plugins before calling registerProviders(PreviewProviderRegistry).

      Parameters:
      registry - The color registry instance.
      Since:
      3.2.0
    • registerProviders

      void registerProviders(PreviewProviderRegistry registry)
      Called on each entrypoint to register preview providers.
      Parameters:
      registry - The provider registry instance..
      Since:
      3.0.0