Difference between revisions of "User:WinX64/Slot Data"

From wiki.vg
Jump to navigation Jump to search
(→‎Structured components: Books & trims)
Line 677: Line 677:
 
  | 33
 
  | 33
 
  | <code>minecraft:writable_book_content</code>
 
  | <code>minecraft:writable_book_content</code>
  | Description here.
+
  | Content of a writable book.
| Data here.
+
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2"| Number Of Pages
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | rowspan="3"| Page
 +
    | Raw Content
 +
    | rowspan="3"| {{Type|Array}} (100)
 +
    | {{Type|String}} (1024)
 +
    | The raw text of the page.
 +
    |-
 +
    | Has Filtered Content
 +
    | {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | Filtered Content
 +
    | {{Type|Optional}} {{Type|String}} (1024)
 +
    | The content after passing through chat filters. Only present if Has Filtered Content is true.
 +
    |}
 
  |-
 
  |-
 
  | 34
 
  | 34
 
  | <code>minecraft:written_book_content</code>
 
  | <code>minecraft:written_book_content</code>
  | Description here.
+
  | Content of a written and signed book.
| Data here.
+
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2"| Raw Title
 +
    | colspan="2"| {{Type|String}} (32)
 +
    | The raw title of the book.
 +
    |-
 +
    | colspan="2"| Has Filtered Title
 +
    | colspan="2"| {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | colspan="2"| Filtered Title
 +
    | colspan="2"| {{Type|Optional}} {{Type|String}} (32)
 +
    | The title after going through chat filters. Only present if Has Filtered Title is true.
 +
    |-
 +
    | colspan="2"| Author
 +
    | colspan="2"| {{Type|String}}
 +
    |
 +
    |-
 +
    | colspan="2"| Generation
 +
    | colspan="2"| {{Type|VarInt}}
 +
    |
 +
    |-
 +
    | colspan="2"| Number Of Pages
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | rowspan="3"| Page
 +
    | Raw Content
 +
    | rowspan="3"| {{Type|Array}} (100)
 +
    | {{Type|TextComponent}} (1024)
 +
    | The raw text of the page.
 +
    |-
 +
    | Has Filtered Content
 +
    | {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | Filtered Content
 +
    | {{Type|Optional}} {{Type|Text Component}} (1024)
 +
    | The content after passing through chat filters. Only present if Has Filtered Content is true.
 +
    |-
 +
    | colspan="2"| Resolved
 +
    | colspan="2"| {{Type|Boolean}}
 +
    | Whether entity selectors have already been resolved.
 +
    |}
 
  |-
 
  |-
 
  | 35
 
  | 35
 
  | <code>minecraft:trim</code>
 
  | <code>minecraft:trim</code>
  | Description here.
+
  | Armor's trim pattern and color
| Data here.
+
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2"| Trim Material Type
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Identifier used to determine the data that follows. It can be either:
 +
* 0 - Directly represents a trim material, with the necessary data following.
 +
* Anything else - References a trim material in its registry, by the ID of <code>Trim Material Type - 1</code>.
 +
    |-
 +
    | colspan="2"| Asset Name
 +
    | colspan="2"| {{Type|Optional}} {{Type|String}}
 +
    | See [[Registry_Data#Armor_Trim_Material|Armor Trim Material Registry]]. Only present if Trim Material Type is 0.
 +
    |-
 +
    | colspan="2"| Ingredient
 +
    | colspan="2"| {{Type|Optional}} {{Type|VarInt}}
 +
    | See [[Registry_Data#Armor_Trim_Material|Armor Trim Material Registry]]. Only present if Trim Material Type is 0.
 +
    |-
 +
    | colspan="2"| Item Model Index
 +
    | colspan="2"| {{Type|Optional}} {{Type|Float}}
 +
    | See [[Registry_Data#Armor_Trim_Material|Armor Trim Material Registry]]. Only present if Trim Material Type is 0.
 +
    |-
 +
    | colspan="2"| Number of Overrides
 +
    | colspan="2"| {{Type|Optional}} {{Type|VarInt}}
 +
    | See [[Registry_Data#Armor_Trim_Material|Armor Trim Material Registry]]. Only present if Trim Material Type is 0.
 +
    |-
 +
    | rowspan="2"| Override
 +
    | Armor Material Type
 +
    | rowspan="2"| {{Type|Optional}} {{Type|Array}}
 +
    | {{Type|VarInt}} {{Type|Enum}}
 +
    | See [[Registry_Data#Armor_Trim_Material|Armor Trim Material Registry]]. Only present if Trim Material Type is 0.
 +
    |-
 +
    | Overriden Asset Name
 +
    | {{Type|String}}
 +
    | See [[Registry_Data#Armor_Trim_Material|Armor Trim Material Registry]]. Only present if Trim Material Type is 0.
 +
    |-
 +
    | colspan="2"| Description
 +
    | colspan="2"| {{Type|Optional}} {{Type|Text Component}}
 +
    | See [[Registry_Data#Armor_Trim_Material|Armor Trim Material Registry]]. Only present if Trim Material Type is 0.
 +
      |-
 +
    | colspan="2"| Trim Pattern Type
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Identifier used to determine the data that follows. It can be either:
 +
* 0 - Directly represents a trim pattern, with the necessary data following.
 +
* Anything else - References a trim pattern in its registry, by the ID of <code>Trim Pattern Type - 1</code>.
 +
    |-
 +
    | colspan="2"| Asset Name
 +
    | colspan="2"| {{Type|Optional}} {{Type|String}}
 +
    | See [[Registry_Data#Armor_Trim_Pattern|Armor Trim Pattern Registry]]. Only present if Trim Pattern Type is 0.
 +
    |-
 +
    | colspan="2"| Template Item
 +
    | colspan="2"| {{Type|Optional}} {{Type|VarInt}}
 +
    | See [[Registry_Data#Armor_Trim_Pattern|Armor Trim Pattern Registry]]. Only present if Trim Pattern Type is 0.
 +
    |-
 +
    | colspan="2"| Description
 +
    | colspan="2"| {{Type|Optional}} {{Type|Text Component}}
 +
    | See [[Registry_Data#Armor_Trim_Pattern|Armor Trim Pattern Registry]]. Only present if Trim Pattern Type is 0.
 +
    |-
 +
    | colspan="2"| Decal
 +
    | colspan="2"| {{Type|Optional}} {{Type|Boolean}}
 +
    | See [[Registry_Data#Armor_Trim_Pattern|Armor Trim Pattern Registry]]. Only present if Trim Pattern Type is 0.
 +
    |-
 +
    | colspan="2"| Show In Tooltip
 +
    | colspan="2"| {{Type|Boolean}}
 +
    | Whether the trim information should be shown on the item's tooltip.
 +
    |}
 
  |-
 
  |-
 
  | 36
 
  | 36

Revision as of 01:09, 14 June 2024

The Slot data structure defines how an item is represented when inside an inventory window of any kind, such as a chest or furnace.

This page presents the new Slot data structure, using structured components. You can find the documentation of the old structure, that utilizes raw NBT data, here.

Format

Some description does here.

Name Type Meaning
Item Count VarInt The item count. Every following field is only present if this value is greater than zero.
Item ID Optional VarInt The item ID. Item IDs are distinct from block IDs; see Data Generators for more information.
Number of components to add Optional VarInt Number of elements present in the first data component array
Number of components to remove Optional VarInt Number of elements present in the second data component array. This serve as a way to remove the default component values that are present on some items.
Components to add Component type Optional Array Optional VarInt Enum The type of component. See Structured components for more detail.
Component data Optional Varies The component-dependent data. See Structured components for more detail.
Components to remove Component type Optional Array Optional VarInt Enum The type of component. See Structured components for more detail.

Structured components

The complete list of available components is described below. Items marked in blue cause no noticeable impact on the client, and mainly concern server-side operations.

For a more in-depth description, and information on how the items below are encoded with the NBT format, check here.

Type Name Description Data
0 minecraft:custom_data Customizable data that doesn't fit any specific component. As follows:
Name Type Description
Data NBT Always a Compound Tag.
1 minecraft:max_stack_size Maximum stack size for the item. As follows:
Name Type Description
Max Stack Size VarInt Ranges from 1 to 99.
2 minecraft:max_damage The maximum damage the item can take before breaking. As follows:
Name Type Description
Max Damage VarInt
3 minecraft:damage The current damage of the item. As follows:
Name Type Description
Damage VarInt
4 minecraft:unbreakable Marks the item as unbrekable. As follows:
Name Type Description
Show In Tooltip Boolean Whether the Unbreakable indicator should be shown on the item's tooltip.
5 minecraft:custom_name Item's custom name.
Normally shown in italic, and changeable at an anvil.
As follows:
Name Type Description
Name Text Component
6 minecraft:item_name Override for the item's default name.
Shown when the item has no custom name.
As follows:
Name Type Description
Name Text Component
7 minecraft:lore Item's lore. As follows:
Name Type Description
Number of Lines VarInt Number of elements in the following array.
Lines Array of Text Component
8 minecraft:rarity Item's rarity.
This affects the default color of the item's name.
As follows:
Name Type Description
Rarity VarInt Enum Can be one of the following:
  • 0 - Common (white)
  • 1 - Uncommon (yellow)
  • 2 - Rare (aqua)
  • 3 - Epic (pink)
9 minecraft:enchantments The enchantments of the item. As follows:
Name Type Description
Number Of Enchantments VarInt Number of elements in the following array.
Enchantment Type ID Array VarInt Enum The ID of the enchantment in the enchantment registry.
Level VarInt The level of the enchantment.
Show In Tooltip Boolean Whether the list of enchantments should be shown on the item's tooltip.
10 minecraft:can_place_on List of blocks this block can be placed on when in adventure mode. As follows:
Name Type Description
Number Of Predicates VarInt Number of elements in the following array.
Block Predicates Array of Block Predicate See Block Predicate.
Show In Tooltip Boolean Whether the Unbreakable indicator should be shown on the item's tooltip.
11 minecraft:can_break List of blocks this item can break when in adventure mode. As follows:
Name Type Description
Number Of Predicates VarInt Number of elements in the following array.
Block Predicates Array of Block Predicate See Block Predicate.
Show In Tooltip Boolean Whether the Unbreakable indicator should be shown on the item's tooltip.
12 minecraft:attribute_modifiers The attribute modifiers of the item. As follows:
Name Type Description
Number Of Attributes VarInt Number of elements in the following array.
Attribute Type ID Array VarInt Enum The ID of the attribute.
Unique ID UUID The attribute's unique ID.
Name String The attribute's name.
Value Double The attribute's value.
Operation VarInt Enum The operation to be applied upon the value. Can be one of the following:
  • 0 - Add
  • 1 - Multiply base
  • 2 - Multiply total
Slot VarInt Enum The item slot placement required for the attribute to have effect.
Can be one of the following:
  • 0 - Any
  • 1 - Main hand
  • 2 - Off hand
  • 3 - Hand
  • 4 - Feet
  • 5 - Legs
  • 6 - Chest
  • 7 - Head
  • 8 - Armor
  • 9 - Body
Show In Tooltip Boolean Whether the list of attributes should be shown on the item's tooltip.
13 minecraft:custom_model_data Value for the item predicate when using custom item models.
More info can be found here.
As follows:
Name Type Description
Value VarInt
14 minecraft:hide_additional_tooltip
Huh.png The following information needs to be added to this page:
What is considered as "additional"? What exact items does this hide?
None.
15 minecraft:hide_tooltip Hides the item's tooltip altogether. None.
16 minecraft:repair_cost Accumulated anvil usage cost. The client displays "Too Expensive" if the value is greater than 40 and the player is not in creative mode (more specifically, if they don't have the insta-build flag enabled).
This behavior can be overridden by setting the level with the Set Container Property packet.
As follows:
Name Type Description
Cost VarInt
17 minecraft:creative_slot_lock Marks the item as non-interactive on the creative inventory (the first 5 rows of items).
This is used internally by the client on the paper icon in the saved hot-bars tab.
None.
18 minecraft:enchantment_glint_override Overrides the item glint resulted from enchantments As follows:
Name Type Description
Has Glint VarInt
19 minecraft:intangible_projectile Marks the projectile as intangible (cannot be picked-up).

Warning.png The Notchian client utilizes the codec meant for chat parsing (and NBT in general) when handling this component, even though it contains no data. This causes an empty Compound Tag to be written, which is likely an unintended bug.

As follows:
Name Type Description
Value NBT Always a Compound Tag, and always empty.
20 minecraft:food Makes the item consumable. As follows:
Name Type Description
Nutrition VarInt Non-negative
Saturation Boolean
Can Always Eat Boolean Whether the item can always be eaten, even at full hunger.
Seconds To Eat Float How long it takes to consume the item.
Number of effects VarInt Number of elements in the following array.
Effect Type ID Array Potion Effect The potion effect. See Potion Effect.
Probability Float The probability for this effect to be chosen.
21 minecraft:fire_resistant Marks this item as fire resistant.
The client won't render the item as being on-fire if this component is present.
None.
22 minecraft:tool Alters the speed at which this item breaks certain blocks As follows:
Name Type Description
Number of Rules VarInt The number of elements in the following array.
Rule Blocks Array Block Set The block this rule applies to. See Block Set.
Has Speed Boolean
Speed Optional Float The speed at which the tool breaks this rules' blocks. Only present if Has Speed is true.
Has Correct Drop For Blocks Boolean
Correct Drop For Blocks Optional Boolean Whether items should drop only if this is the correct tool. Only present if Has Correct Drop For Blocks is true.
Default Mining Speed Float The mining speed in case none of the previous rule were matched.
Damage Per Block VarInt The amount of damage the item takes per block break.
23 minecraft:stored_enchantments The enchantments stored in this enchanted book. As follows:
Name Type Description
Number of enchantments VarInt Number of elements in the following array.
Enchantment Type ID Array VarInt Enum The ID of the enchantment in the enchantment registry.
Level VarInt The level of the enchantment.
Show In Tooltip Boolean Whether the list of enchantments should be shown on the item's tooltip.
24 minecraft:dyed_color Color of dyed leather armor. As follows:
Name Type Description
Color Int The RGB components of the color, encoded as an integer.
Show In Tooltip Boolean Whether the armor's color should be shown on the item's tooltip.
25 minecraft:map_color Color of the markings on the map item model. As follows:
Name Type Description
Color Int The RGB components of the color, encoded as an integer.
26 minecraft:map_id The ID of the map. As follows:
Name Type Description
ID VarInt
27 minecraft:map_decorations Icons present on a map. As follows:
Name Type Decorations
Data NBT Always a Compound Tag.
28 minecraft:map_post_processing Used internally by the client when expanding or locking a map. Display extra information on the item's tooltip when the component is present. As follows:
Name Type Decorations
Type VarInt Enum Type of post processing. Can be either:
  • 0 - Lock
  • 1 - Scale
29 minecraft:charged_projectiles Projectiles loaded into a charged crossbow. As follows:
Name Type Decorations
Number Of Projectiles VarInt The number of elements in the following array.
Projectiles Array of Slot The projectiles.
30 minecraft:bundle_contents Contents of a bundle. As follows:
Name Type Decorations
Number Of Items VarInt The number of elements in the following array.
Items Array of Slot The projectiles.
31 minecraft:potion_contents Visual and effects of a potion item. As follows:
Name Type Decorations
Potion ID VarInt The ID of the potion type in the potion registry.
Has Custom Color Boolean Whether this potion has a custom color. If false, it uses the default color associated with the potion type.
Custom Color Int The RGB components of the color, encoded as an integer.
Number Of Custom Effects VarInt The number of elements in the following array.
Custom Effects Array of Potion Effect Any custom effects the potion might have. See Potion Effect.
32 minecraft:suspicious_stew_effects Effects granted by a suspicious stew. As follows:
Name Type Description
Number Of Effects VarInt Number of elements in the following array.
Effect Type ID Array VarInt Enum The ID of the effect in the potion effect type registry.
Duration VarInt The duration of the effect.
33 minecraft:writable_book_content Content of a writable book. As follows:
Name Type Description
Number Of Pages VarInt Number of elements in the following array.
Page Raw Content Array (100) String (1024) The raw text of the page.
Has Filtered Content Boolean
Filtered Content Optional String (1024) The content after passing through chat filters. Only present if Has Filtered Content is true.
34 minecraft:written_book_content Content of a written and signed book. As follows:
Name Type Description
Raw Title String (32) The raw title of the book.
Has Filtered Title Boolean
Filtered Title Optional String (32) The title after going through chat filters. Only present if Has Filtered Title is true.
Author String
Generation VarInt
Number Of Pages VarInt Number of elements in the following array.
Page Raw Content Array (100) TextComponent (1024) The raw text of the page.
Has Filtered Content Boolean
Filtered Content Optional Text Component (1024) The content after passing through chat filters. Only present if Has Filtered Content is true.
Resolved Boolean Whether entity selectors have already been resolved.
35 minecraft:trim Armor's trim pattern and color As follows:
Name Type Description
Trim Material Type VarInt Identifier used to determine the data that follows. It can be either:
  • 0 - Directly represents a trim material, with the necessary data following.
  • Anything else - References a trim material in its registry, by the ID of Trim Material Type - 1.
Asset Name Optional String See Armor Trim Material Registry. Only present if Trim Material Type is 0.
Ingredient Optional VarInt See Armor Trim Material Registry. Only present if Trim Material Type is 0.
Item Model Index Optional Float See Armor Trim Material Registry. Only present if Trim Material Type is 0.
Number of Overrides Optional VarInt See Armor Trim Material Registry. Only present if Trim Material Type is 0.
Override Armor Material Type Optional Array VarInt Enum See Armor Trim Material Registry. Only present if Trim Material Type is 0.
Overriden Asset Name String See Armor Trim Material Registry. Only present if Trim Material Type is 0.
Description Optional Text Component See Armor Trim Material Registry. Only present if Trim Material Type is 0.
Trim Pattern Type VarInt Identifier used to determine the data that follows. It can be either:
  • 0 - Directly represents a trim pattern, with the necessary data following.
  • Anything else - References a trim pattern in its registry, by the ID of Trim Pattern Type - 1.
Asset Name Optional String See Armor Trim Pattern Registry. Only present if Trim Pattern Type is 0.
Template Item Optional VarInt See Armor Trim Pattern Registry. Only present if Trim Pattern Type is 0.
Description Optional Text Component See Armor Trim Pattern Registry. Only present if Trim Pattern Type is 0.
Decal Optional Boolean See Armor Trim Pattern Registry. Only present if Trim Pattern Type is 0.
Show In Tooltip Boolean Whether the trim information should be shown on the item's tooltip.
36 minecraft:debug_stick_state Description here. Data here.
37 minecraft:entity_data Description here. Data here.
38 minecraft:bucket_entity_data Description here. Data here.
39 minecraft:block_entity_data Description here. Data here.
40 minecraft:instrument Description here. Data here.
41 minecraft:ominous_bottle_amplifier Description here. Data here.
42 minecraft:recipes Description here. Data here.
43 minecraft:lodestone_tracker Description here. Data here.
44 minecraft:firework_explosion Description here. Data here.
45 minecraft:fireworks Description here. Data here.
46 minecraft:profile Description here. Data here.
47 minecraft:note_block_sound Description here. Data here.
48 minecraft:banner_patterns Description here. Data here.
49 minecraft:base_color Description here. Data here.
50 minecraft:pot_decorations Description here. Data here.
51 minecraft:container Description here. Data here.
52 minecraft:block_state Description here. Data here.
53 minecraft:bees Description here. Data here.
54 minecraft:lock Description here. Data here.
55 minecraft:container_loot Description here. Data here.

Other types

Common types used in multiple components are described below.

Block Predicate

Describes a predicate used when block filtering is necessary. It can be parameterized to account for the type of block, the values of specific block state properties, NBT data related to block entities, or any combination of the three.

Name Type Description
Has Blocks Boolean Whether this predicate is tied to specific types of blocks.
Blocks Optional Block Set See Block Set. Only present if Has Blocks is true.
Has Properties Boolean Whether this predicate is tied to specific properties of a block.
Number of Properties Optional VarInt Number of elements in the following array. Only present if Has Properties is true.
Properties Optional Array of Property See Property structure below. Only present if Has Properties is true.
Has NBT Boolean Whether this predicate is tied to specific block entity data.
NBT Optional NBT Only present is Has NBT is true.

The Property structure is defined as follows:

Name Type Description
Name String Name of the block state property.
Is Exact Match Boolean Whether this is an exact value match, as opposed to ranged.
Exact Value Optional String Value of the block state property. Only present in exact match mode.
Min Value Optional String Minimum value of the block state property range. Only present in ranged match mode.
Max Value Optional String Maximum value of the block state property range. Only present in ranged match mode.

Block Set

Represents a list of block types, either directly (enumerated IDs) or indirectly (block tag).

Name Type Description
Type VarInt Identifier used to determine the data that follows. It can be either:
  • 0 - Represents a named set of blocks, defined by a tag.
  • Anything else - Represents an enumerated set of blocks, defined by block IDs.
Tag name Optional Identifier A tag representing a set of blocks. Only present if Type is 0.
Block IDs Optional Array of VarInt An array of block IDs. Only present if Type is not 0.
The size of the array is equal to Type - 1.

Potion Effect

Describes all the aspects of a potion effect.

Name Type Description
Type ID VarInt Enum The ID of the effect in the potion effect type registry.
Details Detail See Detail structure below.

The Detail structure is defined as follows:

Name Type Description
Amplifier VarInt
Duration VarInt -1 for infinite.
Ambient Boolean Produces more translucent particle effects if true.
Show Particles Boolean Completely hides effect particles if false.
Show Icon Boolean Shows the potion icon in the inventory screen if true.
Has Hidden Effect Boolean Used to store the state of the previous potion effect when a stronger one is applied. This guarantees that the weaker one will persist, in case it lasts longer.
Huh.png The following information needs to be added to this page:
This behavior seems to be entirely server-sided. Does the presence of this field actually has any noticeable impact on the client?
Hidden Effect Optional Detail Only present if Has Hidden Effect is true.