Data Driven Previews - MisterPeModder/ShulkerBoxTooltip GitHub Wiki

custom shulker box example
Custom box with rows of size 5, orange window color, and no tooltip hints.

Note

This feature is available on version 4.2.0 and later for Minecraft 1.20.6 and later

Note

You may only override items which already previews such as shulker boxes, chest, and modded containers.
It does not work on arbitrary items

Description

ShulkerBoxTooltip supports overriding some properties of preview-able items (see the list below) using custom NBT data on a stack-by-stack basis.
Overrides are located in the shulkerboxtooltip compound tag or the minecraft:custom_data item component, you may create them using a command of the following format:

give @s chest[minecraft:custom_data={shulkerboxtooltip:{}}]

Supported Properties

Any of the following properties may be overridden. When omitted, falls back to the default behavior of the item (e.g. A shulker box will use window_color: {category: shulkerboxtooltip:shulker_boxes, id: shulker_box} for its window color when missing).

should_display

Type: boolean
Description: Controls whether the preview window is allowed to display.

Example

Shulker box with no preview window:

give @p minecraft:shulker_box[minecraft:container=[{slot:2,item:{id:cobblestone,count:31}}],minecraft:custom_data={shulkerboxtooltip:{should_display:false}}]
shulker box with no preview

inventory_max_size

Type: integer
Description: Limits the number of slots to display in the preview

Example

Barrel with only two slots:

give @p minecraft:barrel[minecraft:container=[{slot:1,item:{id:cobblestone,count:31}}],minecraft:custom_data={shulkerboxtooltip:{inventory_max_size:2}}]
barrel with two slots example

max_row_size

Type: integer
Description: The maximum number of slots per row in full preview mode.

Example

Red shulker box with rows of 3 slots:

give @p minecraft:red_shulker_box[minecraft:container=[{slot:1,item:{id:cobblestone,count:31}}],minecraft:custom_data={shulkerboxtooltip:{max_row_size:3}}]
red shulker box with rows of 3

compact_max_row_size

Type: integer
Description: The maximum number of slots per row in compact preview mode.
Added in version: 5.2.0

full_preview_available

Type: boolean
Description: Controls whether the full preview window can be shown.

Example

Shulker box with full preview disabled:

give @p minecraft:shulker_box[minecraft:container=[{slot:2,item:{id:cobblestone,count:31}}],minecraft:custom_data={shulkerboxtooltip:{full_preview_available:false}}]
shulker box without full preview

show_tooltip_hints

Type: boolean
Description: Whether to show hints like "Left Controls: lock tooltip" in the tooltip of the container.

Example

Shulker box without key hints:

give @p minecraft:shulker_box[minecraft:container=[{slot:2,item:{id:cobblestone,count:31}}],minecraft:custom_data={shulkerboxtooltip:{show_tooltip_hints:false}}]
shulker box without key hints

tooltip_hint_lang_key

Type: string
Description: The localization string to use for the "view contents" hint.

Examples

White shulker box with modified hint text:

give @p minecraft:shulker_box[minecraft:container=[{slot:2,item:{id:cobblestone,count:31}}],minecraft:custom_data={shulkerboxtooltip:{tooltip_hint_lang_key:"gui.proceed"}}]
white shulker with modified hint text

full_tooltip_hint_lang_key

Type: string
Description: The localization string to use for the "view full contents" hint.

lock_tooltip_hint_lang_key

Type: string
Description: The localization string to use for the "lock tooltip" hint.

window_color

Type: integer OR compound of format {category: "mod:category_id", id: "color_key_id"}
Description: Overrides the window color with a specific color code or a named color key. Color keys are listed in the "Colors" tab of the mod's configuration screen.

Examples

Chest using #ff5512 for its preview window color:

give @p minecraft:chest[minecraft:container=[{slot:2,item:{id:cobblestone,count:31}},{slot:15,item:{id:diamond_sword}}],minecraft:custom_data={shulkerboxtooltip:{window_color:16733458}}]
chest with fixed color code

Chest using ender chest color:

give @p minecraft:chest[minecraft:container=[{slot:2,item:{id:cobblestone,count:31}},{slot:15,item:{id:diamond_sword}}],minecraft:custom_data={shulkerboxtooltip:{window_color:{category:"shulkerboxtooltip:default",id:"ender_chest"}}}]
chest with fixed color code colors configuration

texture

Type: string / resource location (format: namespace:path/to/texture.png)
Description: Use the specified texture for the preview window. Accepts any texture from vanilla, mods, and resource packs. Works best with textures similar to shulker_box_tooltip.png

Example

Dispenser using cobblestone as the preview texture:

give @p minecraft:dispenser[minecraft:container=[{slot:2,item:{id:cobblestone,count:31}}],minecraft:custom_data={shulkerboxtooltip:{texture:"minecraft:textures/block/cobblestone.png"}}]
dispenser with cobblestone preview texture

can_insert_items

Type: boolean
Description: Controls whether the player is allowed to insert items into the container by clicking with a stack.

not yet implemented

can_extract_items

Type: boolean
Description: Controls whether the player is allowed to extract items from the container by clicking.

not yet implemented

Developer Notes

Overrides are controlled by the OverridingPreviewProvider class, which wraps the PreviewProvider instance of the item when it has the shulkerboxtooltip compound tag.

⚠️ **GitHub.com Fallback** ⚠️