Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Hardcoded item properties (Java Edition): Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Sync: updated from Minecraft
SyncBot (talk | contribs)
Sync: updated from Minecraft
 
(41 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Italic title|Java Edition}}
{{exclusive|java}}
{{exclusive|java}}
{{wip|See [[Minecraft:Minecraft_Wiki:Projects/Hardcoded_item|Projects/Hardcoded item]] for more information}}
{{wip|See [[Minecraft:Minecraft_Wiki:Projects/Hardcoded_item|Projects/Hardcoded item]] for more information}}
{{project|Hardcoded item}}
{{project|Hardcoded item}}
{{cleanup}}
{{cleanup}}
[[Category:Java Edition technical]]
<!--{{TOC|right}}-->
'''Hardcoded item properties''' are aspects of [[Minecraft:item]]s which are tied to the [[Minecraft:Identifier#Java Edition usage|IDs]] and cannot be customized fully via the use of [[Minecraft:commands]] or [[Minecraft:data pack]]s. That is, if an item has all of its [[Minecraft:Data component format|item components]] removed, and is not a member of any [[Minecraft:Item tag (Java Edition)|item tags]], referenced by any [[Minecraft:Recipe (Java Edition)|recipe]]s, [[Minecraft:Villager trade definition|trade]]s, [[Minecraft:Advancement definition|advancement triggers]], or any other more esoteric data-driven definitions (e.g. [[Minecraft:vault]] unlock items, [[Minecraft:predicate]]s used in [[Minecraft:loot table]]s{{note|Used for handling drops when using [[Minecraft:shears]], unsure as to if others exist}} or what [[Minecraft:Enchantment definition|enchantments]] can be applied to items), it still possesses a functionality based entirely on its item ID which cannot be removed from it, nor assigned to arbitrary other items.
 
Many of the properties associated with items in the game have been made controllable with [[Minecraft:data component format]]; this intends to track things that are not currently controllable via any of the above data-driven item properties (though may be in future).
 
Some properties are mixed, where they depend both on the hardcoded parts and on references to components, tags, etc. In these cases, items with the same components, tags, etc., would have different properties depending on the item's ID. For example, the properties of the [[Minecraft:spawn egg]], which depend on both the item's ID (being an instance of [[#SpawnEggItem|SpawnEggItem]]) and the component {{DCL|entity_data}}. These properties are also described on this page.
<!--There is also a very particular case of "circular properties," where an item has a property but without mods there's no way to test it because there's no way to add another item to test the property. Example: ComposterBlock.OutputContainer -->


{{TOC|right}}
{{TOC|none|limit=2}}
'''Hardcoded item properties''' are aspects of [[Minecraft:item]]s which are tied to the [[Minecraft:Identifier#Java Edition usage|IDs]] and cannot be customized fully via the use of [[Minecraft:commands]] or [[Minecraft:data pack]]s.


Many of the properties associated with items in the game have been made controllable with the newly-introduced [[Minecraft:data component format]]; this intends to track things that are not currently controllable via components, [[Minecraft:Item_tag_(Java_Edition)|item tags]], [[Minecraft:recipe#ava_Edition_JSON_format|recipes]], [[Minecraft:Advancement_definition|advancements]], [[Minecraft:Enchantment_definition|enchantments]] and [[Minecraft:Villager_trade_definition|trades]] (though may be in future).
<!--{{TOC|none|limit=2}}-->
== Item stacks properties ==
== Item stacks properties ==


Line 33: Line 37:
Sometimes, properties that can be controlled by components have a lower priority than properties that depend on the item's ID, to the point that being used on certain items partially or completely loses its effect.
Sometimes, properties that can be controlled by components have a lower priority than properties that depend on the item's ID, to the point that being used on certain items partially or completely loses its effect.


{{Anchor|Default components}}
'''Default components'''
'''Default components'''


Line 72: Line 77:
'''Item predicate'''
'''Item predicate'''


The item predicate is a subpredicate of [[Minecraft:predicates]]. Predicates can be used to test if a certain item satisfies a certain condition, and if so, contribute to the activation a certain [[Minecraft:loot table]] or [[Minecraft:advancement trigger]]. Loot tables are used to obtain items at various times. Advancement triggers, in addition to being used to receive advancements, are also used to unlock recipes.  
The item predicate is a sub-predicate of [[Minecraft:predicates]]. Predicates can be used to test if a certain item satisfies a certain condition, and if so, contribute to the activation a certain [[Minecraft:loot table]] or [[Minecraft:advancement trigger]]. Loot tables are used to obtain items at various times. Advancement triggers, in addition to being used to receive advancements, are also used to unlock recipes.  


Predicates are even more important for customizations, being used in commands or in advancement triggers to activate [[Minecraft:Function_(Java_Edition)|functions]]. Some commands like {{cmd|execute (if&#124;unless) items ...}} are also very important in testing items and have an effect. Although we can use such commands to simulate a hardcoded item property or inhibit properties of certain items, this will hardly be done in a completely similar way, and the hardcoded properties will continue to exist, only being inhibited or copied.
Predicates are even more important for customizations, being used in commands or in advancement triggers to activate [[Minecraft:Function_(Java_Edition)|functions]]. Some commands like {{cmd|execute (if&#124;unless) items ...}} are also very important in testing items and have an effect. Although we can use such commands to simulate a hardcoded item property or inhibit properties of certain items, this will hardly be done in a completely similar way, and the hardcoded properties will continue to exist, only being inhibited or copied.
Line 80: Line 85:


=== Item.Properties ===
=== Item.Properties ===
In class {{jicp|-.Properties}}, the game defines a series of functions that can be applied to an item and change its properties. However, the vast majority of these properties ultimately only modify the item's default [[Minecraft:data components]].
In class {{jicp|-.Properties}}, the game defines a series of functions that can be applied to an item and change its properties. However, the vast majority of these properties ultimately only modify the item's [[#Default components|default data components]]


A complete list of default components in [[Minecraft:1.21.11]] can be seen at [https://github.com/misode/mcmeta/blob/1.21.11-diff/items misode/mcmeta]. The list for {{version|java-snap}} can be found [https://github.com/misode/mcmeta/tree/diff/items here].
A complete list of default components in {{v|java}} can be seen at [https://github.com/misode/mcmeta/blob/{{v|java|nolink=1}}-diff/items misode/mcmeta]. {{#ifeq:{{v|java-snap}}|||The list for {{v|java-snap}} can be found [https://github.com/misode/mcmeta/tree/diff/items here].}}
{{Collapse|title=Note that some items are used as default components of other items.|head=1}}
<!--This is collapsing because it's not certain if it's a hardcoded property. But just to be safe, it's better to leave it collapsed than not include it on the page. -Aloi-->
{| class="wikitable sortable"
!Used item !! Component !! Used in
|-
|{{ItemLink| Bowl}} || {{DCL| use_remainder }} || {{ItemLink|Mushroom Stew}}
|-
|{{ItemLink| Bucket}} || {{DCL| use_remainder }} || {{ItemLink|Milk Bucket}}
|-
|{{ItemLink|Glass Bottle}} || {{DCL| use_remainder }}  || {{ItemLink|Potion}}
|-
|{{ItemLink|Bowl}} || {{DCL| use_remainder }} || {{ItemLink|Rabbit Stew}}
|-
|{{ItemLink|Bowl}} || {{DCL| use_remainder }} || {{ItemLink|Beetroot Soup}}
|-
|{{ItemLink|Bowl}} || {{DCL| use_remainder }} || {{ItemLink|Suspicious Stew}}
|-
|{{ItemLink|Glass Bottle}} || {{DCL| use_remainder }}  || {{ItemLink|Honey Bottle}}
|-
| {{ItemLink| Phantom Membrane }} || {{DCL|repairable}} || {{ItemLink| Elytra }}
|-
| {{ItemLink| Breeze Rod }} || {{DCL|repairable}} || {{ItemLink| Mace }}
|-
| {{ItemLink| Brick }} || {{DCL|pot_decorations}}<br>(all faces) || {{InvLink|Decorated Pot}}
|}
<!--Other values of the component {{cd|repairable}} are given by tags-->
{{Collapse|tail=1}}


A notable exception is the {{cd|craftRemainder}} property, which defines which item will remain in a recipe when using the item as a recipe. See below for a list of all craft reminders:
A notable exception is the {{cd|craftRemainder}} property, which defines which item will remain in a recipe when using the item as a recipe. See below for a list of all craft reminders:
Line 97: Line 129:
| {{ItemLink|Honey Bottle}}  || {{ItemLink|Glass Bottle}} || [[Minecraft:Honey block]] and [[Minecraft:sugar]] recipes.
| {{ItemLink|Honey Bottle}}  || {{ItemLink|Glass Bottle}} || [[Minecraft:Honey block]] and [[Minecraft:sugar]] recipes.
|-
|-
| {{ItemLink|Dragon's Breath}}  || {{ItemLink|Glass Bottle}} || Ingredient remainder in [[Minecraft:brewing]].{{note|With two or more dragon's breath in the brewing stand, after the brewing process, a glass bottle drops as an [[Minecraft:Item (entity)|entity]]. However, with one dragon's breath in the brewing stand, the glass bottle is consumed and cannot be retrieved.<ref>{{bug|MC-259583}}</ref>|name=a}}
| {{ItemLink|Dragon's Breath}}  || {{ItemLink|Glass Bottle}} || Ingredient remainder in [[Minecraft:brewing]].{{note|With two or more dragon's breath in the brewing stand, after the brewing process, a glass bottle drops as an [[Minecraft:Item (entity)|entity]]}}
|}
|}


All craft remainder can also be used in custom [[Minecraft:recipe]]s via [[Minecraft:data pack]]s. In code is also used in the craft display item, however it apparently hasn't been implemented in the game{{info needed}}.
All craft remainder can also be used in custom [[Minecraft:recipe]]s via [[Minecraft:data pack]]s. In code is also used in the craft display item, however it apparently hasn't been implemented in the game{{info needed}}.


Adding some tags, such as {{tag link|item|wooden_trapdoors}}, to one of the items above, allow to use it as fuel and have the crafting remainder after. In the book and banner cloning recipe, the cloned item remains if it doesn't have a craft remainder{{note|If the material in the book cloning recipe has the component {{DCL|written_book_content}}, it will also remains.}}; if it does have a crafting remainder, the crafting remainder takes priority. Therefore, when placing one of the above items with a {{cd|source}} in the book cloning recipe, instead of keeping the item, it will keep its crafting remainder.  
Adding the component {{DCL|cooking_fuel}} to one of the items above allows it to be used as fuel while also having a crafting remainder. In the book and banner cloning recipe, the cloned item ({{cd|banner}} and {{cd|source}}) remains if it doesn't have a craft remainder{{note|If the {{cd|material}} in the book cloning recipe has the component {{DCL|written_book_content}}, it will also remains.}}; if it does have a crafting remainder, the crafting remainder takes priority.  


Another exception is the item {{cd|descriptionId}}, which can be {{cd|''minecraft.item.<id>''}} or {{cd|''minecraft.block.<id>''}}. Although its primary use is for the item name, the {{DCL|item_name}} default component, this description id is also used for other things, such as potion names and disc fragment descreipition.
Another exception is the item {{cd|descriptionId}}, which can be {{cd|''minecraft.item.<id>''}} or {{cd|''minecraft.block.<id>''}}. Although its primary use is for the item name, the {{DCL|item_name}} default component, this description id is also used for other things such as potion names and disc fragment descriptions.


The last exception is the {{cd|requiredFeatures}} propertie, although it's not important in the current version. It serves to list which [[Minecraft:experiments]] must be active to use a certain item in many cases. Currently, no item is exclusive to any experiment; thus, all have this property with its default value {{cd|VANILLA_SET}}.
The last exception is the {{cd|requiredFeatures}} property, although it's not important in the current version. It serves to list which [[Minecraft:experiments]] must be active to use a certain item in many cases. Currently, no item is exclusive to any experiment; thus, all have this property with its default value {{cd|VANILLA_SET}}.


Most of the {{cd|Item.Properties}} applied to items are applied from the item's registered in {{jicp|-s}}.
Most of the {{cd|Item.Properties}} applied to items are applied from the item's registered in {{jicp|-s}}.
Line 114: Line 146:
In the {{jcp|net.minecraft.world.item}} package, there are many classes that define properties for a certain item or a certain set of items; these classes extend the {{jicp|}} class. A large part of the hardcoded item properties come from here.
In the {{jcp|net.minecraft.world.item}} package, there are many classes that define properties for a certain item or a certain set of items; these classes extend the {{jicp|}} class. A large part of the hardcoded item properties come from here.


These classes have {{cd|[something]Item}} as their name, such as {{cd|DyeItem}}, {{cd|HoeItem}}, and {{cd|NameTagItem}}.
These classes have {{cd|[something]Item}} as their name, such as {{cd|DyeItem}}, {{cd|BlockItem}}, and {{cd|NameTagItem}}.


In many cases, when an item is registered in {{jicp|-s}}, it is already created as a new instance of one of these classes.
In many cases, when an item is registered in {{jicp|-s}}, it is already created as a new instance of one of these classes.
Line 136: Line 168:
|-
|-
|ArrowItem || arrow
|ArrowItem || arrow
|-
|AxeItem || wooden_axe, copper_axe, stone_axe, golden_axe, iron_axe, diamond_axe
|-
|-
|BannerItem || white_banner, orange_banner, magenta_banner, light_blue_banner, yellow_banner, lime_banner, pink_banner, gray_banner, light_gray_banner, cyan_banner, purple_banner, blue_banner, brown_banner, green_banner, red_banner, black_banner
|BannerItem || white_banner, orange_banner, magenta_banner, light_blue_banner, yellow_banner, lime_banner, pink_banner, gray_banner, light_gray_banner, cyan_banner, purple_banner, blue_banner, brown_banner, green_banner, red_banner, black_banner
|-
|BedItem || white_bed, orange_bed, magenta_bed, light_blue_bed, yellow_bed, lime_bed, pink_bed, gray_bed, light_gray_bed, cyan_bed, purple_bed, blue_bed, brown_bed, green_bed, red_bed, black_bed
|-
|-
|BlockItem || {{Collapse|
|BlockItem || {{Collapse|
Line 209: Line 237:
|-
|-
|HangingSignItem || warped_hanging_sign, spruce_hanging_sign, pale_oak_hanging_sign, oak_hanging_sign, mangrove_hanging_sign, jungle_hanging_sign, dark_oak_hanging_sign, crimson_hanging_sign, cherry_hanging_sign, birch_hanging_sign, bamboo_hanging_sign, acacia_hanging_sign
|HangingSignItem || warped_hanging_sign, spruce_hanging_sign, pale_oak_hanging_sign, oak_hanging_sign, mangrove_hanging_sign, jungle_hanging_sign, dark_oak_hanging_sign, crimson_hanging_sign, cherry_hanging_sign, birch_hanging_sign, bamboo_hanging_sign, acacia_hanging_sign
|-
|HoeItem || wooden_hoe, copper_hoe, stone_hoe, golden_hoe, iron_hoe, diamond_hoe
|-
|-
|HoneycombItem || honeycomb
|HoneycombItem || honeycomb
Line 251: Line 277:
|-
|-
|ShieldItem || shield
|ShieldItem || shield
|-
|ShovelItem || wooden_shovel, copper_shovel, stone_shovel, golden_shovel, iron_shovel, diamond_shovel
|-
|-
|SignItem || warped_sign, spruce_sign, pale_oak_sign, oak_sign, mangrove_sign, jungle_sign, dark_oak_sign, crimson_sign, cherry_sign, birch_sign, bamboo_sign, acacia_sign
|SignItem || warped_sign, spruce_sign, pale_oak_sign, oak_sign, mangrove_sign, jungle_sign, dark_oak_sign, crimson_sign, cherry_sign, birch_sign, bamboo_sign, acacia_sign
Line 321: Line 345:
|-
|-
|{{jcp|net.minecraft.client.data.models.ItemModelGenerators}} || {{tc|no|Vanilla resourcepack}} || 493
|{{jcp|net.minecraft.client.data.models.ItemModelGenerators}} || {{tc|no|Vanilla resourcepack}} || 493
|-
|{{jcp|net.minecraft.client.gui.screens.CreateFlatWorldScreen.DetailsList.LayerEntry}} || {{tc|Rarely|Gui}} || 3<!-- Technically, we could consider it a property of the air item. But that would be too much of a stretch. It would only be relevant if water and lava ceased to be considered air as items, in which case they would no longer use their respective blade as an item in the superflat world layers. But beyond that, only impacting future changes, only in the world selection GUI, the fact that these blocks are considered air is just a default value and not a property of the air item.-->
|-
|-
|{{jcp|net.minecraft.client.gui.screens.achievement.StatsScreen.ItemStatisticsList}} || {{tc|Rarely|Gui}} || 1
|{{jcp|net.minecraft.client.gui.screens.achievement.StatsScreen.ItemStatisticsList}} || {{tc|Rarely|Gui}} || 1
Line 656: Line 682:
|{{jicp|-Stack}} ||  || 4
|{{jicp|-Stack}} ||  || 4
|-
|-
|{{jicp|-StackTemplate}} || {{tc|Rarely|New instance}} || 1
|{{jicp|-StackTemplate}} || || 1
|-
|-
|{{jicp|Map}} || {{tc|Rarely|New instance}} || 1
|{{jicp|Map}} || {{tc|Rarely|New instance}} || 1
Line 764: Line 790:
|{{jbcp|entity.vault|VaultConfig}} ||  || 1
|{{jbcp|entity.vault|VaultConfig}} ||  || 1
|-
|-
|{{jcp|net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorPresets.Bootstrap}} || {{tc|Rarely|New instance}} || 3
|{{jcp|net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorPresets.Bootstrap}} || {{tc|no|Vanilla datapack}} || 3
|-
|-
|{{jcp|net.minecraft.world.level.levelgen.structure.structures.EndCityPieces.EndCityPiece}} || {{tc|Rarely|New instance}} || 1
|{{jcp|net.minecraft.world.level.levelgen.structure.structures.EndCityPieces.EndCityPiece}} || {{tc|Rarely|New instance}} || 1
Line 798: Line 824:
===getDefaultMaxStackSize()===
===getDefaultMaxStackSize()===
-->
-->
===onUseTick(...)===
=== onUseTick(...) ===
 
{| class="wikitable"
{| class="wikitable"
|+ style="text-align: left | onUseTick
|+ style="text-align: left | onUseTick
Line 821: Line 846:
{{blist
{{blist
|class=treeview
|class=treeview
|{{jicp|-Stack}}.{{cd|onUseTick({{tooltip|...|Level level, LivingEntity livingEntity, int ticksRemaining}})}}: Calls the method implemented in the item stack as item, after properties relating to {{DCL|consumable}} and {{DCL|kinetic_waapon}} components.
|{{jicp|-Stack}}.{{cd|onUseTick({{tooltip|...|Level level, LivingEntity livingEntity, int ticksRemaining}})}}: Calls the method implemented in the item stack as item, after properties relating to {{DCL|consumable}} and {{DCL|kinetic_weapon}}
{{blist|class=treeview|
{{blist|class=treeview|
{{jcp|net.minecraft.world.entity.LivingEntity}}.{{cd|updateUsingItem({{tooltip|...|ItemStack useItem}})}}: Called at the beginning, in the {{jcp|net.minecraft.server.level.ServerPlayer}} implementation after activating [[Minecraft:Advancement_definition#minecraft:\using_item|{{cd|using_item}}]] tiger criteria.
{{jcp|net.minecraft.world.entity.LivingEntity}}.{{cd|updateUsingItem({{tooltip|...|ItemStack useItem}})}}: Called at the beginning, in the {{jcp|net.minecraft.server.level.ServerPlayer}} implementation after activating [[Minecraft:Advancement_definition#minecraft:using_item|{{cd|using_item}}]] trigger criteria.
{{blist|class=treeview|
{{blist|class=treeview|
{{jcp|net.minecraft.world.entity.LivingEntity}}.{{cd|updatingUsingItem()}}: Calls if the item stack used remains in the same hand of the entity.
{{jcp|net.minecraft.world.entity.LivingEntity}}.{{cd|updatingUsingItem()}}: Calls if the item stack used remains in the same hand of the entity.
Line 890: Line 915:
|}
|}


Retrona false iff the user is a player in the creation (has instabuild) and the item has the {{DCL|tool}} component with {{cd|can_destroy_blocks_in_creative}} false.  
Returns false if the player is in {{Tooltip|creative mode|has instabuild}} and the item has the {{DCL|tool}} component with {{cd|can_destroy_blocks_in_creative}} set to false. In other cases it returns true.


Note that this method depends exclusively on the component and is not hardcoded. However, the method still has an implementation.
Note that this method depends exclusively on the component and is not hardcoded. However, the method still has an implementation.
Line 925: Line 950:
|}
|}


It only returns the interaction result {{cd|PASS}}. However, in implementations, in addition to the [[Minecraft:w:Side_effect_(computer_science)|side effect]]s (the core of the method), it can return interaction results such as {{cd|FAIL}} and {{cd|SUCCESS}}. These returns can have some subsequent effect as shown in the tree below.
 
If the {{DCL|block_transformer}} data default of the item in hand is not empty, it attempts to transform the interacted block, with the return value depending on the transformation; otherwise, it returns {{Cd|FAIL}}. However, default {{Cd|block_transformer}} data components exist only for [[Minecraft:hoe]]s, [[Minecraft:shovel]]s, and [[Minecraft:axe]]s; many items still rely on hardcoded usage logic (see the implementations below).


'''Uses tree'''
'''Uses tree'''
Line 947: Line 973:


* {{jicp|-Stack}}.{{cd|useOn(...)}}: If the player is in [[Minecraft:adventure mode]] and the item stack does not have the {{DCL|can_place_on}} component corresponding to the clicked block, it returns fail.
* {{jicp|-Stack}}.{{cd|useOn(...)}}: If the player is in [[Minecraft:adventure mode]] and the item stack does not have the {{DCL|can_place_on}} component corresponding to the clicked block, it returns fail.
: Otherwise, call the method implemented in the item stack as item. If the method returns {{cd|SUCCESS}} increases the item {{cd|used}} [[Minecraft:statistic]] by one. Returns the return value of the called method.
: Otherwise, call the method implemented in the item stack as item. If the method returns {{cd|SUCCESS}} increases the item {{cd|used}} [[Minecraft:statistic]] by one. Returns the return value of the called method.{{More info|Changes to the return on 26.3}} <!--
* {{jcp|net.minecraft.server.level.ServerPlayerGameMode}}.{{cd|useItemOn(...)}}: Returns falls if the block being hit is exclusive of a unenabled [[Minecraft:experiment]]. The current version [[Minecraft:1.21.11]] does not have such blocks in the game.
ItemStack transformTo = success.heldItemTransformedTo() == null ? this : success.heldItemTransformedTo();
: If the player is in the [[Minecraft:spectator]] mode: if the block has a menu, open the menu and return {{cd|CONSUME}}, otherwise return {{cd|PASS}}.
 
ItemStack resultItemStack = transformTo.applyAfterUseComponentSideEffects(player, stackBeforeUse);
 
return success.heldItemTransformedTo(resultItemStack);
-->
* {{jcp|net.minecraft.server.level.ServerPlayerGameMode}}.{{cd|useItemOn(...)}}: Returns falls if the block being hit is exclusive of a unenabled [[Minecraft:experiment]]. The current version does not have such blocks in the game.
: If the player is in the [[Minecraft:spectator]] mode:  
:* If the block has a [[Minecraft:Interactable_blocks#Blocks_with_GUI|menu]], open the menu and return {{cd|CONSUME}}
:* If the block is a portal ([[Minecraft:End Gateway (block)|end gateway]], [[Minecraft:End Portal (block)|end portal]], or [[Minecraft:Nether Portal (block)|nether portal]]), attempt to teleport the player to the destination. If possible, remove the camera view of another entity beforehand. If not possible, display the message {{cd|spectator.cannot_teleport}} in red on [[Minecraft:action bar]]. Return {{cd|CONSUME}}.
:* Otherwise return {{cd|PASS}}.
: If the player is not [[Minecraft:sneaking]] or doesn't have items in either hand:  
: If the player is not [[Minecraft:sneaking]] or doesn't have items in either hand:  
:* The player will attempt to use the item, or the empty hand, on the block. However, for this use, the previous method will not be used, but rather {{cd|state.useItemOn(...)}}, which is a method controlled by the block ({{cd|{{tooltip|state|BlockPos pos {{=}} hitResult.getBlockPos(); BlockState state {{=}} level.getBlockState(pos)}}}}). Sometimes this method will give different results depending on the item used; see {{sl||Items member access}} for details.
:* The player will attempt to use the item, or the empty hand, on the block. However, for this use, the previous method will not be used, but rather {{cd|state.useItemOn(...)}}, which is a method controlled by the block ({{cd|{{tooltip|state|BlockPos pos {{=}} hitResult.getBlockPos(); BlockState state {{=}} level.getBlockState(pos)}}}}). Sometimes this method will give different results depending on the item used; see {{sl||Items member access}} for details.
Line 957: Line 992:
:* If neither {{cd|state.useItemOn(...)}} nor {{cd|state.useWithoutItem(...)}} returns success, the method continues.
:* If neither {{cd|state.useItemOn(...)}} nor {{cd|state.useWithoutItem(...)}} returns success, the method continues.
: If the  item stack is empty or in [[Minecraft:use cooldown|cooldown]], return {{cd|PASS}}.
: If the  item stack is empty or in [[Minecraft:use cooldown|cooldown]], return {{cd|PASS}}.
: Finally, the {{cd|ItemStack.useOn(...)}} method is called. If the player is in creative mode, the stack item quantity is restored, preventing any loss due to the called method. If the return is successful, the {{cd|item_used_on_block}} is activated. Returns the return of the called method.
: Finally, the {{cd|ItemStack.useOn(...)}} method is called. If the player is in creative mode, the stack item quantity is restored, preventing any loss due to the called method.{{More info|At this point, the player can switch the item in their hand depending on the result.}} If the return is successful, the {{cd|item_used_on_block}} is activated. Returns the return of the called method.
: In {{jcp|net.minecraft.server.level.DemoMode}}, output demo reminder and return {{cd|PASS}}, if [[Minecraft:Demo Mode|demo timer]] has end. Otherwise, it calls the supermethod, so the method will proceed normally.
: In {{jcp|net.minecraft.server.level.DemoMode}}, output demo reminder and return {{cd|PASS}}, if [[Minecraft:Demo Mode|demo timer]] has end. Otherwise, it calls the supermethod, so the method will proceed normally.
* {{jcp|net.minecraft.server.level.ServerGamePacketListenerImpl}}.{{cd|handleUseItemOn}}: Initially, it tests if the interaction is allowed, if positive, call the method. If the return of the called method is successful, the [[Minecraft:Advancement_definition#minecraft:any_block_use|{{cd|any_block_use}}]] is activated.  
* {{jcp|net.minecraft.server.level.ServerGamePacketListenerImpl}}.{{cd|handleUseItemOn}}: Initially, it tests if the interaction is allowed, if positive, call the method. If the return of the called method is successful, the [[Minecraft:Advancement_definition#minecraft:any_block_use|{{cd|any_block_use}}]] is activated.  
: If the interaction is unsuccessful, the interaction direction is up, the interacted block is at its maximum height, and the item is a {{slink||BlockItem}} or {{slink||BucketItem}} instance with non-empty fluid and is not on cooldown, then send the system error message in [[Minecraft:action bar]] with the translation of {{cd|build.tooHigh}} with the maximum height value of the dimension.
: If the interaction is unsuccessful, the interaction direction is up, the interacted block is at its maximum height, and the item is a {{slink||BlockItem}} or {{slink||BucketItem}} instance with non-empty fluid and is not on cooldown, then send the system error message in [[Minecraft:action bar]] with the translation of {{cd|build.tooHigh}} with the maximum height value of the dimension.
: If the return of the called method is {{cd|SUCCESS}} or {{cd|SUCCESS_SERVER}}, the player swings the hand used.
: If the return of the called method is {{cd|SUCCESS}} or {{cd|SUCCESS_SERVER}}, the player swings the hand used.
: {{More info|Message from the minimum Y value and hand movement type.}}
<!--
<!--
checking if the item is enabled (just like blocks, in the current version 1.21.11, all are), if the block is within the interaction range, and if the center of the block is less than 1.0000001 away from the interacted point on all axes. If any test fails, the method returns. In {{jcp|net.minecraft.server.level.DemoMode}} test if has ended-->  
checking if the item is enabled (just like blocks, in the current version 1.21.11, all are), if the block is within the interaction range, and if the center of the block is less than 1.0000001 away from the interacted point on all axes. If any test fails, the method returns. In {{jcp|net.minecraft.server.level.DemoMode}} test if has ended-->  
Line 968: Line 1,004:
{{columns-list|colwidth=16em|
{{columns-list|colwidth=16em|
* {{ItemLink|Armor Stand|ArmorStandItem|link=#ArmorStandItem}}
* {{ItemLink|Armor Stand|ArmorStandItem|link=#ArmorStandItem}}
* {{ItemLink|Axes|AxeItem|link=#AxeItem}}
* {{InvLink|Bricks|BlockItem|link=#BlockItem}}
* {{InvLink|Bricks|BlockItem|link=#BlockItem}}
* {{ItemLink|Bone Meal|BoneMealItem|link=#BoneMealItem}}
* {{ItemLink|Bone Meal|BoneMealItem|link=#BoneMealItem}}
* {{ItemLink|Brush|BrushItem|link=#BrushItem}}
* {{ItemLink|Brush|BrushItem|link=#BrushItem}}
* {{ItemLink|Compass|CompassItem|link=#CompassItem}}{{font color|#AA00AA|*}}
* {{ItemLink|Compass|CompassItem|link=#CompassItem}}{{font color|#AA00AA|*}}
* {{ItemLink|Cushion|CushionItem|link=#CushionItem}}
* {{ItemLink|Debug Stick|DebugStickItem|link=#DebugStickItem}}
* {{ItemLink|Debug Stick|DebugStickItem|link=#DebugStickItem}}
* {{ItemLink|End Crystal|EndCrystalItem|link=#EndCrystalItem}}
* {{ItemLink|End Crystal|EndCrystalItem|link=#EndCrystalItem}}
Line 979: Line 1,015:
* {{ItemLink|Firework Rocket|FireworkRocketItem|link=#FireworkRocketItem}}
* {{ItemLink|Firework Rocket|FireworkRocketItem|link=#FireworkRocketItem}}
* {{ItemLink|Flint And Steel|FlintAndSteelItem|link=#FlintAndSteelItem}}
* {{ItemLink|Flint And Steel|FlintAndSteelItem|link=#FlintAndSteelItem}}
* {{ItemLink|painting |HangingEntityItem|link=#HangingEntityItem}}
* {{ItemLink|painting |HangingEntityItem|link=#HangingEntityItem}}
* {{ItemLink|Hoes|HoeItem|link=#HoeItem}}
* {{ItemLink|Honeycomb|HoneycombItem|link=#HoneycombItem}}
* {{ItemLink|Honeycomb|HoneycombItem|link=#HoneycombItem}}
* {{ItemLink|Lead|LeadItem|link=#LeadItem}}
* {{ItemLink|Lead|LeadItem|link=#LeadItem}}
Line 988: Line 1,023:
* {{ItemLink|Potion|PotionItem|link=#PotionItem}}
* {{ItemLink|Potion|PotionItem|link=#PotionItem}}
* {{ItemLink|Shears|ShearsItem|link=#ShearsItem}}{{font color|#AA00AA|*}}
* {{ItemLink|Shears|ShearsItem|link=#ShearsItem}}{{font color|#AA00AA|*}}
* {{ItemLink|shovels|ShovelItem|link=#ShovelItem}}
* {{ItemLink|powder snow bucket|SolidBucketItem|link=#SolidBucketItem}}{{font color|#AA00AA|*}}
* {{ItemLink|powder snow bucket|SolidBucketItem|link=#SolidBucketItem}}{{font color|#AA00AA|*}}
* {{ItemLink|Creeper Spawn Egg|SpawnEggItem|link=#SpawnEggItem}}
* {{ItemLink|Creeper Spawn Egg|SpawnEggItem|link=#SpawnEggItem}}
Line 1,027: Line 1,061:
===getDefaultInstance()===
===getDefaultInstance()===
===canFitInsideContainerItems()===
===canFitInsideContainerItems()===
===requiredFeatures()===
<!-- requiredFeatures() -->
 
===shouldPrintOpWarning(...)===
===shouldPrintOpWarning(...)===


Line 1,037: Line 1,072:
* {{BlockLink|Air|AirItem|link=#AirItem}}{{past|ga}}
* {{BlockLink|Air|AirItem|link=#AirItem}}{{past|ga}}
* {{ItemLink|armor stand|ArmorStandItem|link=#ArmorStandItem}}{{past|ga}}
* {{ItemLink|armor stand|ArmorStandItem|link=#ArmorStandItem}}{{past|ga}}
* {{ItemLink|arrow|ArrowItem|link=#ArrowItem}}
* {{ItemLink|arrow|ArrowItem|link=#ArrowItem}}{{past|ga}}
* {{ItemLink|axes|AxeItem|link=#AxeItem}}
* {{ItemLink|banners|BannerItem|link=#BannerItem}}{{past|ga}}
* {{ItemLink|banners|BannerItem|link=#BannerItem}}
* {{ItemLink|beds|BedItem|link=#BedItem}}
* {{InvLink|Bricks|BlockItem|link=#BlockItem}}{{past|ga}}
* {{InvLink|Bricks|BlockItem|link=#BlockItem}}{{past|ga}}
* {{ItemLink|boats|BoatItem|link=#BoatItem}}
* {{ItemLink|boats|BoatItem|link=#BoatItem}}{{past|ga}}
* {{ItemLink|bone meal|BoneMealItem|link=#BoneMealItem}}
* {{ItemLink|bone meal|BoneMealItem|link=#BoneMealItem}}{{past|ga}}
* {{ItemLink|glass bottle|BottleItem|link=#BottleItem}}
* {{ItemLink|glass bottle|BottleItem|link=#BottleItem}}{{past|ga}}
* {{ItemLink|bow|BowItem|link=#BowItem}}
* {{ItemLink|bow|BowItem|link=#BowItem}}
* {{ItemLink|brush|BrushItem|link=#BrushItem}}
* {{ItemLink|brush|BrushItem|link=#BrushItem}}
* {{ItemLink|bucket|BucketItem|link=#BucketItem}}
* {{ItemLink|bucket|BucketItem|link=#BucketItem}}
* {{ItemLink|bundles|BundleItem|link=#BundleItem}}
* {{ItemLink|bundles|BundleItem|link=#BundleItem}}
* {{ItemLink|compass|CompassItem|link=#CompassItem}}
* {{ItemLink|compass|CompassItem|link=#CompassItem}}{{past|ga}}
* {{ItemLink|crossbow|CrossbowItem|link=#CrossbowItem}}
* {{ItemLink|crossbow|CrossbowItem|link=#CrossbowItem}}
* {{ItemLink|debug stick|DebugStickItem|link=#DebugStickItem}}
* {{ItemLink|cushions|CushionItem|link=#CushionItem}}{{past|ga}}
* {{ItemLink|debug stick|DebugStickItem|link=#DebugStickItem}}{{past|ga}}
* {{ItemLink|disc fragment 5|DiscFragmentItem|link=#DiscFragmentItem}}{{past|ga}}
* {{ItemLink|disc fragment 5|DiscFragmentItem|link=#DiscFragmentItem}}{{past|ga}}
* {{InvLink|Small Dripleaf|DoubleHighBlockItem|link=#DoubleHighBlockItem}}
* {{InvLink|Small Dripleaf|DoubleHighBlockItem|link=#DoubleHighBlockItem}}{{past|ga}}
* {{ItemLink|dye|DyeItem|link=#DyeItem}}{{past|ga}}
* {{ItemLink|dye|DyeItem|link=#DyeItem}}{{past|ga}}
* {{ItemLink|eggs|EggItem|link=#EggItem}}
* {{ItemLink|eggs|EggItem|link=#EggItem}}{{past|ga}}
* {{ItemLink|map|EmptyMapItem|link=#EmptyMapItem}}
* {{ItemLink|map|EmptyMapItem|link=#EmptyMapItem}}{{past|ga}}
* {{ItemLink|end crystal|EndCrystalItem|link=#EndCrystalItem}}
* {{ItemLink|end crystal|EndCrystalItem|link=#EndCrystalItem}}{{past|ga}}
* {{ItemLink|eye of ender|EnderEyeItem|link=#EnderEyeItem}}
* {{ItemLink|eye of ender|EnderEyeItem|link=#EnderEyeItem}}{{past|ga}}
* {{ItemLink|ender pearl|EnderpearlItem|link=#EnderpearlItem}}
* {{ItemLink|ender pearl|EnderpearlItem|link=#EnderpearlItem}}{{past|ga}}
* {{ItemLink|bottle-o'-enchanting|ExperienceBottleItem|link=#ExperienceBottleItem}}
* {{ItemLink|bottle-o'-enchanting|ExperienceBottleItem|link=#ExperienceBottleItem}}{{past|ga}}
* {{ItemLink|fire charge|FireChargeItem|link=#FireChargeItem}}
* {{ItemLink|fire charge|FireChargeItem|link=#FireChargeItem}}{{past|ga}}
* {{ItemLink|firework rocket|FireworkRocketItem|link=#FireworkRocketItem}}
* {{ItemLink|firework rocket|FireworkRocketItem|link=#FireworkRocketItem}}{{past|ga}}
* {{ItemLink|fishing rod|FishingRodItem|link=#FishingRodItem}}
* {{ItemLink|fishing rod|FishingRodItem|link=#FishingRodItem}}{{past|ga}}
* {{ItemLink|flint and steel|FlintAndSteelItem|link=#FlintAndSteelItem}}
* {{ItemLink|flint and steel|FlintAndSteelItem|link=#FlintAndSteelItem}}{{past|ga}}
* {{ItemLink|carrot on a stick|FoodOnAStickItem|link=#FoodOnAStickItem}}
* {{ItemLink|carrot on a stick|FoodOnAStickItem|link=#FoodOnAStickItem}}{{past|ga}}
* {{BlockLink|Command Blocks|GameMasterBlockItem|link=#GameMasterBlockItem}}
* {{BlockLink|Command Blocks|GameMasterBlockItem|link=#GameMasterBlockItem}}{{past|ga}}
* {{ItemLink|glow ink sac|GlowInkSacItem|link=#GlowInkSacItem}}
* {{ItemLink|glow ink sac|GlowInkSacItem|link=#GlowInkSacItem}}{{past|ga}}
* {{ItemLink|painting|HangingEntityItem|link=#HangingEntityItem}}
* {{ItemLink|painting|HangingEntityItem|link=#HangingEntityItem}}
* {{ItemLink|Hanging Signs|HangingSignItem|link=#HangingSignItem}}
* {{ItemLink|Hanging Signs|HangingSignItem|link=#HangingSignItem}}
* {{ItemLink|hoes|HoeItem|link=#HoeItem}}
* {{ItemLink|honeycomb|HoneycombItem|link=#HoneycombItem}}
* {{ItemLink|honeycomb|HoneycombItem|link=#HoneycombItem}}
* {{ItemLink|ink sac|InkSacItem|link=#InkSacItem}}
* {{ItemLink|ink sac|InkSacItem|link=#InkSacItem}}
* {{ItemLink|goat horn|InstrumentItem|link=#InstrumentItem}}
* {{ItemLink|goat horn|InstrumentItem|link=#InstrumentItem}}
* {{EntityLink|Item|Item|link=#Item (member access)}}
* {{EntityLink|Item|Item|link=#Item}}
* {{ItemLink|item frame|ItemFrameItem|link=#ItemFrameItem}}
* {{ItemLink|item frame|ItemFrameItem|link=#ItemFrameItem}}
* {{ItemLink|knowledge book|KnowledgeBookItem|link=#KnowledgeBookItem}}
* {{ItemLink|knowledge book|KnowledgeBookItem|link=#KnowledgeBookItem}}
Line 1,093: Line 1,126:
* {{ItemLink|shears|ShearsItem|link=#ShearsItem}}
* {{ItemLink|shears|ShearsItem|link=#ShearsItem}}
* {{ItemLink|shield|ShieldItem|link=#ShieldItem}}{{past|ga}}
* {{ItemLink|shield|ShieldItem|link=#ShieldItem}}{{past|ga}}
* {{ItemLink|shovels|ShovelItem|link=#ShovelItem}}
* {{ItemLink|signs|SignItem|link=#SignItem}}
* {{ItemLink|signs|SignItem|link=#SignItem}}
* {{ItemLink|smithing templates|
* {{ItemLink|smithing templates|
Line 1,116: Line 1,148:
=== AirItem ===
=== AirItem ===


{{Infobox hip|class=AirItem|block=3|Air}}
{{Infobox hip|class=AirItem|block=1|Air}}


Air has a block {{cd|descriptionId}}, meaning its translation key is {{cd|minecraft.block.air}}. However, unlike other items with this {{cd|descriptionId}}, aor is not an instance of {{jicp|Block}}, because {{jicp|Air}} does not extend {{jicp|Block}}.
Air has a block {{cd|descriptionId}}, meaning its translation key is {{cd|minecraft.block.air}}. However, unlike other items with this {{cd|descriptionId}}, air is not an instance of {{jicp|Block}}, because {{jicp|Air}} does not extend {{jicp|Block}}.


''' getName({{tooltip|minetip=1|...|ItemStack itemStack}})'''
''' getName({{tooltip|...|ItemStack itemStack}})'''
{{hatnote|Overrides method in [[#getName(...)|{{jicp|}}]] }}
{{hatnote|Overrides method in [[#getName(...)|{{jicp|}}]] }}


Line 1,131: Line 1,163:
=== ArmorStandItem ===
=== ArmorStandItem ===


{{Infobox hip|class=ArmorStandItem|Armor Stand}}
{{Infobox hardcoded item property|class=ArmorStandItem|Armor Stand}}


'''useOn({{tooltip|minetip=1|...|UseOnContext context}})'''
'''useOn({{tooltip|...|UseOnContext context}})'''
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]]}}
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]]}}


If the interaction involves clicking on the dowm side of a block, it fails.
If the interaction involves clicking on the bottom face of a block, it fails.


The target position for placing the [[Minecraft:armor stand]] is the bottom center of the block next to the interacted block, in the direction of the interacted face. The game simulates the [[Minecraft:hitbox]] of an armor stand in this position; if the hitbox collides with a block or intersects with an (no [[Minecraft:spectator]]) entity hitbox, the interaction fails.
The target position for placing the [[Minecraft:armor stand]] is the bottom center of the block next to the interacted block, in the direction of the interacted face. The game simulates the [[Minecraft:hitbox]] of an armor stand in this position; if the hitbox collides with a block or intersects with an entity hitbox (except [[Minecraft:spectator]]s), the interaction fails.


The game attempts to obtain the armor stand, based on the item's components {{DCL|custom_name}}, {{DCL|custom_data}}, and {{DCL|entity_data}}. If it cannot be generated, the interaction fails.
The game attempts to obtain the armor stand, based on the item's components {{DCL|custom_name}}, {{DCL|custom_data}}, and {{DCL|entity_data}}. If it cannot be generated, the interaction fails.


In case of the armor stand is generated, apply in the following order:
If the armor stand is generated, apply in the following order:
* the armor stand rotates 202.5° according to the player's rotation, but rounds its rotation down to some multiple of 45°;
* The armor stand rotates 202.5° according to the player's rotation, but rounds its rotation down to some multiple of 45°;
* the [[Minecraft:sound event]] armor stand place ({{cd|entity.armor_stand.place}}) is played;
* The [[Minecraft:sound event]] armor stand place ({{cd|entity.armor_stand.place}}) is played;
* produce the [[Minecraft:game event]] {{cd|entity_place}};  
* The [[Minecraft:game event]] {{cd|entity_place}} is produced;  
* shrink one item of the item stack.
* The item stack is shrunk by one.


The interaction returns success given no aforementioned fails occur.
The interaction returns success given no aforementioned fails occur.
Armor stand [[Minecraft:Armor_Stand#Entity_data|entity data]]:
<div class="treeview">
* {{nbt|compound}} Entity data
** {{nbt inherit/apply components from item stack}}
** {{nbt|string|id}}: {{cd|minecraft:armor_stand}}.
** {{nbt|list|Pos}}: The target position. Try moving up to one block down, looking for a collision box that connects with the armor support's hitbox. This attempt is made before applying the {{DCL|entity_data}} component.
** {{nbt|list|Rotation}}:
*** {{nbt|float}}: See above.
*** {{nbt|float}}: {{cd|0.0f}}.
** {{nbt||<''most tag''>}}: With the exception of '''id''', '''Rotation''', '''Passengers''' , and '''UUID''', it can be defined by {{DCL|entity_data}}. The {{DCL|entity_data}} only has an effect if the {{DCL|entity_data.id}} is {{cd|minecraft:armor_stand}}. '''CustomName''', '''data''', and '''Pos''' have priority to be defined by component {{DCL|entity_data}}.
</div>


=== ArrowItem ===
=== ArrowItem ===
{{empty section}}
{{Infobox hardcoded item property|class=ArrowItem|Arrow|Spectral Arrow|Tipped Arrow|impts={{cd|ProjectileItem}}||impns=
=== AxeItem ===
*{{slink||SpectralArrowItem}}
{{empty section}}
*{{slink||TippedArrowItem}}
}}
 
'''createArrow({{Tooltip|...|Level level, ItemStack itemStack, LivingEntity owner, ItemStack firedFromWeapon}})'''
 
Creates an {{cd|AbstractArrow}} projectile entity from the item.
 
Used by {{cd|createProjectile}} in {{slink||ProjectileWeaponItem}}, and by [[Minecraft:skeleton]]s and [[Minecraft:illusioner]]s via {{slink||ProjectileUtil}}.
 
For regular arrows, creates an [[Minecraft:Arrow#Entity data|arrow projectile]] with:
{{-}}
<div class="treeview">
* {{nbt|compound}} Entity data
** {{nbt inherit/apply components from item stack}}
** {{nbt|string|id}}: {{cd|minecraft:arrow}}.
** {{nbt|list|Pos}}:
*** {{nbt|double}}: Owner's X coordinate.
*** {{nbt|double}}: Owner's eye Y coordinate minus {{cd|0.1}}.
*** {{nbt|double}}: Owner's Z coordinate.
** {{nbt|compound|item}}: The ''item stack'' copy, with count 1.
** {{nbt|compound|weapon}}: The ''fired from weapon'' copy, if it exists.
** {{nbt|byte|PierceLevel}}: According to the [[Minecraft:Enchantment_definition#Effect components|effect components]] {{cd|projectile_piercing}} of the weapon enchantments, if it exists. The ''item stack'' can be used for requirements.
** {{nbt|byte|pickup}}: {{cd|2b}} (creative only) if the item has the component {{DCL|intangible_projectile}}, {{cd|1b}} (allowed) otherwise.
** {{nbt|int array|Owner}}: The ''owner'' [[Minecraft:UUID]].
</div>
 
'''asProjectile({{Tooltip|...|Level level, Position position, ItemStack itemStack, Direction direction}})'''
{{hatnote|Overrides method in {{cd|{{jicp|Projectile}}}}}}
 
Creates an arrow projectile not fired from any weapon, used by [[Minecraft:dispenser]]s and [[Minecraft:ominous item spawner]]s, with:
 
{{-}}
<div class="treeview">
* {{nbt|compound}} Entity data
** {{nbt inherit/apply components from item stack}}
** {{nbt|string|id}}: {{cd|minecraft:arrow}}.
** {{nbt|list|Pos}}: The ''position''.
** {{nbt|compound|item}}: The ''item stack'' copy, with count 1.
** {{nbt|byte|pickup}}: {{cd|1b}} (allowed), regardless of {{DCL|intangible_projectile}}.
</div>
 
{{-}}
=== BannerItem ===
=== BannerItem ===
{{empty section}}
{{Infobox hardcoded item property|class=BannerItem|Items={{ItemLink|Banner|id=Banners}} (ColorCollection)|ext=  
=== BedItem ===
{{Slink||StandingAndWallBlockItem}} ({{Slink||BlockItem}} )}}
{{empty section}}
 
'''getColor()'''
 
Used by the [[Minecraft:Recipe_(Java_Edition)#crafting_special_*|{{cd|crafting_special_bannerduplicate}}]] recipe type to determine whether the banner colors match, and by the [[Minecraft:Recipe_(Java_Edition)#crafting_special_*|{{cd|crafting_special_shielddecoration}}]] recipe type to set the {{DCL|base_color}} of the shield.
 
This is done by calling the {{cd|getColor}} method of {{cd|AbstractBannerBlock}} on the item's block form, and as such the block forms of a {{cd|BannerItem}} must extend {{cd|AbstractBannerBlock}}.
 
{{-}}
 
=== BlockItem ===
=== BlockItem ===
{{Expand section}}
{{Expand section}}
{{Infobox hip|class=BlockItem|Acacia Button|Acacia Door|Acacia Fence|Acacia Fence Gate|Acacia Hanging Sign|Acacia Leaves|Acacia Log|Acacia Planks|Acacia Pressure Plate|Acacia Sapling|Acacia Shelf|Acacia Sign|Acacia Slab|Acacia Stairs|Acacia Trapdoor|Acacia Wood|Activator Rail|Allium|Amethyst Cluster|Ancient Debris|Andesite|Andesite Slab|Andesite Stairs|Items=*'''and more 990''' ([[Minecraft:Item#Items_that_directly_correspond_to_blocks|total 1003]])|Inv=1|impns=
{{Infobox hardcoded item property|class=BlockItem|Acacia Button|Acacia Door|Acacia Fence|Acacia Fence Gate|Acacia Hanging Sign|Acacia Leaves|Acacia Log|Acacia Planks|Acacia Pressure Plate|Acacia Sapling|Acacia Shelf|Acacia Sign|Acacia Slab|Acacia Stairs|Acacia Trapdoor|Acacia Wood|Activator Rail|Allium|Amethyst Cluster|Ancient Debris|Andesite|Andesite Slab|Andesite Stairs|Items=*'''and more 990''' ([[Minecraft:Item#Items_that_directly_correspond_to_blocks|total 1003]])|Inv=1|impns=
*{{slink||BannerItem}}
*{{slink||BannerItem}}
*{{slink||BedItem}}
*{{slink||DoubleHighBlockItem}}
*{{slink||DoubleHighBlockItem}}
*{{slink||GameMasterBlockItem}}
*{{slink||GameMasterBlockItem}}
Line 1,200: Line 1,293:


Set the {{DCL|container}} component of the entity item to empty. If the component existed previously, drop all the item stacks it contained at the entity item's position.
Set the {{DCL|container}} component of the entity item to empty. If the component existed previously, drop all the item stacks it contained at the entity item's position.
'''requiredFeatures()'''
{{hatnote|Overrides method in [[#requiredFeatures()|{{jicp|}}]]}}
Returns the required features of the block associated with the item. Currently, all blocks have {{cd|VANILLA_SET}}, so there are no blocks exclusively for [[Minecraft:experiments]].


====Place====
====Place====
{{empty section}}


====Block by item====
====Block by item====
Line 1,217: Line 1,306:
In {{jicp|-s}}, ItemBlocks are registered using either the {{cd|registerBlock(...)}} method or the {{cd|createBlockItemWithCustomItemName(...)}} method.
In {{jicp|-s}}, ItemBlocks are registered using either the {{cd|registerBlock(...)}} method or the {{cd|createBlockItemWithCustomItemName(...)}} method.


In {{cd|registerBlock()}} given a block, an item is created with the same id, and with the block description id, after that {{cd|registerBlocks}} is used to save the block and item in {{cd|Item.BY_BLOCK}}. There are some variations, which can be summarized as: adding default components to the item (by {{slink||Item.Properties}}), making the item a different class, a subclass of ItemBlock (with a single exception in {{slink||AirBlock}}) and put alternative blocks in {{jicp|}}.{{cd|BY_BLOCK}}.
In {{cd|registerBlock()}} given a block, an item is created with the same id, and with the block description id, after that {{cd|registerBlocks}} is used to save the block and item in {{cd|Item.BY_BLOCK}}. There are some variations, which can be summarized as: adding default components to the item (by {{slink||Item.Properties}}), making the item a different class, a subclass of ItemBlock and put alternative blocks in {{jicp|}}.{{cd|BY_BLOCK}}.


Only two items have alternate blocks:  
Only two items have alternate blocks:  
Line 1,233: Line 1,322:
| {{ItemLink|Resin Clump}} || {{cd|resin_clump}} || {{BlockLink|Resin Clump}} || {{cd|resin_clump}}
| {{ItemLink|Resin Clump}} || {{cd|resin_clump}} || {{BlockLink|Resin Clump}} || {{cd|resin_clump}}
|-
|-
| {{ItemLink|Redstone Dust}} || {{cd|redstone}} || {{BlockLink|Redstone Wire}} || {{cd|redstone wire}}
| {{ItemLink|Redstone Dust}} || {{cd|redstone}} || {{BlockLink|Redstone Wire}} || {{cd|redstone_wire}}
|-
|-
| {{ItemLink|String}} || {{cd|string}} || {{BlockLink|Tripwire}} || {{cd|tripwire}}
| {{ItemLink|String}} || {{cd|string}} || {{BlockLink|Tripwire}} || {{cd|tripwire}}
Line 1,241: Line 1,330:
| {{ItemLink|Cocoa Beans}} || {{cd|cocoa_beans}} || {{BlockLink|Cocoa}} || {{cd|cocoa}}
| {{ItemLink|Cocoa Beans}} || {{cd|cocoa_beans}} || {{BlockLink|Cocoa}} || {{cd|cocoa}}
|-
|-
| {{ItemLink|Pumpkin Seeds}} || {{cd|pumpkin_seeds}} || {{BlockLink|Pumpkin Stem}} || {{cd|Pumpkin_stem}}
| {{ItemLink|Pumpkin Seeds}} || {{cd|pumpkin_seeds}} || {{BlockLink|Pumpkin Stem}} || {{cd|pumpkin_stem}}
|-
|-
| {{ItemLink|Melon seeds}} || {{cd|melon_seeds}} || {{BlockLink|Melon Stem}} || {{cd|melon_stem}}
| {{ItemLink|Melon seeds}} || {{cd|melon_seeds}} || {{BlockLink|Melon Stem}} || {{cd|melon_stem}}
Line 1,275: Line 1,364:
Used for generating new instances of items, not exactly a property. I don't know if I should talk about it.
Used for generating new instances of items, not exactly a property. I don't know if I should talk about it.
-->
-->
==== Usage in instanceof ====
==== Usage in instanceof ====


=== BoatItem ===
=== BoatItem ===
{{empty section}}
{{Infobox hardcoded item property|class=BoatItem|Oak Boat|Oak Boat with Chest|Spruce Boat|Spruce Boat with Chest|Birch Boat|Birch Boat with Chest|Jungle Boat|Jungle Boat with Chest|Acacia Boat|Acacia Boat with Chest|Cherry Boat|Cherry Boat with Chest|Dark Oak Boat|Dark Oak Boat with Chest|Pale Oak Boat|Pale Oak Boat with Chest|Mangrove Boat|Mangrove Boat with Chest|Bamboo Raft|Bamboo Raft with Chest|Poplar Boat|Poplar Boat with Chest}}
 
'''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})'''
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]] }}
 
Checks if the player is looking at a block (including fluids) and passes if not. Then checks if any pickable entities' pick hitboxes contain the player's eye position and passes if so.
 
Then tries to create a boat entity with a type hardcoded for each item ID at the block targeted and fails if the entity cannot be created. If it is spawned, its yaw rotation is set to the player's yaw rotation. Then fails if the boat is intersecting anything except fluid.
 
Finally, adds the boat to the world, produces an {{cd|entity_place}} [[Minecraft:game event]], consumes one item from the stack, adds to the item used statistic, and succeeds.
 
{{-}}
 
=== BoneMealItem ===
=== BoneMealItem ===
{{empty section}}
{{Infobox hardcoded item property|class=BoneMealItem|Bone Meal}}
=== BottleItem ===
 
{{empty section}}
All the behavior of bone meal is hardcoded in this class.
 
'''useOn({{Tooltip|...|UseOnContext context}})'''
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]] }}
 
First calls {{cd|growCrop}}. If it returns {{cd|true}}, the interaction succeeds, the stack shrinks by one, [[Minecraft:Java_Edition_protocol/Packets#World_Event|world event]] 1505 (bone meal particles and sound) is caused, and an {{cd|item_interact_finish}} [[Minecraft:game event]] is produced.
 
Otherwise, checks if a full solid face was clicked (passing if not) and calls {{cd|growWaterPlant}}, succeeding as described above if it returns {{cd|true}}. If it returns {{cd|false}}, the interaction passes.
 
'''growCrop({{Tooltip|...|ItemStack itemStack, Level level, BlockPos pos}})'''
 
Tries to bone meal a {{cd|{{jcp|net.minecraft.world.level.block.BonemealableBlock|BonemealableBlock}}}}. If it is valid, regardless of whether it succeeds, returns {{cd|true}} (otherwise returns {{cd|false}}).
 
Also used by [[Minecraft:dispenser]]s and {{slink||UseBonemeal}}.
 
'''growWaterPlant({{Tooltip|...|ItemStack itemStack, Level level, BlockPos pos, Direction clickedFace}})'''
 
Attempts to grow plants underwater, defaulting to [[Minecraft:seagrass]]. Returns {{cd|false}} if the block next to the clicked face is not a full water block, and {{cd|true}} otherwise.
 
If used in a biome in {{Tag link|biome|produces_corals_from_bonemeal}}, the block next to the clicked face is replaced with a random block in {{Tag link|block|wall_corals}} if a side face was clicked, and other seagrass blocks that would be placed have a 1/4 chance of being replaced with random blocks from {{Tag link|block|underwater_bonemeals}}.
 
Also used by [[Minecraft:dispenser]]s.
 
{{-}}
 
=== BottleItem ===
{{Infobox hardcoded item property|class=BottleItem|Glass Bottle}}
 
'''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})'''
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]] }}
 
First checks for [[Minecraft:area effect cloud]]s owned by an [[Minecraft:ender dragon]] (i.e. dragon's breath) within 2 blocks of the player's hitbox. If there is at least one, picks one and reduces its radius by 0.5, plays the {{cd|item.bottle.fill_dragonbreath}} sound event, produces a {{cd|fluid_pickup}} game event, triggers the {{cd|player_interacted_with_entity}} advancement trigger, transforms a bottle (or all of them, if the player is in Creative mode) into [[Minecraft:dragon's breath]], and succeeds.
 
If there is not any dragon's breath, checks if the player is interacting with water (passing otherwise) and plays the {{cd|item.bottle.fill}} sound event, produces a {{cd|fluid_pickup}} game event, transforms a bottle (or all of them) into a [[Minecraft:water bottle]], and succeeds.
 
{{-}}
 
=== BowItem ===
=== BowItem ===
{{empty section}}
{{empty section}}
Line 1,292: Line 1,430:
{{empty section}}
{{empty section}}
=== CompassItem ===
=== CompassItem ===
{{empty section}}
{{Infobox hardcoded item property|class=CompassItem|Compass}}
=== CrossbowItem ===
{{empty section}}
=== DebugStickItem ===
{{empty section}}
=== DiscFragmentItem ===


{{Infobox hip|class=DiscFragmentItem|Disc Fragment}}
'''isFoil({{Tooltip|...|ItemStack itemStack}})'''
{{hatnote|Overrides method in [[#isFoil(...)|{{jicp|}}]] }}


'''appendHoverText({{tooltip|minetip=1|...|ItemStack itemStack, Item.TooltipContext context, TooltipDisplay display, Consumer&lt;Component&gt; builder, TooltipFlag tooltipFlag}})'''
Overridden to {{cd|true}} if this stack has the {{DCL|lodestone_tracker}} component.
{{hatnote|Overrides method in [[#appendHovertText(...)|{{jicp|}}]]}}


Define the first line of the tooltip as the translation of {{cd|''item.minecraft.disc_fragment.desc''}} in gray ({{color|#AAAAAA}}).
'''inventoryTick({{Tooltip|...|ItemStack itemStack, ServerLevel level, Entity owner, EquipmentSlot slot}})'''
{{hatnote|Overrides method in [[#inventoryTick(...)|{{jicp|}}]] }}


This line cannot be hidden by the {{DCL|tooltip_display}} component, except to completely hide the tooltip with {{cd|hide_tooltip}} set to {{cd|true}}.
If this stack has the {{DCL|lodestone_tracker}} component, updates the tracker (i.e. sets it to empty if it is invalidated).


=== DispensibleContainerItem ===
'''useOn({{Tooltip|...|UseOnContext context}})'''
{{empty section}}
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]] }}
=== DoubleHighBlockItem ===
{{empty section}}
=== DyeItem ===


{{Infobox hip|class=DyeItem|White Dye|Orange Dye|Light Blue Dye|Yellow Dye|Lime Dye|Pink Dye|Gray Dye|Light Gray Dye|Cyan Dye|Purple Dye|Blue Dye|Green Dye|Red Dye|Black Dye|impts={{cd|SignApplicator}}}}
If the clicked block was a [[Minecraft:lodestone]], instead play the {{cd|item.lodestone_compass.lock}} sound event and create a lodestone compass by setting the {{DCL|lodestone_tracker}} component. If in creative mode or with a stack size greater than 1, all components are copied to a new item that gains {{DCL|lodestone_tracker}} and the original stack is shrunk by one. The interaction succeeds.


Each item has a default {{DCL|dye}} component, defined in {{jicp|-s}}.
'''getName({{Tooltip|...|ItemStack itemStack}})'''
{{hatnote|Overrides method in [[#getName(...)|{{jicp|}}]] }}


When two sheep, cats, or dogs breed, take the color of each parent (the color of the wool or the color of the collar) and search all items that have the component {{cd|dye}} of that color as a default and try to create the first recipe for each pair. If the result of some of these recipes is an item with the component {{cd|dye}}, that color will be used for the offspring; otherwise, a random color from the parents is added.
If this stack has the {{DCL|lodestone_tracker}} component, instead return the lodestone compass item name (translation {{cd|item.minecraft.lodestone_compass}})


Thus, the color of these animals depends on the hardcoded property of the dyes, and the color can only be edited along with the item's recipes. Only dyes have the component {{cd|dye}} by default, and each value of the component exists in exactly one dye.
=== CrossbowItem ===
{{empty section}}
=== CushionItem ===


'''interactLivingEntity({{tooltip|minetip=1|...|ItemStack itemStack, Player player, LivingEntity target, InteractionHand type}})'''
{{Update|section=1|Significant changes in [[Minecraft:26.3-snap4]]}}
{{hatnote|Overrides method in [[#interactLivingEntity(...)|{{jicp|}}]]}}
{{Infobox hardcoded item property|class=CushionItem|Items={{ItemLink|Cushion|id=Cushions}} (ColorCollection)}}
 
'''useOn({{tooltip|...|UseOnContext context}})'''
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]]}}
 
Position the cushion. Method partially described in {{slink|Cushion|Placement}}.
 
The interaction fails if the clicked face is not the up fece. Otherwise, summon an Axis-Aligned Bounding Box (AABB) with size of a cushion's hitbox (16×4×16 pixels), the X and Z axes centered on the interlocking block, and the minimum of the Y-axis at the clicked position.
 
If a cushion cannot survive in the AABB block ({{jcp|net.minecraft.world.entity.decoration.Cushion}}.{{cd|wouldSuriveAt(level, spawnAABB)}}), the interaction fails. The test consists of invoking a new AABB block with the same width, but {{frac|1|4}} of a pixel higher than the existing AABB block, below the existing AABB. Then, it checks if at least one block position (entire position) containing the new AABB has a block whose interaction box intersects the AABB. If no block intersects, the test fails.
 
At this point, the interaction returns success on the client side, and so the player moves their hand. Although the interaction may still fail on the server side, as described below:
 
* If the hitbox of an existing cushion is intersected by the AABB, the interaction fails.
* Try summoning a cushion, with {{cd|CustomName}} and {{cd|data}} defined repeatedly by the {{DCL|custom_name}} and {{DCL|custom_data}} components of the item stack. If, for some reason, it is not possible to invoke it, the interaction fails.
* Position the cushion in the same position as the AABB. The y-rotation of the cushion is defined by {{cd|[[Minecraft:w:Modulo|mod]](90 × [[Minecraft:w:Floor and ceiling functions|floor]]((''yRot'' + 0.5) ÷ 90), 360)}}, where {{cd|''yRot''}} is the player's y-rotation. The x-rotation is defined as zero.
* Set the cushion color to match the item color (the item color is defined by ColorCollection when registering them).
* Play [[Minecraft:sound event]] cushion place ({{sound|{{cd|entity.cushion.place}}|Cushion place2.ogg|Cushion place3.ogg|Cushion place4.ogg|Cushion place5.ogg|Cushion place6.ogg }})
* Produce the [[Minecraft:game event]] {{cd|entity_place}} (output 14)
* Consumes one item from the player, except if the player is in {{Tooltip|creative mode|hasInfiniteMaterials}}.
 
The interaction returns success given no aforementioned fails occur.
{{-}}
 
=== DebugStickItem ===
{{Infobox hardcoded item property|class=DebugStickItem|Debug Stick}}
 
Handles all the behavior of the [[Minecraft:debug stick]] as described on its page.


The interaction is only successful, instead of pass, when the interacting entity is a non-sheared live [[Minecraft:sheep]] of a different color than the {{cd|dye}} component and the item stack has a {{cd|dye}} component.
'''canDestroyBlock({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, LivingEntity user}})'''
{{hatnote|Overrides method in [[#canDestroyBlock(...)|{{jicp|}}]] }}


In case of success, the [[Minecraft:sound]] dye use is played, set the sheep color and shrink the item stack by one.
Always returns {{cd|false}}, and triggers an interaction selecting a block state.


'''tryApplyToSign({{tooltip|minetip=1|...|Level level, SignBlockEntity sign, boolean isFrontText, Player player}})'''
'''useOn({{Tooltip|...|UseOnContext context}})'''
{{hatnote|Overrides method in {{cd|SignApplicator}}}}
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]] }}


If the stack item does not contain the {{cd|dye}} component, it returns false.
Triggers an interaction cycling the value of a block state, failing if that interaction fails (if the player cannot use game master blocks, if the block has no properties, or if the item does not have the {{DCL|debug_stick_state}} component) and succeeding otherwise.


Try changing the text color on the sign, on the side being interacted with, to the color of the dye.
{{-}}


In case of success, the dye used sound is played and returns true. Otherwise, returns false.
=== DiscFragmentItem ===


=== EggItem ===
{{Infobox hardcoded item property|class=DiscFragmentItem|Disc Fragment}}
{{empty section}}
 
=== EmptyMapItem ===
'''appendHoverText({{tooltip|...|ItemStack itemStack, Item.TooltipContext context, TooltipDisplay display, Consumer&lt;Component&gt; builder, TooltipFlag tooltipFlag}})'''
{{empty section}}
{{hatnote|Overrides method in [[#appendHovertText(...)|{{jicp|}}]]}}
=== EndCrystalItem ===
 
{{empty section}}
Define the first line of the tooltip as the translation of {{cd|''item.minecraft.disc_fragment.desc''}} in gray ({{color|#AAAAAA}}).
=== EnderEyeItem ===
 
{{empty section}}
This line cannot be hidden by the {{DCL|tooltip_display}} component, except to completely hide the tooltip with {{cd|hide_tooltip}} set to {{cd|true}}.
=== EnderpearlItem ===
 
{{empty section}}
=== DoubleHighBlockItem ===
=== ExperienceBottleItem ===
{{Infobox hardcoded item property|class=DoubleHighBlockItem|Items={{Flatlist|*{{BlockLink|Small Dripleaf}}
{{empty section}}
*{{BlockLink|Sunflower}}
=== FireChargeItem ===
*{{BlockLink|Lilac}}
{{empty section}}
*{{BlockLink|Rose Bush}}
=== FireworkRocketItem ===
*{{BlockLink|Peony}}
{{empty section}}
*{{BlockLink|Tall Grass}}
=== FishingRodItem ===
*{{BlockLink|Large Fern}}
{{empty section}}
*{{BlockLink|Doors}}
=== FlintAndSteelItem ===
}}|ext={{slink||BlockItem}}}}
{{empty section}}
 
=== FoodOnAStickItem ===
'''placeBlock({{Tooltip|...|BlockPlaceContext context, BlockState placementState}})'''
{{empty section}}
{{hatnote|Overrides method in [[#BlockItem|{{jicp|Block}}]]}}
=== GameMasterBlockItem ===
 
{{empty section}}
Sets the block above to water if there is water above (including waterlogged blocks) and air otherwise before placing the block normally, effectively replacing the block above while leaving water intact for waterlogging.{{info needed|Why? Small Dripleaf is the only waterloggable block here, and not all two-high blocks are here.}}
=== GlowInkSacItem ===
 
{{empty section}}
{{-}}
=== HangingEntityItem ===
 
{{empty section}}
=== DyeItem ===
=== HangingSignItem ===
 
{{empty section}}
{{Infobox hardcoded item property|class=DyeItem|Items={{ItemLink|Dye}} (ColorCollection)|impts={{cd|SignApplicator}}}}
=== HoeItem ===
 
{{empty section}}
Each item has a default {{DCL|dye}} component, defined in {{jicp|-s}}.
=== HoneycombItem ===
 
{{empty section}}
When two sheep, cats, or dogs breed, take the color of each parent (the color of the wool or the color of the collar) and search all items that have the component {{cd|dye}} of that color as a default and try to create the first recipe for each pair. If the result of some of these recipes is an item with the component {{cd|dye}}, that color will be used for the offspring; otherwise, a random color from the parents is added.
=== InkSacItem ===
 
{{empty section}}
Thus, the color of these animals depends on the hardcoded property of the dyes, and the color can only be edited along with the item's recipes. Only dyes have the component {{cd|dye}} by default, and each value of the component exists in exactly one dye.
=== InstrumentItem ===
{{empty section}}
=== ItemFrameItem ===
{{empty section}}
=== KnowledgeBookItem ===
{{empty section}}
=== LeadItem ===
{{empty section}}
=== LingeringPotionItem ===
{{empty section}}
=== MaceItem ===
{{empty section}}
=== MapItem ===
{{empty section}}
=== MinecartItem ===
{{empty section}}
=== MobBucketItem ===
{{empty section}}
=== NameTagItem ===
{{Infobox hip|class=NameTagItem|Name Tag}}


'''interactLivingEntity({{tooltip|minetip=1|...|ItemStack itemStack, Player player, LivingEntity target, InteractionHand type}})'''
'''interactLivingEntity({{tooltip|...|ItemStack itemStack, Player player, LivingEntity target, InteractionHand type}})'''
{{hatnote|Overrides method in [[#interactLivingEntity(...)|{{jicp|}}]]}}
{{hatnote|Overrides method in [[#interactLivingEntity(...)|{{jicp|}}]]}}


The interaction will only be successful, instead of pass, when:
The interaction is only successful, instead of pass, when the interacting entity is a non-sheared live [[Minecraft:sheep]] of a different color than the {{cd|dye}} component and the item stack has a {{cd|dye}} component.
* the item has a {{DCL|custom_name}} component, and
* the entity isn't a [[Minecraft:player]], [[Minecraft:leash knot]], [[Minecraft:lightning bolt]], or [[Minecraft:fishing bobber]].


If the entity is alive, sets its {{cd|CustomName}} to be the same as the name tag. If the entity is a mob, also sets {{cd|PersistenceRequired}} true. Shrink the item stack of the item by one.
In case of success, the [[Minecraft:sound]] dye use is played, set the sheep color and shrink the item stack by one.


Note: This method is only called for living entities, so it ends up being a redundant under certain conditions. Even though the ender dragon is a living entity, this method is never called by it because when trying to interact with it, the {{cd|EnderDragonPart}} is actually being interacted, which is not a living entity.
'''tryApplyToSign({{tooltip|...|Level level, SignBlockEntity sign, boolean isFrontText, Player player}})'''
{{hatnote|Overrides method in {{cd|SignApplicator}}}}


=== PlaceOnWaterBlockItem ===
If the stack item does not contain the {{cd|dye}} component, it returns false.
{{empty section}}
=== PlayerHeadItem ===
{{empty section}}
=== PotionItem ===


{{Infobox hip|class=PotionItem|Potion|Splash Potion|Lingering Potion|impns=
Try changing the text color on the sign, on the side being interacted with, to the color of the dye.
* {{cd|SplashPotionItem}}
* {{cd|ThrowablePotionItem}}
* {{cd|LingeringPotionItem}}
}}


'''useOn({{tooltip|minetip=1|...|UseOnContext context}})'''
In case of success, the dye used sound is played and returns true. Otherwise, returns false.
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]]}}


The interaction will only be successful, instead of pass, when:
=== EggItem ===
* the face of the interacted block was not directed downward,
{{Infobox hardcoded item property|class=EggItem|Blue Egg|Brown Egg|Egg}}
* the block is in the [[Minecraft:Block_tag_(Java_Edition)#convertable_to_mud|#convertable_to_mud]] tag, and
* the potion's content is water.


In case of success, apply in the following order:
'''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})'''
# Play the generic splash [[Minecraft:sound event]] ({{cd|''entity.generic.splash''}}),
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}}
# Set [[Minecraft:glass bottle]] in hand,
# Send splash [[Minecraft:Particles_(Java_Edition)|particles]],
# Play the bottle empty sound event ({{cd|''item.bottle.empty''}}), 
# Produce the [[Minecraft:game event]] {{cd|fluid_place}},
# Convert the block to [[Minecraft:mud]].


'''getName({{tooltip|minetip=1|...|ItemStack itemStack}})'''
Always succeeds. Plays the {{cd|entity.egg.throw}} sound effect, consumes an item, awards statistics, and spawns an [[Minecraft:Egg#Entity data|egg projectile]] with:
{{hatnote|Overrides method in [[#getName(...)|{{jicp|}}]]}}
<div class="treeview">
* {{nbt|compound}} Entity data
** {{Nbt|string|id}}: {{cd|minecraft:egg}}
** {{nbt|list|Pos}}:
*** {{nbt|double}}: Owner's X coordinate.
*** {{nbt|double}}: Owner's eye Y coordinate minus {{cd|0.1}}.
*** {{nbt|double}}: Owner's Z coordinate.
** {{Nbt|compound|Item}}: a copy of the item stack with the count set to 1.
** {{nbt|int array|Owner}}: The ''player'' [[Minecraft:UUID]].
</div>
The projectile is fired with an uncertainty of 1 and a power of 1.5.


If the item has the component {{cd|[[Minecraft:potion_contents]]}}, the name name is defined from it. The item uses the translation key {{cd|''item.minecraft.<item type>.effect.<potion name>''}}, where {{cd|''<potion name>''}} is the custom name of the potion contents, if available, and otherwise is the name of the potion in potion contents (see {{slink|Potion|Item data}}), if available. If nether is available, is "{{cd|empty}}". 
'''asProjectile({{Tooltip|...|Level level, Position position, ItemStack itemStack, Direction direction}})'''
{{hatnote|Overrides method in {{cd|{{jicp|Projectile}}}}}}


This name will replace the name defined by {{DCL|item_name}}. However, it can still be replaced by the {{DCL|custom_name}}, if available.
Used by [[Minecraft:dispenser]]s and [[Minecraft:ominous item spawner]]s.
Creates an egg projectile with:
<div class="treeview">
* {{nbt|compound}} Entity data
** {{Nbt|string|id}}: {{cd|minecraft:egg}}
** {{nbt|list|Pos}}: The ''position''.
** {{Nbt|compound|Item}}: a copy of the item stack with the count set to 1.
</div>
No item components are used.


====Usage in instanceof====
{{-}}


The class {{jicp|Potion}} has one instanceof usage. This usage occurs in {{jicp|alchemy|PotionBrewing}}.{{cd|expectPotion({{tooltip|...|Item from}})}} to validate the method that adds container recipes.
=== EmptyMapItem ===
{{Infobox hardcoded item property|class=EmptyMapItem|Empty Map}}


In vanilla, this method adds the [[Minecraft:brewing]] recipes that transform potions into splash potions and splash potions into lingering potions. If the source item or the destination item is not an instance of {{jicp|Potion}}, it throws an {{cd|IllegalArgumentException}}, immediately aborting the method and logging the error {{cd|Expected a potion, got: <item ID>}}.
'''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})'''
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]] }}


However, currently, this doesn't affect the vanilla game at all, because besides the vanilla container recipes already being potions, it's not possible to customize them. Although this may affect [[Minecraft:mod]]s and possible future customizations (as [[Minecraft:Recipe_(Bedrock_Edition)#recipe_brewing_container|already exists]] {{in|BE}}).
Always succeeds. Consumes an item, awards statistics, plays the {{cd|ui.cartography_table.take_result}} sound effect, creates map data from the player's X and Z position, with a scale of 0, that tracks their position within range, and gives the player a [[Minecraft:filled map]] with its {{DCL|map_id}} component pointing to that map data.


=== ProjectileItem ===
{{-}}
{{empty section}}
 
=== ProjectileWeaponItem ===
=== EndCrystalItem ===
{{empty section}}
{{Infobox hardcoded item property|class=EndCrystalItem|End Crystal}}
=== ScaffoldingBlockItem ===
 
{{empty section}}
'''useOn({{Tooltip|...|UseOnContext context}})'''
=== ShearsItem ===
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]] }}
{{empty section}}
 
=== ShieldItem ===
Fails if the block clicked is not [[Minecraft:obsidian]] or [[Minecraft:bedrock]], or if the block above the one clicked is not empty.
Then checks for entities in a 1x2x1 box above the clicked block and fails if there are any.
 
If none of those checks failed, the interaction succeeds, the stack is shrunk by 1, and an [[Minecraft:End_Crystal#Entity_data|end crystal]] is spawned with:
<div class="treeview">
* {{nbt|compound}} Entity data
** {{Nbt|string|id}}: {{cd|minecraft:end_crystal}}
** {{Nbt|list|Pos}}: The bottom center of the block above the one clicked.
** {{Nbt|boolean|ShowBottom}}: {{cd|false}}
</div>
No item components are used.
 
Triggers an {{cd|entity_place}} [[Minecraft:game event]], and checks if the [[Minecraft:ender dragon]] should be respawned if the current dimension has a dragon fight.


{{Infobox hip|class=ShieldItem|Shield}}
{{-}}


'''getName({{tooltip|minetip=1|...|ItemStack itemStack}})'''
=== EnderEyeItem ===
{{hatnote|Overrides method in [[#getName(...)|{{jicp|}}]]}}
{{Infobox hardcoded item property|class=EnderEyeItem|Eye of Ender}}


If the item has the component {{DCL|base_color}}, the name is defined from it. The item uses the translation key {{cd|''item.minecraft.shield.<color>''}}.
'''getUseDuration({{Tooltip|...|ItemStack itemStack, LivingEntity user}})'''
{{hatnote|Overrides method in [[#getUseDuration(...)|{{jicp|}}]]}}


This name will replace the name defined by {{DCL|item_name}} component. However, it can still be replaced by the {{DCL|custom_name}} component, if available.
Always returns 0, ignoring item components.


=== ShovelItem ===
'''useOn({{Tooltip|...|UseOnContext context}})'''
{{empty section}}
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]]}}
=== SignItem ===
{{empty section}}
=== SmithingTemplateItem ===
{{Infobox hip|class=SmithingTemplateItem|Netherite Upgrade|Sentry Armor Trim|Vex Armor Trim|Wild Armor Trim|Coast Armor Trim|Dune Armor Trim|Wayfinder Armor Trim|Raiser Armor Trim|Shaper Armor Trim|Host Armor Trim|Ward Armor Trim|Silence Armor Trim|Tide Armor Trim|Snout Armor Trim|Rib Armor Trim|Eye Armor Trim|Spire Armor Trim|Flow Armor Trim|Bolt Armor Trim}}


==== New SmithingTemplateItem ====
Passes if the targeted block is not an [[Minecraft:end portal frame]] or if the frame is already with eye. Then always succeeds, pushes [[Minecraft:entities]] up to compensate for the block's new shape (see details below), sets the targeted frame's {{cd|eye}} [[Minecraft:block states|state]] to {{cd|true}}, shrinks the stack by 1, updates attached [[Minecraft:comparator]]s, and causes [[Minecraft:Java_Edition_protocol/Packets#World_Event|world event]] 1503.
Each instance of SmithingTemplateItem has a series of class-specific attributes, which are defined by {{cd|SmithingTemplateItem({{Tooltip|...|Component appliesTo, Component ingredients, Component baseSlotDescription, Component additionsSlotDescription, List&lt;Identifier&gt; baseSlotEmptyIcons, List&lt;Identifier&gt; additionalSlotEmptyIcons, Item.Properties properties}})}}. However, these attributes are not defined separately for each item; instead, they are defined by the {{cd|createNetheriteUpgradeTemplate({{Tooltip|...|Item.Properties properties}})}} and {{cd|createArmorTrimTemplate({{Tooltip|...|Item.Properties properties}})}} methods, where respectively defines the attributes of netherite upgrade and of all armor trims. In {{jicp|-s}}, only the item components are defined (by {{slink||Item.Properties}}, which in this case is only the {{DCL|rarity}} component).


These methods use the {{cd|createTrimmableArmorIconList()}}, {{cd|createTrimmableMaterialIconList()}}, {{cd|createNetheriteUpgradeIconList()}}, and {{cd|createNetheriteUpgradeMaterialList()}} auxiliary methods, and many auxiliary constants to create these attributes. Below is the complete table of these attributes:
Then checks if and where an end portal should be activated, and fills the [[Minecraft:End_Portal_(block)|end portal blocks]] accordingly, causing world event 1038 globally from the center of the 3x3 portal. See {{Slink|End portal|Creation}} for more information on activating the portal.


{| class="wikitable reset-wrap sortable" <!--style="text-align:center"-->
Entity push details: all entities, except [[Minecraft:spectator]] players, whose [[Minecraft:bounding box]] intersects the new parte of the end portal frame's [[Minecraft:collision box]] (known as 8x3x8 pixels, centered on the top face) are subject to push attempts. The entity attempts to move one block upward and stops when it ceases to intercept the collision box; if it fails, it does not move. If it succeeds, it teleports. Note that this moves entities like [[Minecraft:cushion]]s, which normally don't move.
|-
 
! Attribute
'''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})'''
! Items
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}}
! colspan="2"|Value
 
|-
Passes if the player is targeting an end portal frame, even if filled.
|rowspan="4"| appliesTo
 
|rowspan=2 | Armor Trim
Then [[#use(...)|starts using the item]], and tries to find a structure in {{Tag link|structure|eye_of_ender_located}}, using the same method used in {{cmd|/locate structure #eye_of_ender_located}}. The found structure is not necessarily the closest<ref>{{Bug|MC-138887}}</ref>. The search process occurs in the following steps.
|[[Minecraft:Text component format]]
 
|{{cd|{"translate":"item.minecraft.smithing_template.armor_trim.applies_to",color:"blue"&#125;}}  
# If the tag is empty, the [[Minecraft:debug flag]] {{cd|DISABLE_FEATURES}} is enable, or [[Minecraft:Create New World#Game|world option]] Generate Structures is false, return null
|-
# List all [[Minecraft:structure    set]]s that have at least one structure in the tag, prioritizing structures in tag order. If the list is empty, return null.
|Text in {{mono|en_us}} || "Armor" ({{color|Blue}})
# For all {{cd|concentric_rings}} type structure sets, search for all [[Minecraft:chunk]]s where the set of structures can be positioned and check if any exist. If found a structure that is in the tag, consider it as block position {{cd|(chunkX+8, 32, chunkZ+8)}}. Save the block position in {{cd|''nearest''}} and in {{cd|''d''}} the [[Minecraft:euclidian  distance]] from the player's block to that position, if it is the first structure found or if the distance is less than or equal to the previous {{cd|''d''}}.
|-
# For all {{cd|random_spread}} type structure sets, search for structures in a 201×201 grid of ''N×N'' chunks, where ''N'' is the {{nbt|int|spacing}} of the structure set. For each region, a structure is searched for up to one structure.
|rowspan=2 | Netherite Upgrade
#* First, search in regions closest to the center, with a [[Minecraft:manhattan distance]] (radius varying from 0 to 100). For regions with the same manhattan distance, prioritize those with the smallest X-axis; for regions with the same X-axis, prioritize those with the smallest Z-axis.
| Text component format||{{cd|{"translate":"item.minecraft.smithing_template.netherite_upgrade.applies_to",color:"blue"&#125;}}  
#* Upon finding a structure (that is in the tag) with a certain radius, no further searches are made for structures with larger radius, from ''any'' structure set. This can lead to premature searches when finding a structure with a large spacing.
|-
#* Upon finding a structure (that is in the tag) with a certain radius, no further searches are made for structures from the same structure set. This creates priority for structures with smaller X or Z axes, even if they are further away from other structures in the same structure set.
|Text in {{mono|en_us}} || "Diamond Equipment" ({{color|Blue}})
#* Each structure found saves its position depending on its chunk position and the {{nbt|list|locate_offset}} of the structure set. If the player's block position distance is less than or equal to {{cd|''d''}}, update {{cd|''d''}} and {{cd|''nearest''}}.  
|-
# Retunr {{cd|''nearest''}} (null if none is found).
|rowspan="4"| ingredients
 
|rowspan=2 | Armor Trim
The interaction ends and returns to consume if nothing is found.
|Text component format||{{cd|{"translate":"item.minecraft.smithing_template.armor_trim.ingredients",color:"blue"&#125;}}  
 
|-
If one is found, a {{cd|projectile_shoot}} [[Minecraft:game event]] is produced, and an [[Minecraft:Eye of Ender#Entity data|eye of ender projectile]] is created with:
|Text in {{mono|en_us}} || "Ingots & Crystals" ({{color|Blue}})
<div class="treeview">
|-
* {{nbt|compound}} Entity data
|rowspan=2 | Netherite Upgrade
** {{Nbt|string|id}}: {{cd|minecraft:eye_of_ender}}
| Text component format||{{cd|{"translate":"item.minecraft.smithing_template.netherite_upgrade.ingredients",color:"blue"&#125;}}  
** {{Nbt|list|Pos}}: The center of the player's bounding box.
|-
** {{Nbt|compound|Item}}: The item stack with the count set to 1.
|Text in {{mono|en_us}} || "Netherite Ingot" ({{color|Blue}})
</div>
|-
The ender eye is set to target to the structure, but this is not serialized as NBT data<ref>{{Bug|MC-172738}}</ref>. They are saved in three local variables, all of which are reset when the entity is reloaded:
|rowspan="4"| baseSlotDescription
 
|rowspan=2 | Armor Trim
* {{nbt|list|target}}: It may not exist. If this exists, each tick changes the {{nbt|list|Motion}} of the ender eye as it approaches that position. Defined as {{cd|(dx, dy, dz)}} if {{cd|h {{=}} (dx^2 + dz^2) ≥ 12}} or {{cd|(dx/h, dy, dz/h)}} otherwise, where {{cd|dx|dy|d=and|dz}} are the distance from the corner of the block position {{cd|''nearest''}} minus the initial position of the ender eye. Set to null on reload.
|Text component format||{{cd|{"translate":"item.minecraft.smithing_template.armor_trim.base_slot_description"&#125;}}  
* {{nbt|int|live}}: Each tick increases by one; if it exceeds 80, it emits the {{cd|entity.ender_eye.death}} sound event (volume 1, pitch 1) and the eye is destroyed. Set to 0. Set to 0 on reload.
|-
* {{nbt|bool|surviveAfterDeath}}:  Defines what happens after the eye is destroyed, in the entity's position. If true, it summons an item entity with the same ID as the {{nbt|compound|Item}}; the components are ''not'' preserved. If false, causes [[Minecraft:Java_Edition_protocol/Packets#World_Event|world event]] 2003. {{Tooltip|Randomly|nextInt(5) &gt; 0}} defined with an 80% chance of being {{cd|true}}. Set to {{cd|false}} on reload.
|Text in {{mono|en_us}} || "Add a piece of armor" ({{color|White}})
 
|-
Finally, trigger the advancement trigger [[Minecraft:Advancement_definition#minecraft:used_ender_eye|{{cd| used_ender_eye}}]], with a distance is calculated by {{cd|xd^2 + zd^2}}, where {{cd|xd|d=and|zd}} are the distance from the player and {{cd|''nearest''}}, the {{cd|entity.ender_eye.launch}} sound event is played at a {{Tooltip|random|0.33+nextFloat()*(0.5-0.33)}} pitch between 0.33 and 0.5, an item is consumed, and [[Minecraft:statistics]] ({{cd|used:ender_eye}}) are awarded. Return success_server.
|rowspan=2 | Netherite Upgrade
{{-}}
| Text component format||{{cd|{"translate":"item.minecraft.smithing_template.netherite_upgrade.base_slot_description"&#125;}}  
 
|-
=== EnderpearlItem ===
|Text in {{mono|en_us}} || "Add diamond armor, weapon, or tool" ({{color|White}})
{{Infobox hardcoded item property|class=EnderpearlItem|Ender Pearl}}
|-
 
|rowspan="4"| additionsSlotDescription
'''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})'''
|rowspan=2 | Armor Trim
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]] }}
|Text component format||{{cd|{"translate":"item.minecraft.smithing_template.armor_trim.additions_slot_description"&#125;}}  
 
|-
Always succeeds. Plays the {{cd|entity.ender_pearl.throw}} sound effect, consumes an item, awards statistics, and spawns an [[Minecraft:Ender_Pearl#Entity_data|ender pearl projectile]] with:
|Text in {{mono|en_us}} || "Add ingot or crystal" ({{color|White}})
{{-}}
|-
<div class="treeview">
|rowspan=2 | Netherite Upgrade
* {{nbt|compound}} Entity data
| Text component format||{{cd|{"translate":"item.minecraft.smithing_template.netherite_upgrade.additions_slot_description"&#125;}}
** {{Nbt|string|id}}: {{cd|minecraft:ender_pearl}}
|-
** {{nbt|list|Pos}}:
|Text in {{mono|en_us}} || "Add Netherite Ingot" ({{color|White}})
*** {{nbt|double}}: Owner's X coordinate.
|-
*** {{nbt|double}}: Owner's eye Y coordinate minus {{cd|0.1}}.
|rowspan="4"| baseSlotEmptyIcons
*** {{nbt|double}}: Owner's Z coordinate.
|rowspan=2 | Armor Trim
** {{nbt|list|Motion}}: It depends on the owner's rotation (<math>xRot</math> and <math>yRot</math>):
|Asset ID||
*** {{nbt|double}}: <math>\left( -\sin\left(yRot \cdot \pi/180\right) \cdot \cos\left(xRot \cdot \pi/180\right) + 0.0172275 \cdot \left(\text{nextDouble}() - \text{nextDouble}()\right) \right) \cdot 1.5</math>
{{Flatlist|
*** {{nbt|double}}: <math>\left( -\sin\left(xRot \cdot \pi/180\right) + 0.0172275 \cdot \left(\text{nextDouble}() - \text{nextDouble}()\right) \right) \cdot 1.5</math>
* {{mono|container/slot/helmet}}
*** {{nbt|double}}: <math> \left( \cos\left(yRot \cdot {\pi}/{180}\right) \cdot \cos\left(xRot \cdot \pi/180\right) + 0.0172275 \cdot \left(\text{nextDouble}() - \text{nextDouble}()\right) \right) \cdot 1.5</math>
* {{mono|container/slot/chestplate}}
** {{nbt|list|Rotation}}: It depends on the {{nbt|list|Motion}} (<math>xMot</math>, <math>yMot</math>, <math>zMot</math>):
* {{mono|container/slot/leggings}}
*** {{nbt|float}}: <math>\operatorname{atan2}\left(yMot, \, (xMot)^2 + (zMoy)^2\right) \cdot 57.2957763671875</math>
* {{mono|container/slot/boots}}
*** {{nbt|float}}: <math>\operatorname{atan2}\left(xMot, \, zMot\right) \cdot 57.2957763671875</math>
}}
** {{Nbt|compound|Item}}: a copy of the item stack with the count set to 1.
|-
** {{nbt|int array|Owner}}: The ''player'' [[Minecraft:UUID]].
|Textures ||
** {{nbt||''<any tag''>}}: NBT ags that vary by [[Minecraft:Enchantment_definition#Entity_effects|entity effect]] according to enchantments with the {{cd|projectile_spawned}} [[Minecraft:Enchantment_definition#Components_with_entity_effects|effect component]] on the {{DCL|enchantments}} item component. It is calculated last. Such effects have an eventual scope beyond the tags.
{{Flatlist|
</div>
* [[File:Slot helmet.png|40px|class=pixel-image]]
The projectile is fired with an uncertainty of 1 and a power of 1.5, defined the motion and rotation (see above).
* [[File:Slot chestplate.png|40px|class=pixel-image]]
 
* [[File:Slot leggings.png|40px|class=pixel-image]]
 
* [[File:Slot boots.png|40px|class=pixel-image]]
{{-}}
}}
 
|-
=== ExperienceBottleItem ===
|rowspan=2 | Netherite Upgrade
{{Infobox hardcoded item property|class=ExperienceBottleItem|Bottle o' Enchanting}}
| Asset ID||{{Flatlist|
 
* {{mono|container/slot/helmet}}
'''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})'''
* {{mono|container/slot/sword}}
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}}
* {{mono|container/slot/chestplate}}
 
* {{mono|container/slot/pickaxe}}
Always succeeds. Plays the {{cd|entity.experience_bottle.throw}} sound effect, consumes an item, awards statistics, and spawns an [[Minecraft:Bottle_o'_Enchanting#Entity_data|experience bottle projectile]] with:
* {{mono|container/slot/leggings}}
<div class="treeview">
* {{mono|container/slot/axe}}
* {{nbt|compound}} Entity data
* {{mono|container/slot/boots}}
** {{Nbt|string|id}}: {{cd|minecraft:experience_bottle}}
* {{mono|container/slot/hoe}}
** {{nbt|list|Pos}}:
* {{mono|container/slot/shovel}}
*** {{nbt|double}}: Owner's X coordinate.
* {{mono|container/slot/nautilus_armor}}
*** {{nbt|double}}: Owner's eye Y coordinate minus {{cd|0.1}}.
* {{mono|container/slot/spear}}
*** {{nbt|double}}: Owner's Z coordinate.
}}
** {{Nbt|compound|Item}}: a copy of the item stack with the count set to 1.
|-
** {{nbt|int array|Owner}}: The ''player'' [[Minecraft:UUID]].
|Textures || {{Flatlist|
</div>
* [[File:Slot helmet.png|40px|class=pixel-image]]
The projectile is fired with an uncertainty of 1, a power of 0.7, and a pitch offset of -20°.
* [[File:Slot sword.png|40px|class=pixel-image]]
 
* [[File:Slot chestplate.png|40px|class=pixel-image]]
'''asProjectile({{Tooltip|...|Level level, Position position, ItemStack itemStack, Direction direction}})'''
* [[File:Slot pickaxe.png|40px|class=pixel-image]]
{{hatnote|Overrides method in {{cd|{{jicp|Projectile}}}}}}
* [[File:Slot leggings.png|40px|class=pixel-image]]
 
* [[File:Slot axe.png|40px|class=pixel-image]]
Used by [[Minecraft:dispenser]]s and [[Minecraft:ominous item spawner]]s.
* [[File:Slot boots.png|40px|class=pixel-image]] 
Creates an experience bottle projectile with:
* [[File:Slot hoe.png|40px|class=pixel-image]]
<div class="treeview">
* [[File:Slot shovel.png|40px|class=pixel-image]]
* {{nbt|compound}} Entity data
* [[File:Slot nautilus_armor.png|40px|class=pixel-image]]
** {{Nbt|string|id}}: {{cd|minecraft:experience_bottle}}
* [[File:Slot spear.png|40px|class=pixel-image]]
** {{nbt|list|Pos}}: The ''position''.
}}
** {{Nbt|compound|Item}}: a copy of the item stack with the count set to 1.
|-
</div>
|rowspan="4"| additionalSlotEmptyIcons
No item components are used.
|rowspan=2 | Armor Trim
 
|Asset ID||{{Flatlist|
'''createDispenseConfig()'''
* {{mono|container/slot/ingot}}
{{hatnote|Overrides method in {{cd|{{jicp|Projectile}}}}}}
* {{mono|container/slot/redstone_dust}}
 
* {{mono|container/slot/lapis_lazuli}}
Sets the projectile to be dispensed at 0.5 times the default uncertainty and 1.25 times the default power.
* {{mono|container/slot/quartz}}
 
* {{mono|container/slot/diamond}}
See [[Minecraft:Projectile#Shot from dispenser]] for these values.
* {{mono|container/slot/esmerald}}
 
}}
{{-}}
|-
 
|Textures||{{Flatlist|
=== FireChargeItem ===
* [[File:Slot ingot.png|40px|class=pixel-image]]
{{Infobox hardcoded item property|class=FireChargeItem|Fire Charge}}
* [[File:Slot redstone dust.png|40px|class=pixel-image]]
 
* [[File:Slot lapis lazuli.png|40px|class=pixel-image]]
'''useOn({{Tooltip|...|UseOnContext context}})'''
** {{Tooltip|[[File:Slot lapis lazuli Programmer.png|40px|class=pixel-image]]|Programmer art texture}}
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]] }}
* [[File:Slot quartz.png|40px|class=pixel-image]]
 
* [[File:Slot diamond.png|40px|class=pixel-image]]
First checks if the targeted block is an unlit [[Minecraft:campfire]], [[Minecraft:soul campfire]], [[Minecraft:candle]], dyed candle, [[Minecraft:cake with candle]], or cake with dyed candle. If so, its {{cd|lit}} state is set to {{cd|true}}, the {{cd|item.firecharge.use}} sound effect is played, a {{cd|block_change}} [[Minecraft:game event]] is produced.
* [[File:Slot emerald.png|40px|class=pixel-image]] 
 
}}
If not, checks if a [[Minecraft:fire]] block can be placed adjacent to the clicked face, and if so places the fire block, emits the sound effect, produces a {{cd|block_place}} game event.
|-
 
|rowspan=2 | Netherite Upgrade
If either case succeeded, the stack is shrunk by 1 and the interaction succeeds. Otherwise the interaction fails.
| Asset ID||{{Flatlist|
 
* {{mono|container/slot/ingot}}
'''asProjectile({{Tooltip|...|Level level, Position position, ItemStack itemStack, Direction direction}})'''
}}
{{hatnote|Overrides method in {{cd|{{jicp|Projectile}}}}}}
|-
 
|Textures || {{Flatlist|
Used by [[Minecraft:dispenser]]s and [[Minecraft:ominous item spawner]]s. Randomizes the ''direction'' slightly and creates a [[Minecraft:Small_Fireball#Entity_data|small fireball projectile]] with:
* [[File:Slot ingot.png|40px|class=pixel-image]]
<div class="treeview">
}}
* {{nbt|compound}} Entity data
|}
** {{Nbt|string|id}}: {{cd|minecraft:small_fireball}}
** {{Nbt|list|Pos}}: The ''position''.
** {{Nbt|list|Motion}}: The randomized ''direction''. Each axis receives the value -1, 0, or 1 (depending on the ''direction'') plus a random number {{cd|(nextDouble()−nextDouble())×0.11485000000000001}}. Each axis has the random number calculated separately. After that, the vector is [[Minecraft:w:Unit vector|normalized]] and mutilates by 0.1.{{More info|Is this ever used? The position and movement of the projectiles from this method are later recalculated (by DispenseConfig).}}
** {{Nbt|compound|Item}}: A copy of the item stack with the count set to 1.
</div>
 
'''shoot({{Tooltip|...|Projectile projectile, double xd, double yd, double zd, float pow, float uncertainty}})'''
{{hatnote|Overrides method in {{cd|{{jicp|Projectile}}}}}}
 
Overridden to do nothing, since {{Nbt|list|Motion}} is set by {{cd|asProjectile}} instead.
 
'''createDispenseConfig()'''
{{hatnote|Overrides method in {{cd|{{jicp|Projectile}}}}}}
 
Sets the projectile to be dispensed fully outside the dispenser, with an uncertainty of 6.6666665, a power of 1, and a [[Minecraft:Java_Edition_protocol/Packets#World_Event|world event]] override of 1018.
 
{{-}}
 
=== FireworkRocketItem ===
{{Infobox hardcoded item property|class=FireworkRocketItem|Firework Rocket}}
 
'''useOn({{Tooltip|...|UseOnContext context}})'''
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]]}}
 
Passes if not used by a gliding player. Otherwise succeeds, shrinking the stack by 1 and spawning a [[Minecraft:Firework_Rocket#Entity_data|firework rocket projectile]] with:
<div class="treeview">
* {{nbt|compound}} Entity data
** {{Nbt|string|id}}: {{cd|minecraft:firework_rocket}}
** {{Nbt|list|Pos}}: The clicked location, offset away from the block by 0.15 blocks.
** {{Nbt|compound|FireworksItem}}: A copy of the item stack.
** {{Nbt|int|Life}}: 0
** {{Nbt|int|LifeTime}}: The firework lifetime depending on its {{DCL|fireworks}} component: 10 * {{cd|flight_duration}} (or 0 if there is no {{DCL|fireworks}} component) + random(0 to 5) + random(0 to 6)
** {{nbt|int array|Owner}}: The player [[Minecraft:UUID]].
</div>
 
'''use({{Tooltip|...|Level level, Player player, InteractionHand}})'''
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}}
 
Passes unless the player is gliding. Otherwise succeeds, breaking all [[Minecraft:lead]]s attached to the player (and playing {{cd|item.lead.break}} if there were any), consuming one item, awarding statistics, and spawning a firework rocket projectile stuck to the player (which is not serialized as NBT data) with:
<div class="treeview">
* {{nbt|compound}} Entity data
** {{Nbt|string|id}}: {{cd|minecraft:firework_rocket}}
** {{Nbt|list|Pos}}: The player's position.
** {{Nbt|compound|FireworksItem}}: A copy of the item stack.
** {{Nbt|int|Life}}: 0
** {{Nbt|int|LifeTime}}: The firework lifetime, same formula as above.
** {{nbt|int array|Owner}}: The ''player'' [[Minecraft:UUID]].
</div>
 
'''asProjectile({{Tooltip|...|Level level, Position position, ItemStack itemStack, Direction direction}})'''
{{hatnote|Overrides method in {{cd|{{jicp|Projectile}}}}}}
 
Creates a firework rocket projectile with:
<div class="treeview">
* {{nbt|compound}} Entity data
** {{Nbt|string|id}}: {{cd|minecraft:firework_rocket}}
** {{Nbt|list|Pos}}: The ''position''.
** {{Nbt|compound|FireworksItem}}: A copy of the item stack with the count set to 1.
** {{Nbt|int|Life}}: 0
** {{Nbt|int|LifeTime}}: The firework lifetime, same formula as above.
** {{Nbt|boolean|ShotAtAngle}}: {{cd|true}}
</div>
 
'''createDispenseConfig()'''
{{hatnote|Overrides method in {{cd|{{jicp|Projectile}}}}}}
 
Sets the projectile to be dispensed 0.50001 blocks away from the center of the dispenser, with an uncertainty of 1, a power of 0.5, and a [[Minecraft:Java_Edition_protocol/Packets#World_Event|world event]] override of 1004.
 
{{-}}
 
=== FishingRodItem ===
{{Infobox hardcoded item property|class=FishingRodItem|Fishing Rod}}
 
'''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})'''
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}}
 
Always succeeds.
 
If the player does not already have a fishing hook attached:
* The {{cd|entity.fishing_bobber.throw}} sound effect is played.
* The {{cd|fishing_time_reduction}} and {{cd|fishing_luck_bonus}} [[Minecraft:Enchantment_definition#Components with value effects|effect components]] are applied from enchantments on the item stack, they define local fishing bobber variables without saving them in the NBT tag:
** {{nbt|int|luck}}: Used in the [[Minecraft:loot context]] of the fishing loot table, {{cd|LootContext.luck {{=}} this.luck + owner.[[Minecraft:Attribute#Luck|getLuck()]]}}. Defined by the maximum between 0 and the value given by {{cd|fishing_luck_bonus}}.
** {{nbt|int|lureSpeed}}: How much is '''timeUntilLured''' reduced after being defined as a random number between 100 and 600 (both inclusive). Defined as a maximum between 0 and 20 times the value given by {{cd|fishing_time_reduction}}.
* A [[Minecraft:fishing bobber]] is spawned with the fishing time reduction and luck bonus (which are not serialized) and with:
<div class="treeview">
:* {{nbt|compound}} Entity data
:** {{Nbt|string|id}}: {{cd|minecraft:fishing_bobber}}
:** {{Nbt|int-array|Owner}}: The ''player'' UUID.
:** {{Nbt|list|Pos}}: The player's eye position, offset by 0.3 blocks in the XZ plane in the direction of their Y rotation.
:** {{Nbt|list|Motion}}: The vector pointing away from the player in the XZ plane, with a Y motion of <math>clamp(-\tan(-xRotation), -5, 5)</math>, normalized with a length of 0.6, and then offset on each axis by random numbers in a triangular distribution around 0.5 with a spread of 0.0103365.
:** {{Nbt|list|Rotation}}:
:*** {{Nbt|float}} <math>atan2(Motion.x, Motion.z)</math> to degrees
:*** {{Nbt|float}} <math>atan2(Motion.y, length(Motion.xz))</math> to degrees
:** {{nbt||''<any tag''>}}: NBT ags that vary by [[Minecraft:Enchantment_definition#Entity_effects|entity effect]] according to enchantments with the {{cd|projectile_spawned}} [[Minecraft:Enchantment_definition#Components_with_entity_effects|effect component]] on the {{DCL|enchantments}} item component. It is calculated last. Such effects have an eventual scope beyond the tags.
</div>
* The item used statistic is awarded.
* An {{cd|item_interact_start}} [[Minecraft:game event]] is produced.
 
If the player ''does'' already have a fishing hook attached:
* The fishing bobber is retrieved.
* The item stack is damaged by one of these criteria:
** 3 if an item stack was hooked.
** 5 if another entity was hooked.
** 1 if the bobber got a bite fishing, which then rolls the {{cd|gameplay/fishing}} loot table and creates the resulting item.
** 2 if the bobber was on the ground.
** 0 by default.
* The {{cd|entity.fishing_bobber.retrieve}} sound effect is played.
* An {{cd|item_interact_finish}} game event is produced.
 
{{-}}
 
=== FlintAndSteelItem ===
{{Infobox hardcoded item property|class=FlintAndSteelItem|Flint and Steel}}
 
'''useOn({{Tooltip|...|UseOnContext context}})'''
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]] }}
 
First checks if the targeted block is an unlit [[Minecraft:campfire]], [[Minecraft:soul campfire]], [[Minecraft:candle]], dyed candle, [[Minecraft:cake with candle]], or cake with dyed candle. If so, its {{cd|lit}} state is set to {{cd|true}}, the {{cd|item.flintandsteel.use}} sound effect is played, a {{cd|block_change}} [[Minecraft:game event]] is produced, the item stack is damaged by 1, and the interaction succeeds.
 
If not, checks if a [[Minecraft:fire]] block can be placed adjacent to the clicked face, and if so places the fire block, emits the sound effect, produces a {{cd|block_place}} game event, triggers the {{cd|minecraft:placed_block}} advancement trigger, damages the item by 1, and succeeds.
 
If the fire block cannot be placed the interaction fails.
 
{{-}}
 
=== FoodOnAStickItem ===
{{Infobox hardcoded item property|class=FoodOnAStickItem|Carrot on a Stick|Warped Fungus on a Stick}}
 
Each FoodOnAStickItem has an interactable entity type and an amount to damage the item when used, set for each item ID:
* [[Minecraft:Carrot on a Stick]] can interact with [[Minecraft:pig]]s and is damaged by 7 when used.
* [[Minecraft:Warped Fungus on a Stick]] can interact with [[Minecraft:strider]]s and is damaged by 1 when used.
 
'''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})'''
{{hatnote|Overrides a method in [[#use(...)|{{jicp|}}]]}}
 
If the player is riding an entity that is {{cd|{{jcp|net.minecraft.world.entity.ItemSteerable}}}} and that is the entity type set for this item, the entity is boosted, the item is damaged by the amount set for this item, and if it breaks it is converted to {{cd|minecraft:fishing_rod}} (with all components copied, count set to 1, and damage set to 0). The interaction succeeds.
 
If those conditions are not met, the item used statistic is awarded and the interaction passes.
 
=== GameMasterBlockItem ===
{{Infobox hardcoded item property|class=GameMasterBlockItem|Items={{Flatlist|
*{{BlockLink|Command Block}}
*{{BlockLink|Repeating Command Block}}
*{{BlockLink|Chain Command Block}}
*{{BlockLink|Structure Block}}
*{{BlockLink|Jigsaw Block}}
*{{BlockLink|Test Block}}
*{{BlockLink|Test Instance Block}}
}}|ext={{Slink||BlockItem}}}}
 
'''getPlacementState({{Tooltip|...|BlockPlaceContext context}})'''
{{hatnote|Overrides method in [[#BlockItem|{{jicp|Block}}]]}}
 
Overridden to null if placed by a player that cannot use game master blocks (i.e. is not in Creative mode), making place interactions fail.
 
{{-}}
 
=== GlowInkSacItem ===
{{Infobox hardcoded item property|class=GlowInkSacItem|Glow Ink Sac|impts={{cd|SignApplicator}}}}
 
'''tryApplyToSign({{tooltip|...|Level level, SignBlockEntity sign, boolean isFrontText, Player player}})'''
{{hatnote|Overrides method in {{cd|SignApplicator}}}}
 
Try changing {{cd|has_glowing_text}} on the [[Minecraft:sign]]'s front or back text (depending on ''isFrontText'') to {{cd|true}}.
 
If successful, the {{cd|item.glow_ink_sac.use}} sound effect is played and returns {{cd|true}}. Otherwise (if the text was already glowing) returns {{cd|false}}.


Asset ID refers to textures file path in {{mono|/assets/minecraft/textures/gui/sprites/}}.
{{-}}


==== Append hover text ====
=== HangingEntityItem ===
{{empty section}}
=== HangingSignItem ===
{{empty section}}
=== HoneycombItem ===
{{empty section}}
=== InkSacItem ===
{{info needed section|is this just used for signs, or are there other use cases?}}


'''public void appendHoverText({{Tooltip|...|ItemStack itemStack, Item.TooltipContext context, TooltipDisplay display, Consumer&lt;Component&gt; builder, TooltipFlag tooltipFlag}})'''
=== InstrumentItem ===
{{hatnote|Overrides method in [[#appendHoverText(...)|{{jicp|}}]]}}
{{empty section}}
 
=== ItemFrameItem ===
Add the following lines to the beginning of the item's tooltip, in order:
{{empty section}}
* "Smithing Template" ({{Color|Gray}})
=== KnowledgeBookItem ===
** {{cd|{"translate":"item.minecraft.smithing_template",color:"gray"&#125;}}  
{{empty section}}
* Empty line
=== LeadItem ===
** {{cd|{"text":""&#125;}}  
{{empty section}}
* "Applies to:" ({{Color|Gray}})
=== LingeringPotionItem ===
** {{cd|{"translate":"item.minecraft.smithing_template.applies_to",color:"gray"&#125;}}  
{{empty section}}
* Space append to {{cd|''appliesTo''}}
=== MaceItem ===
** {{cd|[{"text":" "&#125;,''appliesTo'']}}
{{empty section}}
* "Ingredients:" ({{Color|Gray}})
=== MapItem ===
** {{cd|{"translate":"item.minecraft.smithing_template.ingredients",color:"gray"&#125;}}
{{empty section}}
* Space append to {{cd|''ingredients''}}
=== MinecartItem ===
** {{cd|[{"text":" "&#125;,''ingredients'']}}
{{empty section}}
=== MobBucketItem ===
{{empty section}}
=== NameTagItem ===
{{Infobox hardcoded item property|class=NameTagItem|Name Tag}}


==== Smithing table screen ====
'''interactLivingEntity({{tooltip|...|ItemStack itemStack, Player player, LivingEntity target, InteractionHand type}})'''
{{hatnote|Overrides method in [[#interactLivingEntity(...)|{{jicp|}}]]}}


There are 4 methods that always give the assigned values ​​of the sprint items, namely {{cd|getBaseSlotDescription()}}, {{cd|getAdditionSlotDescription()}}, {{cd|getBaseSlotEmptyIcons()}}, and {{cd|getAdditionalSlotEmptyIcons()}}. All of them are used only in the {{jcp|net.minecraft.client.gui.screens.inventory.SmithingScreen}} class. This class defines the behavior of the menu slots in the [[Minecraft:smithing table]], controlling both the sprint that appears in empty slots and the tooltip when hovering the mouse over an empty slot. Furthermore, this class uses two instanceof of SmithingTemplateItem (and in no other class of the code is it used instanceof of SmithingTemplateItem).
The interaction will only be successful, instead of pass, when:
* the item has a {{DCL|custom_name}} component, and
* the entity isn't a [[Minecraft:player]], [[Minecraft:leash knot]], [[Minecraft:lightning bolt]], or [[Minecraft:fishing bobber]].


'''Slot background'''
If the entity is alive, sets its {{cd|CustomName}} to be the same as the name tag. If the entity is a mob, also sets {{cd|PersistenceRequired}} true. Shrink the item stack of the item by one.


Slots 0, 1, and 2 of the menu use a rendering of their variable background given by a list of identifiers (asset IDs), defined by the class {{jcp|net.minecraft.client.gui.screens.inventory.CyclingSlotBackground}}. With each tick update:
Note: This method is only called for living entities, so it ends up being a redundant under certain conditions. Even though the ender dragon is a living entity, this method is never called by it because when trying to interact with it, the {{cd|EnderDragonPart}} is actually being interacted, which is not a living entity.
* If the icons list is different from the old icons list, update the icons list and reset the index of the list to zero.
* If the current list is not empty:
**Increase the tick count by one.
** If the tick count is a multiple of 30, increase the index of the identifier by one; return to zero if it exceeds the limit of the list.


And when render the slot background:
=== PlaceOnWaterBlockItem ===
* If the list is empty or the slot is not empty: do nothing.
{{info needed section|Presumably concerns lily pads and frogspawn, but what about spawn eggs and boats?}}
* If the tick count is greater than 30 and fewer than t + a < 4.0, where t is how many ticks have passed the last multiple of 30: render the previous icon (one index lower or the last one in the list if the index is zero) with {{cd|1–(t+a)/4.0}} transparency.{{More info|What is this a?}}
* Renderize the current index with {{cd|(t+a)/4.0}} of transparency.


Note that in this way each icon occupies the slot for 30 ticks and has a smooth transition of 4 ticks.
=== PlayerHeadItem ===
{{info needed section|Is this why {{bug|MC-166998}}/{{bug|MC-301817}} exist (aka heads using hardcoded rendering rather than either rendering an item model or equipment definition), or does that belong somewhere else?}}


In {{jcp|net.minecraft.client.gui.screens.inventory.SmithingScreen}}, each tick updates the tick of {{jcp|net.minecraft.client.gui.screens.inventory.CyclingSlotBackground}}, from slots 0, 1, and 2, with a list that may vary:
=== PotionItem ===


* For slot 0, a list of two elements is always used; these are: {{mono|container/slot/smithing_template_armor_trim}} and {{mono|container/slot/smithing_template_netherite_upgrade}}.
{{Infobox hardcoded item property|class=PotionItem|Potion|Splash Potion|Lingering Potion|impns=
** {{Flatlist|
* {{cd|SplashPotionItem}}
*** [[File:Slot smithing template armor trim.png|40px|class=pixel-image]]
* {{cd|ThrowablePotionItem}}
*** [[File:Slot smithing template netherite upgrade.png|40px|class=pixel-image]]
* {{cd|LingeringPotionItem}}
}}
}}
* For slot 1, if there is no instance of SmithingTemplateItem in slot 0, the list is empty. If there is, it is the {{cd|baseSlotEmptyIcons}} of the item.
* For slot 2, if there is no instance of SmithingTemplateItem in slot 0, the list is empty. If there is, it is the {{cd|additionalSlotEmptyIcons}} of the item.


'''Boarding Tooltips'''
'''useOn({{tooltip|...|UseOnContext context}})'''
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]]}}


Depending on the mouse position, among other factors, the switcher table menu renders a tooltip.
The interaction will only be successful, instead of pass, when:
* the face of the interacted block was not directed downward,
* the block is in the [[Minecraft:Block_tag_(Java_Edition)#convertable_to_mud|#convertable_to_mud]] tag, and
* the potion's content is water.


* Mouse over a rectangular area around the arrow: if the recipe has an error (has items in slots 0, 1, and 3 but no result): "Item can't be upgraded this way" ({{color|White}})
In case of success, apply in the following order:
** {{cd|{"translate":"container.upgrade.error_tooltip"&#125;}}
# Play the generic splash [[Minecraft:sound event]] ({{cd|''entity.generic.splash''}}),
** When there is a recipe error, it also renders a red X above the arrow:
# Set [[Minecraft:glass bottle]] in hand,
*** [[File:GUI_error.png|28px]] {{mono|container/smithing/error}}
# Send splash [[Minecraft:Particles_(Java_Edition)|particles]],
* If the mouse is in slot 0 and it is empty: "Add Smithing Template" ({{color|White}})
# Play the bottle empty sound event ({{cd|''item.bottle.empty''}}), 
** {{cd|{"translate":"container.upgrade.missing_template_tooltip"&#125;}}
# Produce the [[Minecraft:game event]] {{cd|fluid_place}},
* If the mouse is in slot 1, it is not empty, and slot 0 has an instance of SmithingTemplateItem: the {{cd|''baseSlotDescription''}} from item in slot 0.
# Convert the block to [[Minecraft:mud]].
* If the mouse is in slot 2, it is not empty, and slot 0 has an instance of SmithingTemplateItem: the {{cd|''additionsSlotDescription''}} from item in slot 0.
 
* In any other case: it does not render a menu tooltip (although it continues to render item tooltips normally).
'''getName({{tooltip|...|ItemStack itemStack}})'''
{{hatnote|Overrides method in [[#getName(...)|{{jicp|}}]]}}
 
If the item has the component {{cd|[[Minecraft:potion_contents]]}}, the name name is defined from it. The item uses the translation key {{cd|''item.minecraft.<item type>.effect.<potion name>''}}, where {{cd|''<potion name>''}} is the custom name of the potion contents, if available, and otherwise is the name of the potion in potion contents (see {{slink|Potion|Item data}}), if available. If nether is available, is "{{cd|empty}}". 
 
This name will replace the name defined by {{DCL|item_name}}. However, it can still be replaced by the {{DCL|custom_name}}, if available.


=== SnowballItem ===
=== ProjectileWeaponItem ===
{{empty section}}
{{empty section}}
=== SolidBucketItem ===
=== ScaffoldingBlockItem ===
{{empty section}}
{{empty section}}
=== SpawnEggItem ===
=== ShearsItem ===
{{empty section}}
{{info needed section|shears do a handful of things to blocks you may expect the new block transformer component to do: setting kelp and vines to age 25, harvesting bee nests and beehives and setting their fullness to 0, and carving pumpkins to transform them from normal pumpkins to carved pumpkins. there's also the many entity interactions that exist nowadays}}
=== SpectralArrowItem ===
 
{{empty section}}
=== ShieldItem ===
=== SplashPotionItem ===
 
{{empty section}}
{{Infobox hardcoded item property|class=ShieldItem|Shield}}
=== SpyglassItem ===
 
{{empty section}}
'''getName({{tooltip|...|ItemStack itemStack}})'''
=== StandingAndWallBlockItem ===
{{hatnote|Overrides method in [[#getName(...)|{{jicp|}}]]}}
{{empty section}}
=== ThrowablePotionItem ===
{{empty section}}
=== TippedArrowItem ===
{{empty section}}
=== TridentItem ===
{{empty section}}
=== WindChargeItem ===
{{empty section}}
=== WritableBookItem ===


{{Infobox hip|class=WritableBookItem|Book and Quill}}
If the item has the component {{DCL|base_color}}, the name is defined from it. The item uses the translation key {{cd|''item.minecraft.shield.<color>''}}.


'''use({{tooltip|minetip=1|...|Level level, Player player, InteractionHand hand}})'''
This name will replace the name defined by {{DCL|item_name}} component. However, it can still be replaced by the {{DCL|custom_name}} component, if available.
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}}


Open item GUI and increases the {{cd|used}} [[Minecraft:statistic]] by one. Always returns successful.
{{-}}
=== SmithingTemplateItem ===
{{Infobox hardcoded item property|class=SmithingTemplateItem|Netherite Upgrade|Sentry Armor Trim|Vex Armor Trim|Wild Armor Trim|Coast Armor Trim|Dune Armor Trim|Wayfinder Armor Trim|Raiser Armor Trim|Shaper Armor Trim|Host Armor Trim|Ward Armor Trim|Silence Armor Trim|Tide Armor Trim|Snout Armor Trim|Rib Armor Trim|Eye Armor Trim|Spire Armor Trim|Flow Armor Trim|Bolt Armor Trim}}


Note:
==== New SmithingTemplateItem ====
Each instance of SmithingTemplateItem has a series of class-specific attributes, which are defined by {{cd|SmithingTemplateItem({{Tooltip|...|Component appliesTo, Component ingredients, Component baseSlotDescription, Component additionsSlotDescription, List&lt;Identifier&gt; baseSlotEmptyIcons, List&lt;Identifier&gt; additionalSlotEmptyIcons, Item.Properties properties}})}}. However, these attributes are not defined separately for each item; instead, they are defined by the {{cd|createNetheriteUpgradeTemplate({{Tooltip|...|Item.Properties properties}})}} and {{cd|createArmorTrimTemplate({{Tooltip|...|Item.Properties properties}})}} methods, where respectively defines the attributes of netherite upgrade and of all armor trims. In {{jicp|-s}}, only the item components are defined (by {{slink||Item.Properties}}, which in this case is only the {{DCL|rarity}} component).


The item GUI depends on the components {{DCL|writable_book_content}} and {{DCL|written_book_content}}. Therefore:
These methods use the {{cd|createTrimmableArmorIconList()}}, {{cd|createTrimmableMaterialIconList()}}, {{cd|createNetheriteUpgradeIconList()}}, and {{cd|createNetheriteUpgradeMaterialList()}} auxiliary methods, and many auxiliary constants to create these attributes. Below is the complete table of these attributes:
* If the item does not have either component: nothing is opened, but there is still an increase in statistics and usage animation.
* If the item has only one of these components: the corresponding GUI opens.
* If both components are present: both GUIs open, but the written book content GUI completely overlays the writable book content GUI, which the player can see briefly on the screen.


Therefore, the GUI are entirely dependent on the components and independent of the item ID. However, it is only possible to open them with the [[Minecraft:book and quill]] and [[Minecraft:written book]], since only these items attempt to open the GUI.
{| class="wikitable reset-wrap sortable" <!--style="text-align:center"-->
 
! Attribute
=== WrittenBookItem ===
! Items
 
! colspan="2"| Value
{{Infobox hip|class=WrittenBookItem|Written Book}}
|-
 
|rowspan="4"| appliesTo
'''use({{tooltip|minetip=1|...|Level level, Player player, InteractionHand hand}})'''
|rowspan=2 | Armor Trim
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}}
|[[Minecraft:Text component format]]
 
|{{cd|{"translate":"item.minecraft.smithing_template.armor_trim.applies_to",color:"blue"&#125;}}  
Completely identical to {{cd|WritableBookItem}}; see the {{slink||WritableBookItem}}.
|-
 
|Text in {{mono|en_us}} || "Armor" ({{color|Blue}})
 
|-
<br>
|rowspan=2 | Netherite Upgrade
 
| Text component format||{{cd|{"translate":"item.minecraft.smithing_template.netherite_upgrade.applies_to",color:"blue"&#125;}}  
== Items member access ==
|-
 
|Text in {{mono|en_us}} || "Diamond Equipment" ({{color|Blue}})
'''Blocks'''
|-
 
|rowspan="4"| ingredients
{{columns-list|
|rowspan=2 | Armor Trim
 
|Text component format||{{cd|{"translate":"item.minecraft.smithing_template.armor_trim.ingredients",color:"blue"&#125;}}  
* {{BlockLink|Cauldron-top|{{jcp|net.minecraft.core.cauldron.CauldronInteractions}}|link=#CauldronInteractions}}
|-
* {{BlockLink|Dispenser|{{jcp|net.minecraft.core.dispenser.DispenseItemBehavior}}|link=#DispenseItemBehavior}}
|Text in {{mono|en_us}} || "Ingots & Crystals" ({{color|Blue}})
* {{BlockLink|Anvil|{{jcp|net.minecraft.world.inventory.AnvilMenu}}|link=#AnvilMenu}}
|-
* [[File:SlotSprite Bottle.png|20px|link=#PotionSlot]][[#PotionSlot|{{jcp|net.minecraft.world.inventory.BrewingStandMenu.PotionSlot}}]]
|rowspan=2 | Netherite Upgrade
* {{BlockLink|Cartography Table|{{jcp|net.minecraft.world.inventory.CartographyTableMenu}}|link=#CartographyTableMenu}}
| Text component format||{{cd|{"translate":"item.minecraft.smithing_template.netherite_upgrade.ingredients",color:"blue"&#125;}}  
* {{BlockLink|Enchanting Table|{{jcp|net.minecraft.world.inventory.EnchantmentMenu}}|link=#EnchantmentMenu}}
|-
* {{BlockLink|Lit Furnace|{{jcp|net.minecraft.world.inventory.FurnaceFuelSlot}}|link=#FurnaceFuelSlot}}
|Text in {{mono|en_us}} || "Netherite Ingot" ({{color|Blue}})
* {{BlockLink|Grindstone|{{jcp|net.minecraft.world.inventory.GrindstoneMenu}}|link=#GrindstoneMenu}}
|-
* {{BlockLink|Beehive|{{jbcp|Beehive}}|link=#BeehiveBlock}}
|rowspan="4"| baseSlotDescription
* {{BlockLink|Candle Cake|{{jbcp|CandleCake}}|link=#CandleCakeBlock}}
|rowspan=2 | Armor Trim
* {{BlockLink|Chiseled BookShelf|{{jbcp|ChiseledBookShelf}}|link=#ChiseledBookShelfBlock}}
|Text component format||{{cd|{"translate":"item.minecraft.smithing_template.armor_trim.base_slot_description"&#125;}}  
* {{BlockLink|Composter|{{jbcp|Composter}}|link=#ComposterBlock}}
|-  
* {{BlockLink|Composter-bottom|{{jbcp||ComposterBlock.OutputContainer}}|link=#OutputContainer}}
|Text in {{mono|en_us}} || "Add a piece of armor" ({{color|White}})
* {{BlockLink|Light|{{jbcp|Light}}|link=#LightBlock}}
|-
* {{BlockLink|Powder Snow|{{jbcp|PowderSnow}}|link=#PowderSnowBlock}}
|rowspan=2 | Netherite Upgrade
* {{BlockLink|Pumpkin|{{jbcp|Pumpkin}}|link=#PumpkinBlock}}
| Text component format||{{cd|{"translate":"item.minecraft.smithing_template.netherite_upgrade.base_slot_description"&#125;}}  
* {{BlockLink|Respawn Anchor|{{jbcp|RespawnAnchor}}|link=#RespawnAnchorBlock}}
|-
* {{BlockLink|Sweet Berry Bush|{{jbcp|SweetBerryBush}}|link=#SweetBerryBushBlock}}
|Text in {{mono|en_us}} || "Add diamond armor, weapon, or tool" ({{color|White}})
* {{BlockLink|Tnt|{{jbcp|Tnt}}|link=#TntBlock}}
|-
* {{BlockLink|TripWire|{{jbcp|TripWire}}|link=#TripWireBlock}}
|rowspan="4"| additionsSlotDescription
* {{BlockLink|Copper Golem Statue|{{jbcp|WeatheringCopperGolemStatue}}|link=#WeatheringCopperGolemStatueBlock}}
|rowspan=2 | Armor Trim
* {{BlockLink|wither-skeleton-skull|{{jbcp|WitherSkull}}|link=#WitherSkullBlock}}
|Text component format||{{cd|{"translate":"item.minecraft.smithing_template.armor_trim.additions_slot_description"&#125;}}  
* {{BlockLink|Furnace|{{jbcp|entity|AbstractFurnaceBlockEntity}}|link=#AbstractFurnaceBlockEntity}}
|-
* {{BlockLink|Brewing Stand|{{jbcp|entity|BrewingStandBlockEntity}}|link=#BrewingStandBlockEntity}}
|Text in {{mono|en_us}} || "Add ingot or crystal" ({{color|White}})
* {{ItemLink|Pottery Sherd|{{jbcp|entity|DecoratedPotPatterns}}|link=#DecoratedPotPatterns}}
|-
* {{InvLink|Coal|{{jbcp|entity|FuelValues}}|link=#FuelValues}}
|rowspan=2 | Netherite Upgrade
* {{BlockLink|decorated-pot|{{jbcp|entity|PotDecorations}}|link=#PotDecorations}}
| Text component format||{{cd|{"translate":"item.minecraft.smithing_template.netherite_upgrade.additions_slot_description"&#125;}}  
* {{BlockLink|Vault|{{jbcp|entity.vault|VaultConfig}}|link=#VaultConfig}}
|-
|Text in {{mono|en_us}} || "Add Netherite Ingot" ({{color|White}})
|-
|rowspan="4"| baseSlotEmptyIcons
|rowspan=2 | Armor Trim
|Asset ID||  
{{Flatlist|
* {{mono|container/slot/helmet}}
* {{mono|container/slot/chestplate}}
* {{mono|container/slot/leggings}}
* {{mono|container/slot/boots}}
}}
}}
 
|-  
'''Entity'''
|Textures ||  
 
{{Flatlist|
{{columns-list|colwidth=16em|
* [[File:Slot helmet.png|40px|class=pixel-image]]
 
* [[File:Slot chestplate.png|40px|class=pixel-image]]
* {{InvLink|Golden Dandelion|{{jcp|net.minecraft.world.entity.AgeableMob}}|link=#AgeableMob}}
* [[File:Slot leggings.png|40px|class=pixel-image]]
* {{ItemLink|SHEARS|{{jcp|net.minecraft.world.entity.Entity}}|link=#Entity}}
* [[File:Slot boots.png|40px|class=pixel-image]] 
* {{ItemLink|Heads|{{jcp|net.minecraft.world.entity.LivingEntity}}|link=#LivingEntity}}
}}
* {{ItemLink|NAME TAG|{{jcp|net.minecraft.world.entity.Mob}}|link=#Mob}}
|-
* {{ItemLink|crossbow-drawn-1|{{jcp|net.minecraft.world.entity.ai.behavior.CrossbowAttack}}|link=#CrossbowAttack}}
|rowspan=2 | Netherite Upgrade
* {{EntityLink|Villager|{{jcp|net.minecraft.world.entity.ai.behavior.TradeWithVillager}}|link=#TradeWithVillager}}
| Asset ID||{{Flatlist|
* {{ItemLink|Bone meal|{{jcp|net.minecraft.world.entity.ai.behavior.UseBonemeal}}|link=#UseBonemeal}}
* {{mono|container/slot/helmet}}
* {{InvLink|Composter|{{jcp|net.minecraft.world.entity.ai.behavior.WorkAtComposter}}|link=#WorkAtComposter}}
* {{mono|container/slot/sword}}
* {{ItemLink|Bone|{{jcp|net.minecraft.world.entity.ai.goal.BegGoal}}|link=#BegGoal}}
* {{mono|container/slot/chestplate}}
* {{ItemLink|Bow-drawn-3|{{jcp|net.minecraft.world.entity.ai.goal.RangedBowAttackGoal}}|link=#BowAttackGoal}}
* {{mono|container/slot/pickaxe}}
* {{ItemLink|crossbow-drawn-3|{{jcp|net.minecraft.world.entity.ai.goal.RangedCrossbowAttackGoal}}|link=#RangedCrossbowAttackGoal}}
* {{mono|container/slot/leggings}}
* {{EntityLink|salmon|{{jcp|net.minecraft.world.entity.animal.Bucketable}}|link=#Bucketable}}
* {{mono|container/slot/axe}}
* {{EntityLink|Armadillo|{{jcp|net.minecraft.world.entity.animal.armadillo.Armadillo}}|link=#Armadillo}}
* {{mono|container/slot/boots}}
* {{EntityLink|Axolotl|{{jcp|net.minecraft.world.entity.animal.axolotl.Axolotl}}|link=#Axolotl}}
* {{mono|container/slot/hoe}}
* {{EntityLink|Camel|{{jcp|net.minecraft.world.entity.animal.camel.Camel}}|link=#Camel}}
* {{mono|container/slot/shovel}}
* {{EntityLink|Cow|{{jcp|net.minecraft.world.entity.animal.cow.AbstractCow}}|link=#AbstractCow}}
* {{mono|container/slot/nautilus_armor}}
* {{EntityLink|mooshroom|{{jcp|net.minecraft.world.entity.animal.cow.MushroomCow}}|link=#MushroomCow}}
* {{mono|container/slot/spear}}<ref>{{bug|MC-303941}}</ref>
* {{EntityLink|Mule|{{jcp|net.minecraft.world.entity.animal.equine.AbstractChestedHorse}}|link=#AbstractChestedHorse}}
}}
* {{EntityLink|Horse|{{jcp|net.minecraft.world.entity.animal.equine.AbstractHorse}}|link=#AbstractHorse}}
|-
* {{EntityLink|Horse|{{jcp|net.minecraft.world.entity.animal.equine.Horse}}|link=#Horse}}
|Textures || {{Flatlist|
* {{EntityLink|Llama|{{jcp|net.minecraft.world.entity.animal.equine.Llama}}|link=#Llama}}
* [[File:Slot helmet.png|40px|class=pixel-image]]
* {{EntityLink|Goat|{{jcp|net.minecraft.world.entity.animal.goat.Goat}}|link=#Goat}}
* [[File:Slot sword.png|40px|class=pixel-image]]
* {{EntityLink|Copper Golem|{{jcp|net.minecraft.world.entity.animal.golem.CopperGolem}}|link=#CopperGolem}}
* [[File:Slot chestplate.png|40px|class=pixel-image]]
* {{EntityLink|Iron Golem|{{jcp|net.minecraft.world.entity.animal.golem.IronGolem}}|link=#IronGolem}}
* [[File:Slot pickaxe.png|40px|class=pixel-image]]
* {{EntityLink|Snow Golem|{{jcp|net.minecraft.world.entity.animal.golem.SnowGolem}}|link=#SnowGolem}}
* [[File:Slot leggings.png|40px|class=pixel-image]]
* {{EntityLink|Panda|{{jcp|net.minecraft.world.entity.animal.panda.Panda}}|link=#Panda}}
* [[File:Slot axe.png|40px|class=pixel-image]]
* {{EntityLink|Pig|{{jcp|net.minecraft.world.entity.animal.pig.Pig}}|link=#Pig}}
* [[File:Slot boots.png|40px|class=pixel-image]] 
* {{EntityLink|Sheep|{{jcp|net.minecraft.world.entity.animal.sheep.Sheep}}|link=#Sheep}}
* [[File:Slot hoe.png|40px|class=pixel-image]]
* {{EntityLink|Wolf|{{jcp|net.minecraft.world.entity.animal.wolf.Wolf}}|link=#Wolf}}
* [[File:Slot shovel.png|40px|class=pixel-image]]
* {{EntityLink|Armor Stand|{{jcp|net.minecraft.world.entity.decoration.ArmorStand}}|link=#ArmorStand}}
* [[File:Slot nautilus_armor.png|40px|class=pixel-image]]
* {{EntityLink|leash-knot|{{jcp|net.minecraft.world.entity.decoration.LeashFenceKnotEntity}}|link=#LeashFenceKnotEntity}}
* [[File:Slot spear.png|40px|class=pixel-image]]
* {{EntityLink|Creeper|{{jcp|net.minecraft.world.entity.monster.Creeper}}|link=#Creeper}}
}}
* {{ItemLink|Crossbow|{{jcp|net.minecraft.world.entity.monster.CrossbowAttackMob}}|link=#CrossbowAttackMob}}
|-
* {{EntityLink|Strider|{{jcp|net.minecraft.world.entity.monster.Strider}}|link=#Strider}}
|rowspan="4"| additionalSlotEmptyIcons
* {{EntityLink|Illusioner| {{jcp|net.minecraft.world.entity.monster.illager.Illusioner}}|link=#Illusioner}}
|rowspan=2 | Armor Trim
* {{EntityLink|Pillager|{{jcp|net.minecraft.world.entity.monster.illager.Pillager}}|link=#Pillager}}
|Asset ID||{{Flatlist|
* {{EntityLink|Piglin|{{jcp|net.minecraft.world.entity.monster.piglin.Piglin}}|link=#Piglin}}
* {{mono|container/slot/ingot}}
* {{EntityLink|Piglin|{{jcp|net.minecraft.world.entity.monster.piglin.PiglinAi}}|link=#PiglinAi}}
* {{mono|container/slot/redstone_dust}}
* {{EntityLink|Piglin Brute|{{jcp|net.minecraft.world.entity.monster.piglin.PiglinBrute}}|link=#PiglinBrute}}
* {{mono|container/slot/lapis_lazuli}}
* {{EntityLink|Skeleton|{{jcp|net.minecraft.world.entity.monster.skeleton.AbstractSkeleton}}|link=#AbstractSkeleton}}
* {{mono|container/slot/quartz}}
* {{EntityLink|Bogged|{{jcp|net.minecraft.world.entity.monster.skeleton.Bogged}}|link=#Bogged}}
* {{mono|container/slot/diamond}}
* {{EntityLink|Drowned|{{jcp|net.minecraft.world.entity.monster.zombie.Drowned}}|link=#Drowned}}
* {{mono|container/slot/esmerald}}
* {{EntityLink|Trident|{{jcp|net.minecraft.world.entity.monster.zombie.Drowned.DrownedTridentAttackGoal}}|link=#DrownedTridentAttackGoal}}
* {{EntityLink|Zombie|{{jcp|net.minecraft.world.entity.monster.zombie.Zombie}}|link=#Zombie}}
* {{EntityLink|Zombie Villager|{{jcp|net.minecraft.world.entity.monster.zombie.ZombieVillager}}|link=#ZombieVillager}}
* {{EntityLink|Villager|{{jcp|net.minecraft.world.entity.npc.villager.Villager}}|link=#Villager}}
* {{EntityLink|Farmer|{{jcp|net.minecraft.world.entity.npc.villager.VillagerProfession}}|link=#VillagerProfession}}
* {{EntityLink|Wandering Trader|{{jcp|net.minecraft.world.entity.npc.wanderingtrader.WanderingTrader}}|link=#WanderingTrader}}
* {{EntityLink|Player|{{jcp|net.minecraft.world.entity.player.Player}}|link=#Player}}
* {{EntityLink|Firework Rocket|{{jcp|net.minecraft.world.entity.projectile.FireworkRocketEntity}}|link=#FireworkRocketEntity}}
* {{EntityLink|Fishing Hook|{{jcp|net.minecraft.world.entity.projectile.FishingHook}}|link=#FishingHook}}
* {{EntityLink|Arrow|{{jcp|net.minecraft.world.entity.projectile.ProjectileUtil}}|link=#ProjectileUtil}}
* {{ItemLink|ominous-banner|{{jcp|net.minecraft.world.entity.raid.Raid}}|link=#Raid}}
}}
}}
|-
|Textures||{{Flatlist|
* [[File:Slot ingot.png|40px|class=pixel-image]]
* [[File:Slot redstone dust.png|40px|class=pixel-image]]
* [[File:Slot lapis lazuli.png|40px|class=pixel-image]]
** {{Tooltip|[[File:Slot lapis lazuli Programmer.png|40px|class=pixel-image]]|Programmer art texture}}
* [[File:Slot quartz.png|40px|class=pixel-image]]
* [[File:Slot diamond.png|40px|class=pixel-image]]
* [[File:Slot emerald.png|40px|class=pixel-image]] 
}}
|-
|rowspan=2 | Netherite Upgrade
| Asset ID||{{Flatlist|
* {{mono|container/slot/ingot}}
}}
|-
|Textures || {{Flatlist|
* [[File:Slot ingot.png|40px|class=pixel-image]]
}}
|}
Asset ID refers to textures file path in {{mono|/assets/minecraft/textures/gui/sprites/}}.


==== Append hover text ====


'''Misc'''
'''public void appendHoverText({{Tooltip|...|ItemStack itemStack, Item.TooltipContext context, TooltipDisplay display, Consumer&lt;Component&gt; builder, TooltipFlag tooltipFlag}})'''
 
{{hatnote|Overrides method in [[#appendHoverText(...)|{{jicp|}}]]}}
{{columns-list|colwidth=16em|
 
* {{ItemLink|ominous-banner|{{jcp|net.minecraft.advancements.criterion.EntityEquipmentPredicate}}|link=#EntityEquipmentPredicate}}
 
'''Client'''
* {{BlockLink|Barrier|{{jcp|net.minecraft.client.multiplayer.ClientLevel}}|link=#ClientLevel}}
* {{ItemLink|Bow|{{jcp|net.minecraft.client.player.AbstractClientPlayer}}|link=#AbstractClientPlayer}}
* {{ItemLink|Crossbow|{{jcp|net.minecraft.client.renderer.ItemInHandRenderer}} |link=#ItemInHandRenderer}}
* {{EntityLink|Skeleton|{{jcp|net.minecraft.client.renderer.entity.AbstractSkeletonRenderer}}|link=#AbstractSkeletonRenderer}}
* {{EntityLink|Drowned|{{jcp|net.minecraft.client.renderer.entity.DrownedRenderer}}|link=#DrownedRenderer}}
* {{InvLink|Dragon Head| {{jcp|net.minecraft.client.renderer.entity.LivingEntityRenderer}} |link=#LivingEntityRenderer}}
* {{EntityLink|Witch|{{jcp|net.minecraft.client.renderer.entity.WitchRenderer}}|link=#WitchRenderer}}
* {{InvLink|Spyglass|{{jcp|net.minecraft.client.renderer.entity.player.AvatarRenderer}}|link=#AvatarRenderer}}
* {{InvLink|Clock|icon=invicon|{{jcp|net.minecraft.client.renderer.item.CuboidItemModelWrapper}}|link=#CuboidItemModelWrapper}}
* {{ItemLink|Crossbow Firework|{{jcp|net.minecraft.client.renderer.item.properties.select.Charge}}|link=#Charge}}


'''Item'''
Add the following lines to the beginning of the item's tooltip, in order:
* {{ItemLink|potion-of-healing|{{jicp|alchemy|PotionBrewing}}|link=#PotionBrewing}}
* "Smithing Template" ({{Color|Gray}})
* {{BlockLink|Air|{{jicp|crafting|Ingredient}} |link=#Ingredient}}
** {{cd|{"translate":"item.minecraft.smithing_template",color:"gray"&#125;}}  
* {{ItemLink|crossbow-firework|{{jicp|Crossbow}}|link=#CrossbowItem}}
* Empty line
* {{ItemLink|enchanted-book|{{jicp|enchantment|EnchantmentHelper}}|link=#EnchantmentHelper}}
** {{cd|{"text":""&#125;}}  
* {{BlockLink|Air| {{jicp|}} |link=#Item}}
* "Applies to:" ({{Color|Gray}})
* {{InvLink|Monster Spawner|{{jicp|-Stack}}|link=#ItemStack}}
** {{cd|{"translate":"item.minecraft.smithing_template.applies_to",color:"gray"&#125;}}  
* {{BlockLink|Air|{{jicp|-StackTemplate}}|link=#ItemStackTemplate}}
* Space append to {{cd|''appliesTo''}}
* {{ItemLink|Firework Rocket|{{jicp|ProjectileWeapon}}|link=#ProjectileWeaponItem}}
** {{cd|[{"text":" "&#125;,''appliesTo'']}}
* "Ingredients:" ({{Color|Gray}})
** {{cd|{"translate":"item.minecraft.smithing_template.ingredients",color:"gray"&#125;}}  
* Space append to {{cd|''ingredients''}}
** {{cd|[{"text":" "&#125;,''ingredients'']}}


'''Loot'''
==== Smithing table screen ====
* {{ItemLink|Book|{{jcp|net.minecraft.world.level.storage.loot.functions.EnchantRandomlyFunction}}|link=#EnchantRandomlyFunction}}
* {{ItemLink|ocean-explorer-map|{{jcp|net.minecraft.world.level.storage.loot.functions.ExplorationMapFunction}}|link=#ExplorationMapFunction}}
* {{ItemLink|Player Head|{{jcp|net.minecraft.world.level.storage.loot.functions.FillPlayerHead}}|link=#FillPlayerHead}}
* {{ItemLink|enchanted-book|{{jcp|net.minecraft.world.level.storage.loot.functions.SetEnchantmentsFunction}}|link=#SetEnchantmentsFunction}}
* {{ItemLink|SUSPICIOUS-STEW|{{jcp|net.minecraft.world.level.storage.loot.functions.SetStewEffectFunction}}|link=#SetStewEffectFunction}}
}}


=== CauldronInteractions ===
There are 4 methods that always give the assigned values ​​of the sprint items, namely {{cd|getBaseSlotDescription()}}, {{cd|getAdditionSlotDescription()}}, {{cd|getBaseSlotEmptyIcons()}}, and {{cd|getAdditionalSlotEmptyIcons()}}. All of them are used only in the {{jcp|net.minecraft.client.gui.screens.inventory.SmithingScreen}} class. This class defines the behavior of the menu slots in the [[Minecraft:smithing table]], controlling both the sprint that appears in empty slots and the tooltip when hovering the mouse over an empty slot. Furthermore, this class uses two instanceof of SmithingTemplateItem (and in no other class of the code is it used instanceof of SmithingTemplateItem).
{{empty section}}


=== DispenseItemBehavior ===
'''Slot background'''
{{Expand section}}
{{Infobox hip|class=DispenseItemBehavior|Arrow|Tipped Arrow|Spectral Arrow|Egg|Blue Egg|Brown Egg|Snowball|Bottle o' Enchanting|Splash Potion|Lingering Potion|Firework Rocket|Fire Charge|Wind Charge|Armor Stand|Chest|Oak Boat|Spruce Boat|Birch Boat|Jungle Boat|Dark Oak Boat|Acacia Boat|Cherry Boat|Mangrove Boat|Pale Oak Boat|Bamboo Raft|Oak Boat with Chest|Spruce Boat with Chest|Birch Boat with Chest|Jungle Boat with Chest|Dark Oak Boat with Chest|Acacia Boat with Chest|Cherry Boat with Chest|Mangrove Boat with Chest|Pale Oak Boat with Chest|Bamboo Raft with Chest|Lava Bucket|Water Bucket|Powder Snow Bucket|Bucket of Salmon|Bucket of Cod|Bucket of Pufferfish|Bucket of Tropical Fish|Bucket of Axolotl|Bucket of Tadpole|Bucket|Flint and Steel|Bone Meal|Wither Skeleton Skull|Shulker Box|White Shulker Box|Orange Shulker Box|Magenta Shulker Box|Light Blue Shulker Box|Yellow Shulker Box|Lime Shulker Box|Pink Shulker Box|Gray Shulker Box|Light Gray Shulker Box|Cyan Shulker Box|Purple Shulker Box|Blue Shulker Box|Brown Shulker Box|Green Shulker Box|Red Shulker Box|Black Shulker Box|Glass Bottle|Glowstone|Shears|Brush|Honeycomb|Potion|Minecart|Minecart with Chest|Minecart with Furnace|Minecart with TNT|Minecart with Hopper|Minecart with Command Block|pac=core.dispenser|Inv=t}}


'''bootStrap()'''
Slots 0, 1, and 2 of the menu use a rendering of their variable background given by a list of identifiers (asset IDs), defined by the class {{jcp|net.minecraft.client.gui.screens.inventory.CyclingSlotBackground}}. With each tick update:
* If the icons list is different from the old icons list, update the icons list and reset the index of the list to zero.
* If the current list is not empty:
**Increase the tick count by one.
** If the tick count is a multiple of 30, increase the index of the identifier by one; return to zero if it exceeds the limit of the list.
 
And when render the slot background:
* If the list is empty or the slot is not empty: do nothing.
* If the tick count is greater than 30 and fewer than t + a < 4.0, where t is how many ticks have passed the last multiple of 30: render the previous icon (one index lower or the last one in the list if the index is zero) with {{cd|1–(t+a)/4.0}} transparency.{{More info|What is this a?}}
* Renderize the current index with {{cd|(t+a)/4.0}} of transparency.
 
Note that in this way each icon occupies the slot for 30 ticks and has a smooth transition of 4 ticks.
 
In {{jcp|net.minecraft.client.gui.screens.inventory.SmithingScreen}}, each tick updates the tick of {{jcp|net.minecraft.client.gui.screens.inventory.CyclingSlotBackground}}, from slots 0, 1, and 2, with a list that may vary:
 
* For slot 0, a list of two elements is always used; these are: {{mono|container/slot/smithing_template_armor_trim}} and {{mono|container/slot/smithing_template_netherite_upgrade}}.
::{{Flatlist|
::* [[File:Slot smithing template armor trim.png|40px|class=pixel-image]]
::* [[File:Slot smithing template netherite upgrade.png|40px|class=pixel-image]]
}}
* For slot 1, if there is no instance of SmithingTemplateItem in slot 0, the list is empty. If there is, it is the {{cd|baseSlotEmptyIcons}} of the item.
* For slot 2, if there is no instance of SmithingTemplateItem in slot 0, the list is empty. If there is, it is the {{cd|additionalSlotEmptyIcons}} of the item.
 
'''Boarding Tooltips'''


Defines the item's behavior when [[Minecraft:dispenser]]. The behaviors {{cd|OptionalDispenseItemBehavior()}} and {{cd|DefaultDispenseItemBehavior()}} are largely defined uniquely for each item.
Depending on the mouse position, among other factors, the switcher table menu renders a tooltip.


{|class="wikitable sortable collapsible"
* Mouse over a rectangular area around the arrow: if the recipe has an error (has items in slots 0, 1, and 3 but no result): "Item can't be upgraded this way" ({{color|White}})
! Item !! Behavior
** {{cd|{"translate":"container.upgrade.error_tooltip"&#125;}}
|-
** When there is a recipe error, it also renders a red X above the arrow:
|{{InvLink|Arrow}}
*** [[File:GUI_error.png|28px]] {{mono|container/smithing/error}}
|rowspan="11"|ProjectileBehavior
* If the mouse is in slot 0 and it is empty: "Add Smithing Template" ({{color|White}})
|-
** {{cd|{"translate":"container.upgrade.missing_template_tooltip"&#125;}}
|{{InvLink|Tipped Arrow}}
* If the mouse is in slot 1, it is not empty, and slot 0 has an instance of SmithingTemplateItem: the {{cd|''baseSlotDescription''}} from item in slot 0.
|-
* If the mouse is in slot 2, it is not empty, and slot 0 has an instance of SmithingTemplateItem: the {{cd|''additionsSlotDescription''}} from item in slot 0.
|{{InvLink|Spectral Arrow}}
* In any other case: it does not render a menu tooltip (although it continues to render item tooltips normally).
|-
 
|{{ItemLink|Eggs}}
=== SnowballItem ===
|-
{{empty section}}
|{{InvLink|Snowball}}
=== SolidBucketItem ===
|-
{{empty section}}
|{{InvLink|Bottle o' Enchanting}}
=== SpawnEggItem ===
|-
{{empty section}}
|{{InvLink|Splash Potion}}
=== SpectralArrowItem ===
|-
{{empty section}}
|{{InvLink|Lingering Potion}}
=== SplashPotionItem ===
|-
{{empty section}}
|{{InvLink|Firework Rocket}}
=== SpyglassItem ===
|-
{{info needed section|How does this apply its camera overlay? It's different from carved pumpkins: {{bug|MC-277451}}}}
|{{InvLink|Fire Charge}}
 
|-
=== StandingAndWallBlockItem ===
|{{InvLink|Wind Charge}}
{{info needed section|I assume this handles torches, but are signs, hanging signs, banners and heads also relevant? what about hoppers?}}
|-
 
|{{InvLink|Armor Stand}} ||DefaultDispenseItemBehavior
=== ThrowablePotionItem ===
|-
{{empty section}}
|{{InvLink|Chest}} ||OptionalDispenseItemBehavior
=== TippedArrowItem ===
|-
{{empty section}}
|{{ItemLink|Boats}}
=== TridentItem ===
|rowspan="2"|BoatDispenseItemBehavior
{{empty section}}
|-
=== WindChargeItem ===
|{{ItemLink|Boats with chest|id=All boats with chest}}
{{empty section}}
|-
=== WritableBookItem ===
|{{InvLink|Lava Bucket}}
 
|rowspan="4"|filledBucketBehavior
{{Infobox hardcoded item property|class=WritableBookItem|Book and Quill}}
|-
|{{InvLink|Water Bucket}}
|-
|{{InvLink|Powder Snow Bucket}}
|-
|{{ItemLink|Bucket of aquatic mob}}
|-
|{{InvLink|Bucket}} ||DefaultDispenseItemBehavior
|-
|{{InvLink|Flint and Steel}} ||OptionalDispenseItemBehavior
|-
|{{InvLink|Bone Meal}} ||OptionalDispenseItemBehavior
|-
|{{InvLink|Wither Skeleton Skull}} ||OptionalDispenseItemBehavior
|-
|{{BlockLink|Shulker Boxes}} ||shulkerBoxDispenseBehavior
|-
|{{InvLink|Glass Bottle}} ||OptionalDispenseItemBehavior
|-
|{{InvLink|Glowstone}} ||OptionalDispenseItemBehavior
|-
|{{InvLink|Shears}} ||ShearsDispenseItemBehavior
|-
|{{InvLink|Brush}} ||OptionalDispenseItemBehavior
|-
|{{InvLink|Honeycomb}} ||OptionalDispenseItemBehavior
|-
|{{InvLink|Potion}} ||DefaultDispenseItemBehavior
|-
|{{InvLink|Minecart}}
|rowspan="6"|MinecartDispenseItemBehavior
|-
|{{InvLink|Minecart with Chest}}
|-
|{{InvLink|Minecart with Furnace}}
|-
|{{InvLink|Minecart with TNT}}
|-
|{{InvLink|Minecart with Hopper}}
|-
|{{InvLink|Minecart with Command Block}}
|}


=== AnvilMenu ===
'''use({{tooltip|...|Level level, Player player, InteractionHand hand}})'''
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}}


{{Infobox hip|class=AnvilMenu|Enchanted book|pac=world.inventory}}
Open item GUI and increases the {{cd|used}} [[Minecraft:statistic]] by one. Always returns successful.


'''createResult()'''
Note:


If the [[Minecraft:anvil]] input is an enchanted book, it will initially consider any [[Minecraft:enchantment]] as compatible. However, if the enchantment is the same or does it [[Minecraft:Enchanting_table_mechanics#Conflicting_enchantments|conflict]] with any enchantment in the current list of enchantments in the result, it will no longer be considered compatible.
The item GUI depends on the components {{DCL|writable_book_content}} and {{DCL|written_book_content}}. Therefore:
* If the item does not have either component: nothing is opened, but there is still an increase in statistics and usage animation.
* If the item has only one of these components: the corresponding GUI opens.  
* If both components are present: both GUIs open, but the written book content GUI completely overlays the writable book content GUI, which the player can see briefly on the screen.


In other words, it's as if the enchanted book were in [[Minecraft:Enchantment_definition#JSON_format|{{cd|supported_items}}]] for all enchantment definition, when we consider the anvil.
Therefore, the GUI are entirely dependent on the components and independent of the item ID. However, it is only possible to open them with the [[Minecraft:book and quill]] and [[Minecraft:written book]], since only these items attempt to open the GUI.


=== PotionSlot ===
=== WrittenBookItem ===


{{Infobox hip|class=PotionSlot|Potion|Splash Potion|Lingering Potion|Glass Bottle|pac=world.inventory|out={{cd|BrewingStandMenu}}}}
{{Infobox hardcoded item property|class=WrittenBookItem|Written Book}}


'''mayPlaceItem({{Tooltip|...|ItemStack itemStack}})'''
'''use({{tooltip|...|Level level, Player player, InteractionHand hand}})'''
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}}


Returns true only if it is one of the four items listed above. Used to determine which items can be placed in the portion slot of the [[Minecraft:brewing stand]].
Completely identical to {{cd|WritableBookItem}}; see the {{slink||WritableBookItem}}.


It is also used in {{cd|quickMoveStack}}, so that these items are attempted to be moved from the inventory to the potion slot with a quick click (click + Shift). Notes:
* If the item is in the [[Minecraft:Item_tag_(Java_Edition)#brewing_fuel|#brewing_fuel]] tag, it will attempt to enter the fuel slot and not the potion slot (even if it fails to enter the fuel slot). Technically, the same would occur with ingredients, however, ingredients are also [[#PotionBrewing|hardcoded]] and don't have intersection.
* This prevents quick clicking from moving them between [[Minecraft:Inventory#Slots|storage slots]] and hotbar slots and vice versa, when the brewing stand menu is open. Even if the itens fails to move to the potion slot.


=== CartographyTableMenu ===
<br>


{{Infobox hip|class=CartographyTableMenu|Paper|Empty Map|Glass Pane|pac=world.inventory|Inv=t}}
== Items member access ==


'''mayPlace({{Tooltip|...|ItemStack itemStack}})'''
'''Blocks'''
{{hatnote|Defined when adding slot 1, within the {{cd|CartographyTableMenu({{tooltip|...|int containerId, Inventory inventory, ContainerLevelAccess access}})}} method.}}


Returns true only if it is one of the three items listed above. Used to determine which items can be placed in the [[Minecraft:Java_Edition_protocol/Inventory#Cartography_Table|slot 1]] of the [[Minecraft:cartography table]].
{{columns-list|


'''setupResultSlot({{tooltip|...|ItemStack mapStack, ItemStack additionalStack, ItemStack resultStack}})'''
* {{BlockLink|Cauldron-top|{{jcp|net.minecraft.core.cauldron.CauldronInteractions}}|link=#CauldronInteractions}}
 
* {{BlockLink|Dispenser|{{jcp|net.minecraft.core.dispenser.DispenseItemBehavior}}|link=#DispenseItemBehavior}}
Used to define the result item of the cartography table:
* {{BlockLink|Anvil|{{jcp|net.minecraft.world.inventory.AnvilMenu}}|link=#AnvilMenu}}
 
* {{BlockLink|Cartography Table|{{jcp|net.minecraft.world.inventory.CartographyTableMenu}}|link=#CartographyTableMenu}}
* If the {{cd|''mapStack''}} (item in slot 0) does not have a {{cd|''mapData''}} (data associated with its {{DCL|map_id}} component), it will not yield any results.
* {{BlockLink|Enchanting Table|{{jcp|net.minecraft.world.inventory.EnchantmentMenu}}|link=#EnchantmentMenu}}
 
* {{BlockLink|Lit Furnace|{{jcp|net.minecraft.world.inventory.FurnaceFuelSlot}}|link=#FurnaceFuelSlot}}
* If it's paper and the {{cd|''mapData''}} is not locked and has a scale less than 4, the resulting is one copy of the {{cd|''mapStack''}} with the {{DCL|map_post_processing}} component set to 1 (SCALE).
* {{BlockLink|Grindstone|{{jcp|net.minecraft.world.inventory.GrindstoneMenu}}|link=#GrindstoneMenu}}
* {{BlockLink|Beehive|{{jbcp|Beehive}}|link=#BeehiveBlock}}
* {{BlockLink|Candle Cake|{{jbcp|CandleCake}}|link=#CandleCakeBlock}}
* {{BlockLink|Chiseled BookShelf|{{jbcp|ChiseledBookShelf}}|link=#ChiseledBookShelfBlock}}
* {{BlockLink|Composter-bottom|{{jbcp||ComposterBlock.OutputContainer}}|link=#OutputContainer}}
* {{BlockLink|Light|{{jbcp|Light}}|link=#LightBlock}}
* {{BlockLink|Powder Snow|{{jbcp|PowderSnow}}|link=#PowderSnowBlock}}
* {{BlockLink|Pumpkin|{{jbcp|Pumpkin}}|link=#PumpkinBlock}}
* {{BlockLink|Respawn Anchor|{{jbcp|RespawnAnchor}}|link=#RespawnAnchorBlock}}
* {{BlockLink|Sweet Berry Bush|{{jbcp|SweetBerryBush}}|link=#SweetBerryBushBlock}}
* {{BlockLink|Tnt|{{jbcp|Tnt}}|link=#TntBlock}}
* {{BlockLink|TripWire|{{jbcp|TripWire}}|link=#TripWireBlock}}
* {{BlockLink|Copper Golem Statue|{{jbcp|WeatheringCopperGolemStatue}}|link=#WeatheringCopperGolemStatueBlock}}
* {{BlockLink|wither-skeleton-skull|{{jbcp|WitherSkull}}|link=#WitherSkullBlock}}
* {{BlockLink|Furnace|{{jbcp|entity|AbstractFurnaceBlockEntity}}|link=#AbstractFurnaceBlockEntity}}
* {{BlockLink|Brewing Stand|{{jbcp|entity|BrewingStandBlockEntity}}|link=#BrewingStandBlockEntity}}
* {{InvLink|Coal|{{jbcp|entity|FuelValues}}|link=#FuelValues}}
* {{BlockLink|Vault|{{jbcp|entity.vault|VaultConfig}}|link=#VaultConfig}}
}}


* If it's glass and the {{cd|''mapData''}} is not locked, the resulting is one copy of the {{cd|''mapStack''}} with the {{cd|map_post_processing}} component set to 0 (LOCK).
'''Entity'''


* If it's empty map, the resulting is ''two'' copy of the {{cd|''mapStack''}}.
{{columns-list|colwidth=16em|


''Note'': It's possible to use the cartography table regardless of the {{cd|''mapStack''}} ID; it only needs to have the {{cd|map_id}} component with data. However, when retrieving an item that the ID isn't filled_map with the {{cd|map_post_processing}} component, the game crashes<ref>{{bug|MC-306074}}</ref>. However, using the empty map still works for item duplication.
* {{InvLink|Golden Dandelion|{{jcp|net.minecraft.world.entity.AgeableMob}}|link=#AgeableMob}}
 
* {{EntityLink|salmon|{{jcp|net.minecraft.world.entity.Bucketable}}|link=#Bucketable}}
'''quickMoveStack({{Tooltip|...|Player player, int slotIndex}})'''
* {{ItemLink|Lead|{{jcp|net.minecraft.world.entity.Entity}}|link=#Entity}}
 
* {{ItemLink|NAME TAG|{{jcp|net.minecraft.world.entity.Mob}}|link=#Mob}}
When using the quick click (click + Shift) in the inventory with the cartography table menu is open, it attempts to move these items to slot 1. Notes:
* {{ItemLink|crossbow-drawn-1|{{jcp|net.minecraft.world.entity.ai.behavior.CrossbowAttack}}|link=#CrossbowAttack}}
* If the item has the {{cd|map_id}} component, it attempts to move it to slot 0 and does not go to slot 1 (even if it fails to go to slot 0).  
* {{EntityLink|Villager|{{jcp|net.minecraft.world.entity.ai.behavior.TradeWithVillager}}|link=#TradeWithVillager}}
* This prevents quick clicking from moving them between [[Minecraft:Inventory#Slots|storage slots]] and hotbar slots and vice versa, when the cartography table menu is open. Even if the itens fails to move to the slot 1.
* {{ItemLink|Bone meal|{{jcp|net.minecraft.world.entity.ai.behavior.UseBonemeal}}|link=#UseBonemeal}}
 
* {{InvLink|Composter|{{jcp|net.minecraft.world.entity.ai.behavior.WorkAtComposter}}|link=#WorkAtComposter}}
=== EnchantmentMenu ===
* {{ItemLink|Bone|{{jcp|net.minecraft.world.entity.ai.goal.BegGoal}}|link=#BegGoal}}
{{Infobox hip|class=EnchantmentMenu|Book|Lapis Lazuli|pac=world.inventory}}
* {{ItemLink|Bow-drawn-3|{{jcp|net.minecraft.world.entity.ai.goal.RangedBowAttackGoal}}|link=#BowAttackGoal}}
 
* {{ItemLink|crossbow-drawn-3|{{jcp|net.minecraft.world.entity.ai.goal.RangedCrossbowAttackGoal}}|link=#RangedCrossbowAttackGoal}}
{{ItemSprite|lapis lazuli}} '''mayPlace({{Tooltip|...|ItemStack itemStack}})'''
* {{EntityLink|Armadillo|{{jcp|net.minecraft.world.entity.animal.armadillo.Armadillo}}|link=#Armadillo}}
{{hatnote|Defined when adding slot 1, within the {{cd|EnchantmentMenu({{tooltip|...|int containerId, Inventory inventory, ContainerLevelAccess access}})}} method.}}
* {{EntityLink|Axolotl|{{jcp|net.minecraft.world.entity.animal.axolotl.Axolotl}}|link=#Axolotl}}
 
* {{EntityLink|Camel|{{jcp|net.minecraft.world.entity.animal.camel.Camel}}|link=#Camel}}
Only lapis lazuli can be placed in the [[Minecraft:Java_Edition_protocol/Inventory#Enchantment|slot 1]] of [[Minecraft:enchantment table]].
* {{EntityLink|Cow|{{jcp|net.minecraft.world.entity.animal.cow.AbstractCow}}|link=#AbstractCow}}
 
* {{EntityLink|mooshroom|{{jcp|net.minecraft.world.entity.animal.cow.MushroomCow}}|link=#MushroomCow}}
{{ItemSprite|book}} '''clickMenuButton({{tooltip|...|Player player, int buttonId}})'''
* {{EntityLink|Mule|{{jcp|net.minecraft.world.entity.animal.equine.AbstractChestedHorse}}|link=#AbstractChestedHorse}}
 
* {{EntityLink|Horse|{{jcp|net.minecraft.world.entity.animal.equine.AbstractHorse}}|link=#AbstractHorse}}
Right before a book is enchanted on an enchantment table, it becomes an [[Minecraft:enchanted book]].
* {{EntityLink|Horse|{{jcp|net.minecraft.world.entity.animal.equine.Horse}}|link=#Horse}}
 
* {{EntityLink|Llama|{{jcp|net.minecraft.world.entity.animal.equine.Llama}}|link=#Llama}}
{{ItemSprite|book}} '''getEnchantmentList({{tooltip|...|RegistryAccess access, ItemStack itemStack, int slot, int enchantmentCost}})'''
* {{EntityLink|Goat|{{jcp|net.minecraft.world.entity.animal.goat.Goat}}|link=#Goat}}
 
* {{EntityLink|Copper Golem|{{jcp|net.minecraft.world.entity.animal.golem.CopperGolem}}|link=#CopperGolem}}
When creating a list of enchantments to enchant a book on an enchantment table, remove one enchantment at random if the list has more than one enchantment.
* {{EntityLink|Iron Golem|{{jcp|net.minecraft.world.entity.animal.golem.IronGolem}}|link=#IronGolem}}
 
* {{EntityLink|Snow Golem|{{jcp|net.minecraft.world.entity.animal.golem.SnowGolem}}|link=#SnowGolem}}
{{ItemSprite|lapis lazuli}} '''quickMoveStack({{Tooltip|...|Player player, int slotIndex}})'''
* {{EntityLink|Panda|{{jcp|net.minecraft.world.entity.animal.panda.Panda}}|link=#Panda}}
* {{EntityLink|Pig|{{jcp|net.minecraft.world.entity.animal.pig.Pig}}|link=#Pig}}
* {{EntityLink|Sheep|{{jcp|net.minecraft.world.entity.animal.sheep.Sheep}}|link=#Sheep}}
* {{EntityLink|Wolf|{{jcp|net.minecraft.world.entity.animal.wolf.Wolf}}|link=#Wolf}}
* {{EntityLink|Armor Stand|{{jcp|net.minecraft.world.entity.decoration.ArmorStand}}|link=#ArmorStand}}
* {{EntityLink|leash-knot|{{jcp|net.minecraft.world.entity.decoration.LeashFenceKnotEntity}}|link=#LeashFenceKnotEntity}}
* {{EntityLink|Creeper|{{jcp|net.minecraft.world.entity.monster.Creeper}}|link=#Creeper}}
* {{ItemLink|Crossbow|{{jcp|net.minecraft.world.entity.monster.CrossbowAttackMob}}|link=#CrossbowAttackMob}}
* {{EntityLink|Strider|{{jcp|net.minecraft.world.entity.monster.Strider}}|link=#Strider}}
* {{EntityLink|Illusioner| {{jcp|net.minecraft.world.entity.monster.illager.Illusioner}}|link=#Illusioner}}
* {{EntityLink|Pillager|{{jcp|net.minecraft.world.entity.monster.illager.Pillager}}|link=#Pillager}}
* {{EntityLink|Piglin|{{jcp|net.minecraft.world.entity.monster.piglin.Piglin}}|link=#Piglin}}
* {{EntityLink|Piglin|{{jcp|net.minecraft.world.entity.monster.piglin.PiglinAi}}|link=#PiglinAi}}
* {{EntityLink|Piglin Brute|{{jcp|net.minecraft.world.entity.monster.piglin.PiglinBrute}}|link=#PiglinBrute}}
* {{EntityLink|Skeleton|{{jcp|net.minecraft.world.entity.monster.skeleton.AbstractSkeleton}}|link=#AbstractSkeleton}}
* {{EntityLink|Bogged|{{jcp|net.minecraft.world.entity.monster.skeleton.Bogged}}|link=#Bogged}}
* {{EntityLink|Drowned|{{jcp|net.minecraft.world.entity.monster.zombie.Drowned}}|link=#Drowned}}
* {{EntityLink|Trident|{{jcp|net.minecraft.world.entity.monster.zombie.Drowned.DrownedTridentAttackGoal}}|link=#DrownedTridentAttackGoal}}
* {{EntityLink|Zombie|{{jcp|net.minecraft.world.entity.monster.zombie.Zombie}}|link=#Zombie}}
* {{EntityLink|Zombie Villager|{{jcp|net.minecraft.world.entity.monster.zombie.ZombieVillager}}|link=#ZombieVillager}}
* {{EntityLink|Villager|{{jcp|net.minecraft.world.entity.npc.villager.Villager}}|link=#Villager}}
* {{EntityLink|Farmer|{{jcp|net.minecraft.world.entity.npc.villager.VillagerProfession}}|link=#VillagerProfession}}
* {{EntityLink|Wandering Trader|{{jcp|net.minecraft.world.entity.npc.wanderingtrader.WanderingTrader}}|link=#WanderingTrader}}
* {{EntityLink|Player|{{jcp|net.minecraft.world.entity.player.Player}}|link=#Player}}
* {{EntityLink|Firework Rocket|{{jcp|net.minecraft.world.entity.projectile.FireworkRocketEntity}}|link=#FireworkRocketEntity}}
* {{EntityLink|Fishing Hook|{{jcp|net.minecraft.world.entity.projectile.FishingHook}}|link=#FishingHook}}
* {{EntityLink|Arrow|{{jcp|net.minecraft.world.entity.projectile.ProjectileUtil}}|link=#ProjectileUtil}}
* {{ItemLink|ominous-banner|{{jcp|net.minecraft.world.entity.raid.Raid}}|link=#Raid}}
}}


When using the quick click ({{key|shift}} + click) in the inventory with the enchantment table menu is open, it attempts to move the lapis lazuli to slot 1. This prevents quick clicking from moving the lapis lazuli to slot 0.
'''Client'''
 
{{columns-list|colwidth=16em|
=== FurnaceFuelSlot ===
* {{BlockLink|Barrier|{{jcp|net.minecraft.client.multiplayer.ClientLevel}}|link=#ClientLevel}}
{{Infobox hip|class=FurnaceFuelSlot|Bucket|pac=world.inventory}}
* {{ItemLink|Bow|{{jcp|net.minecraft.client.player.AbstractClientPlayer}}|link=#AbstractClientPlayer}}
* {{ItemLink|Crossbow|{{jcp|net.minecraft.client.renderer.ItemInHandRenderer}} |link=#ItemInHandRenderer}}
* {{EntityLink|Skeleton|{{jcp|net.minecraft.client.renderer.entity.AbstractSkeletonRenderer}}|link=#AbstractSkeletonRenderer}}
* {{EntityLink|Drowned|{{jcp|net.minecraft.client.renderer.entity.DrownedRenderer}}|link=#DrownedRenderer}}
* {{InvLink|Dragon Head| {{jcp|net.minecraft.client.renderer.entity.LivingEntityRenderer}} |link=#LivingEntityRenderer}}
* {{EntityLink|Witch|{{jcp|net.minecraft.client.renderer.entity.WitchRenderer}}|link=#WitchRenderer}}
* {{InvLink|Spyglass|{{jcp|net.minecraft.client.renderer.entity.player.AvatarRenderer}}|link=#AvatarRenderer}}
* {{InvLink|Clock|icon=invicon|{{jcp|net.minecraft.client.renderer.item.CuboidItemModelWrapper}}|link=#CuboidItemModelWrapper}}
* {{ItemLink|Crossbow Firework|{{jcp|net.minecraft.client.renderer.item.properties.select.Charge}}|link=#Charge}}
}}
'''Item'''
{{columns-list|colwidth=16em|
* {{BlockLink|Air|{{jicp|crafting|Ingredient}} |link=#Ingredient}}
* {{ItemLink|crossbow-firework|{{jicp|Crossbow}}|link=#CrossbowItem}}
* {{ItemLink|enchanted-book|{{jicp|enchantment|EnchantmentHelper}}|link=#EnchantmentHelper}}
* {{BlockLink|Air| {{jicp|}} |link=#Item (member access)}}
* {{InvLink|Monster Spawner|{{jicp|-Stack}}|link=#ItemStack}}
* {{BlockLink|Air|{{jicp|-StackTemplate}}|link=#ItemStackTemplate}}
* {{ItemLink|Firework Rocket|{{jicp|ProjectileWeapon}}|link=#ProjectileWeaponItem}}
}}
'''Loot'''
{{columns-list|colwidth=16em|
* {{ItemLink|Book|{{jcp|net.minecraft.world.level.storage.loot.functions.EnchantRandomlyFunction}}|link=#EnchantRandomlyFunction}}
* {{ItemLink|Player Head|{{jcp|net.minecraft.world.level.storage.loot.functions.FillPlayerHead}}|link=#FillPlayerHead}}
* {{ItemLink|enchanted-book|{{jcp|net.minecraft.world.level.storage.loot.functions.SetEnchantmentsFunction}}|link=#SetEnchantmentsFunction}}
* {{ItemLink|SUSPICIOUS-STEW|{{jcp|net.minecraft.world.level.storage.loot.functions.SetStewEffectFunction}}|link=#SetStewEffectFunction}}
}}


'''isBucket({{Tooltip|...|ItemStack itemStack}})'''
'''Misc'''
{{columns-list|colwidth=16em|
* {{ItemLink|ominous-banner|{{jcp|net.minecraft.advancements.criterion.EntityEquipmentPredicate}}|link=#EntityEquipmentPredicate}}
}}


Check if the item is a bucket. Used twice to determine the behavior of the fuel slot (the lower left slot in blocks [[Minecraft:furnace]], [[Minecraft:smoker]], and [[Minecraft:blast furnace]]):
=== CauldronInteractions ===
{{empty section}}


* In {{cd|mayPlace(...)}}, to allow the bucket to be used in the fuel slot, even if it is not [[Minecraft:fuel]] (it is possible for it to be if it is added to a certain tag).
=== DispenseItemBehavior ===
** This does not change the quick move. Because what is tested to determine if an item can have a quick move to the fuel slot is whether it is a fuel.
{{Expand section}}
* In {{cd|getMaxStackSize(...)}}, to limit the maximum number of buckets in the fuel slot to one.
{{Infobox hardcoded item property|class=DispenseItemBehavior|Arrow|Tipped Arrow|Spectral Arrow|Egg|Blue Egg|Brown Egg|Snowball|Bottle o' Enchanting|Splash Potion|Lingering Potion|Firework Rocket|Fire Charge|Wind Charge|Armor Stand|Chest|Oak Boat|Spruce Boat|Birch Boat|Jungle Boat|Dark Oak Boat|Acacia Boat|Cherry Boat|Mangrove Boat|Pale Oak Boat|Bamboo Raft|Oak Boat with Chest|Spruce Boat with Chest|Birch Boat with Chest|Jungle Boat with Chest|Dark Oak Boat with Chest|Acacia Boat with Chest|Cherry Boat with Chest|Mangrove Boat with Chest|Pale Oak Boat with Chest|Bamboo Raft with Chest|Lava Bucket|Water Bucket|Powder Snow Bucket|Bucket of Salmon|Bucket of Cod|Bucket of Pufferfish|Bucket of Tropical Fish|Bucket of Axolotl|Bucket of Tadpole|Bucket|Flint and Steel|Bone Meal|Wither Skeleton Skull|Shulker Box|White Shulker Box|Orange Shulker Box|Magenta Shulker Box|Light Blue Shulker Box|Yellow Shulker Box|Lime Shulker Box|Pink Shulker Box|Gray Shulker Box|Light Gray Shulker Box|Cyan Shulker Box|Purple Shulker Box|Blue Shulker Box|Brown Shulker Box|Green Shulker Box|Red Shulker Box|Black Shulker Box|Glass Bottle|Glowstone|Shears|Brush|Honeycomb|Potion|Minecart|Minecart with Chest|Minecart with Furnace|Minecart with TNT|Minecart with Hopper|Minecart with Command Block|pac=core.dispenser|Inv=t}}


=== GrindstoneMenu ===
'''bootStrap()'''
{{Infobox hip|class=GrindstoneMenu|Enchanted Book|pac=world.inventory}}


'''removeNonCursesFrom({{Tooltip|...|ItemStack item}})'''
Defines the item's behavior when [[Minecraft:dispenser]]. The behaviors {{cd|OptionalDispenseItemBehavior()}} and {{cd|DefaultDispenseItemBehavior()}} are largely defined uniquely for each item.


When using an enchanted book on the [[Minecraft:grindstone]], after all non-curses enchantments have been removed, if the enchanted book does not retain an (curse) enchantment, it is transmuted into a [[Minecraft:book]].
{|class="wikitable sortable collapsible"
 
! Item !! Behavior
=== BeehiveBlock ===
|-
{{Infobox hip|class=BeehiveBlock|Shears|Glass Bottle|pac=world.level.block}}
|{{InvLink|Arrow}}
 
|rowspan="11"|ProjectileBehavior
'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult(ItemStack item}})'''
|-
 
|{{InvLink|Tipped Arrow}}
It encodes the interaction of an item on a [[Minecraft:bee nest]] and on a [[Minecraft:beehive]].
|-
 
|{{InvLink|Spectral Arrow}}
If the honey level is less than 5, or the item is not one of those listed below, the interaction returns 'try with empathy hand', otherwise returns success. The interaction depends on the item:
|-
 
|{{ItemLink|Eggs}}
* If the item is a shears, apply in the following order:
|-
** drop the loot table {{mono|harvest/beehive.json}} (3x {{ItemLink|Honeycomb}});
|{{InvLink|Snowball}}
** the [[Minecraft:sound event]] beehive shear ({{cd|block.beehive.shear}}) is played;
|-
** causes one damage from the shear;
|{{InvLink|Bottle o' Enchanting}}
** and produce the game event {{cd|shear}}.
|-
* If is glass bottle, apply in the following order:
|{{InvLink|Splash Potion}}
** shrink the item by one;
|-
** the sound event bottle fill ({{cd|item.bottle.fill}}) is played;
|{{InvLink|Lingering Potion}}
** give the player a [[Minecraft:honey bottle]], placing it in their hand if it's empty, otherwise try to put it in their inventory, if you can't, drop it;
|-
** and produce the game event {{cd|fluid_pickup}}.
|{{InvLink|Firework Rocket}}
 
|-
For both items, after that, increases the item used [[Minecraft:statistic]] by one and test if the beehive is in the smoke. If not, proceed in the following order:
|{{InvLink|Fire Charge}}
* if there is at least one bee in the hive, each [[Minecraft:bee]] in a 17x13x17 area around the hive becomes aggressive toward a random player in the same area;
|-
* all the bees leave the hive and become aggressive toward the player.
|{{InvLink|Wind Charge}}
Then, even if the beehive is in the smoke, the honey level is reduced to zero.
|-
 
|{{InvLink|Armor Stand}} ||DefaultDispenseItemBehavior
=== CandleCakeBlock ===
|-
{{Infobox hip|class=CandleCakeBlock|Flint and Steel|Fire Charge|pac=world.level.block}}
|{{InvLink|Chest}} ||OptionalDispenseItemBehavior
 
|-
'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult}})'''
|{{ItemLink|Boats}}
 
|rowspan="2"|BoatDispenseItemBehavior
When interacting with an flint and steel or a fire charge on a [[Minecraft:candle cake|cake with candle]] or a cake with dyed candle, the method immediately returns {{cd|PASS}}. The effect of these items on the cake is determined by {{cd|useOn(...)}} in its classes (see {{slink||useOn(...)}}, {{slink||FlintAndSteelItem}} and {{slink||FireChargeItem}}).
|-
 
|{{ItemLink|Boats with chest|id=All boats with chest}}
This also prevents the player from trying to eat the cake, unlike all other items. Note that with these items, the player cannot eat the cake even if the candle is already lit.
|-
 
|{{InvLink|Lava Bucket}}
=== ChiseledBookShelfBlock ===
|rowspan="4"|filledBucketBehavior
{{Infobox hip|class=ChiseledBookShelfBlock|Enchanted Book|pac=world.level.block}}
|-
 
|{{InvLink|Water Bucket}}
'''addBook({{tooltip|...|Level level, BlockPos pos, Player player, ChiseledBookShelfBlockEntity bookshelfBlock, ItemStack itemStack, int slot}})'''
|-
 
|{{InvLink|Powder Snow Bucket}}
When adding an enchanted book to the [[Minecraft:chiseled bookshelf]], use [[Minecraft:sound event]] {{cd|block.chiseled_bookshelf.insert.enchanted}} ({{sound||Chiseled bookshelf insert enchanted1.ogg
|-
|Chiseled bookshelf insert enchanted2.ogg
|{{ItemLink|Bucket of aquatic mob}}
|Chiseled bookshelf insert enchanted3.ogg
|-
|Chiseled bookshelf insert enchanted4.ogg}}) instead of {{cd|block.chiseled_bookshelf.insert}} ({{sound||Chiseled bookshelf insert1.ogg
|{{InvLink|Bucket}} ||DefaultDispenseItemBehavior
|Chiseled bookshelf insert2.ogg
|-
|Chiseled bookshelf insert3.ogg
|{{InvLink|Flint and Steel}} ||OptionalDispenseItemBehavior
|Chiseled bookshelf insert4.ogg}}).
|-
 
|{{InvLink|Bone Meal}} ||OptionalDispenseItemBehavior
Note: The items that can be added to the chiseled bookshelf are controlled by the tag {{tag link|item|bookshelf_books}}, therefore it is not a hardcoded property.
|-
 
|{{InvLink|Wither Skeleton Skull}} ||OptionalDispenseItemBehavior
'''removeBook({{tooltip|...|Level level, BlockPos pos, Player player, ChiseledBookShelfBlockEntity bookshelfBlock, int slot}})'''
|-
|{{BlockLink|Shulker Boxes}} ||shulkerBoxDispenseBehavior
|-
|{{InvLink|Glass Bottle}} ||OptionalDispenseItemBehavior
|-
|{{InvLink|Glowstone}} ||OptionalDispenseItemBehavior
|-
|{{InvLink|Shears}} ||ShearsDispenseItemBehavior
|-
|{{InvLink|Brush}} ||OptionalDispenseItemBehavior
|-
|{{InvLink|Honeycomb}} ||OptionalDispenseItemBehavior
|-
|{{InvLink|Potion}} ||DefaultDispenseItemBehavior
|-
|{{InvLink|Minecart}}
|rowspan="6"|MinecartDispenseItemBehavior
|-
|{{InvLink|Minecart with Chest}}
|-
|{{InvLink|Minecart with Furnace}}
|-
|{{InvLink|Minecart with TNT}}
|-
|{{InvLink|Minecart with Hopper}}
|-
|{{InvLink|Minecart with Command Block}}
|}


When remove an enchanted book to the chiseled bookshelf, use sound event {{cd|block.chiseled_bookshelf.pickup.enchanted}} ({{sound||Chiseled bookshelf pickup enchanted1.ogg
{{-}}
|Chiseled bookshelf pickup enchanted2.ogg
=== AnvilMenu ===
|Chiseled bookshelf pickup enchanted3.ogg}}) instead of {{cd|block.chiseled_bookshelf.pickup}} ({{sound||Chiseled bookshelf pickup1.ogg
|Chiseled bookshelf pickup2.ogg
|Chiseled bookshelf pickup3.ogg}}).


=== ComposterBlock ===
{{Infobox hardcoded item property|class=AnvilMenu|Enchanted book|pac=world.inventory}}


{{Infobox|title=ComposterBlock|rows =
'''createResult()'''
{{infobox row|class|ComposterBlock}}
{{infobox row|Items|
{{Flatlist|
{{Collapse|title='''Low'''|content=
* {{InvLink|Jungle Leaves}}
* {{InvLink|Oak Leaves}}
* {{InvLink|Spruce Leaves}}
* {{InvLink|Dark Oak Leaves}}
* {{InvLink|Pale Oak Leaves}}
* {{InvLink|Acacia Leaves}}
* {{InvLink|Cherry Leaves}}
* {{InvLink|Birch Leaves}}
* {{InvLink|Azalea Leaves}}
* {{InvLink|Mangrove Leaves}}
* {{InvLink|Oak Sapling}}
* {{InvLink|Spruce Sapling}}
* {{InvLink|Birch Sapling}}
* {{InvLink|Jungle Sapling}}
* {{InvLink|Acacia Sapling}}
* {{InvLink|Cherry Sapling}}
* {{InvLink|Dark Oak Sapling}}
* {{InvLink|Pale Oak Sapling}}
* {{InvLink|Mangrove Propagule}}
* {{ItemLink|Beetroot Seeds}}
* {{ItemLink|Dried Kelp}}
* {{InvLink|Short Grass}}
* {{InvLink|Kelp}}
* {{ItemLink|Melon Seeds}}
* {{ItemLink|Pumpkin Seeds}}
* {{InvLink|Seagrass}}
* {{ItemLink|Sweet Berries}}
* {{ItemLink|Glow Berries}}
* {{ItemLink|Wheat Seeds}}
* {{InvLink|Moss Carpet}}
* {{InvLink|Pale Moss Carpet}}
* {{InvLink|Pale Hanging Moss}}
* {{InvLink|Pink Petals}}
* {{InvLink|Wildflowers}}
* {{InvLink|Leaf Litter}}
* {{InvLink|Small Dripleaf}}
* {{InvLink|Hanging Roots}}
* {{InvLink|Mangrove Roots}}
* {{ItemLink|Torchflower Seeds}}
* {{ItemLink|Pitcher Pod}}
* {{InvLink|Firefly Bush}}
* {{InvLink|Bush}}
* {{InvLink|Cactus Flower}}
* {{InvLink|Short Dry Grass}}
* {{InvLink|Tall Dry Grass}} }}}}
{{Flatlist|
{{Collapse|title='''Low Mid'''|content=
* {{InvLink|Dried Kelp Block}}
* {{InvLink|Tall Grass}}
* {{InvLink|Flowering Azalea Leaves}}
* {{InvLink|Cactus}}
* {{InvLink|Sugar Cane}}
* {{InvLink|Vines}}
* {{InvLink|Nether Sprouts}}
* {{InvLink|Weeping Vines}}
* {{InvLink|Twisting Vines}}
* {{ItemLink|Melon Slice}}
* {{InvLink|Glow Lichen}} }} }}
{{Flatlist|
{{Collapse|title='''Mid'''|content=
* {{InvLink|Sea Pickle}}
* {{InvLink|Lily Pad}}
* {{InvLink|Pumpkin}}
* {{InvLink|Carved Pumpkin}}
* {{InvLink|Melon}}
* {{ItemLink|Apple}}
* {{ItemLink|Beetroot}}
* {{ItemLink|Carrot}}
* {{ItemLink|Cocoa Beans}}
* {{ItemLink|Potato}}
* {{InvLink|Wheat}}
* {{InvLink|Brown Mushroom}}
* {{InvLink|Red Mushroom}}
* {{InvLink|Mushroom Stem}}
* {{InvLink|Crimson Fungus}}
* {{InvLink|Warped Fungus}}
* {{InvLink|Nether Wart}}
* {{InvLink|Crimson Roots}}
* {{InvLink|Warped Roots}}
* {{InvLink|Shroomlight}}
* {{InvLink|Dandelion}}
* {{InvLink|Poppy}}
* {{InvLink|Blue Orchid}}
* {{InvLink|Allium}}
* {{InvLink|Azure Bluet}}
* {{InvLink|Red Tulip}}
* {{InvLink|Orange Tulip}}
* {{InvLink|White Tulip}}
* {{InvLink|Pink Tulip}}
* {{InvLink|Oxeye Daisy}}
* {{InvLink|Cornflower}}
* {{InvLink|Lily of the Valley}}
* {{InvLink|Wither Rose}}
* {{InvLink|Open Eyeblossom}}
* {{InvLink|Closed Eyeblossom}}
* {{InvLink|Fern}}
* {{InvLink|Sunflower}}
* {{InvLink|Lilac}}
* {{InvLink|Rose Bush}}
* {{InvLink|Peony}}
* {{InvLink|Large Fern}}
* {{InvLink|Spore Blossom}}
* {{InvLink|Azalea}}
* {{InvLink|Moss Block}}
* {{InvLink|Pale Moss Block}}
* {{InvLink|Big Dripleaf}} }} }}
{{Collapse|title='''Mid High'''|content=
{{Flatlist|
* {{InvLink|Hay Bale}}
* {{InvLink|Brown Mushroom Block}}
* {{InvLink|Red Mushroom Block}}
* {{InvLink|Nether Wart Block}}
* {{InvLink|Warped Wart Block}}
* {{InvLink|Flowering Azalea}}
* {{ItemLink|Bread}}
* {{ItemLink|Baked Potato}}
* {{ItemLink|Cookie}}
* {{InvLink|Torchflower}}
* {{InvLink|Pitcher Plant}} }} }}
'''High''' {{Flatlist|
* {{InvLink|Cake}}
* {{ItemLink|Pumpkin Pie}} }} }}
{{infobox row|Package|{{cd|net.minecraft.world.level.block}}}}}}


'''bootStrap()'''
If the [[Minecraft:anvil]] input is an enchanted book, it will initially consider any [[Minecraft:enchantment]] as compatible. However, if the enchantment is the same or does it [[Minecraft:Enchanting_table_mechanics#Conflicting_enchantments|conflict]] with any enchantment in the current list of enchantments in the result, it will no longer be considered compatible.


Define compostable items. In other words, items that, when interacting with the [[Minecraft:composter]], can increase its level and they can be used with a [[Minecraft:hopper]], [[Minecraft:minecart with hopper]], and [[Minecraft:dropper]] to increase the composter level.  
In other words, it's as if the enchanted book were in [[Minecraft:Enchantment_definition#JSON_format|{{cd|supported_items}}]] for all enchantment definition, when we consider the anvil.


When the composting is at {{cd|level}} 0, all of these items will always increase its {{cd|level}} to 1.
{{-}}


If the composting {{cd|level}} are between 1 and 7, the chance of increasing its {{cd|level}} depends on the item's group. For the low, low mid, mid, mid high, and higt groups, the chances are 30%, 50%, 65%, 85% and 100% respectively. After interacting:
=== CartographyTableMenu ===
# If increasing the level: produce the [[Minecraft:game event]] {{cd|block_change}};
# Player the [[Minecraft:sound event]] composter fill success ({{sound|{{cd|block.composter.fill_success}}|Composter fill success1.ogg|Composter fill success2.ogg|Composter fill success3.ogg|Composter fill success4.ogg}}) if increasing the level, or the sound event composter fill ({{sound|{{cd|block.composter.fill}}|Composter fill1.ogg|Composter fill2.ogg|Composter fill3.ogg|Composter fill4.ogg}});
# Send composter [[Minecraft:Particles (Java Edition)|particles]];
# Increases the item {{cd|used}} [[Minecraft:statistic]] by one;
# Shrink one item of the item stack;
# Return {{cd|SUCCESS}}.


When the composter reaches {{cd|level}} 7, it will automatically change to {{cd|level}} 8 in 20 ticks. Interacting with it will have no effect, but return 'success' iff the item is compostable.
{{Infobox hardcoded item property|class=CartographyTableMenu|Paper|Empty Map|Glass Pane|pac=world.inventory|Inv=t}}


Compostable items can be place through the top face of a compost, with {{cd|level}} < 7, using a hopper, minecart with hopper, and dropper. When an item is placed in the composter, try to increase the level, the following occurs 1, 2, and 3 above and it is removed from the internal slot.
'''mayPlace({{Tooltip|...|ItemStack itemStack}})'''
{{hatnote|Defined when adding slot 1, within the {{cd|CartographyTableMenu({{tooltip|...|int containerId, Inventory inventory, ContainerLevelAccess access}})}} method.}}


When a [[Minecraft:villager]] inserts an item stack into the composter, it will only take effect if it is a compostable item (which is always the case since the items used are also hardcoded, see {{Slink||WorkAtComposter}}) and the composter is {{cd|level}} < 7. When it takes effect, it attempts to increase the level and occurs 1, 2, and 5 above.
Returns true only if it is one of the three items listed above. Used to determine which items can be placed in the [[Minecraft:Java_Edition_protocol/Inventory#Cartography_Table|slot 1]] of the [[Minecraft:cartography table]].


When interacting with the composter at {{cd|level}} 8, the last level, regardless of what the player has on hand, the [[Minecraft:bone meal]] will be extracted and the composter will return to {{cd|level}} 0.
'''setupResultSlot({{tooltip|...|ItemStack mapStack, ItemStack additionalStack, ItemStack resultStack}})'''


=== OutputContainer ===
Used to define the result item of the cartography table:


{{Infobox hip|class=OutputContainer|Bone Meal|pac=world.level.block|out={{cd|ComposterBlock}}}}
* If the {{cd|''mapStack''}} (item in slot 0) does not have a {{cd|''mapData''}} (data associated with its {{DCL|map_id}} component), it will not yield any results.


'''canTakeItemThroughFace({{Tooltip|...|final int slot, final ItemStack itemStack, final Direction direction}})'''
* If it's paper and the {{cd|''mapData''}} is not locked and has a scale less than 4, the resulting is one copy of the {{cd|''mapStack''}} with the {{DCL|map_post_processing}} component set to 1 (SCALE).


Returns whether a {{cd|level}} 8 [[Minecraft:composter]] face can move an item to a [[Minecraft:hopper]] or [[Minecraft:minecart with hopper]].
* If it's glass and the {{cd|''mapData''}} is not locked, the resulting is one copy of the {{cd|''mapStack''}} with the {{cd|map_post_processing}} component set to 0 (LOCK).


Returns true iff the face is dowm, the item to be removed is a bone meal, and no item has been removed from the container.
* If it's empty map, the resulting is ''two'' copy of the {{cd|''mapStack''}}.


In practice, requiring the item to be bone meal doesn't change anything, as this is the only item that can be in the simple container, and this is hardcoded when generating the simple container. Although this may change with [[Minecraft:mods]] or future updates (such as composter extraction being controlled by a [[Minecraft:loot table]]).
''Note'': It's possible to use the cartography table regardless of the {{cd|''mapStack''}} ID; it only needs to have the {{cd|map_id}} component with data. However, when retrieving an item that the ID isn't filled_map with the {{cd|map_post_processing}} component, the game crashes<ref>{{bug|MC-306074}}</ref>. However, using the empty map still works for item duplication.


Whenever a hopper is enabled and not full, it attempts to remove an item from the composter; even if it fails, the composter is emptied. For example, a hopper with a single redstone in each slot under a composter will empty it but won't extract anything.<ref>{{Bug|MC-175090}}</ref><!--I had done some tests before and discovered that placing a renamed bone meal in a hopper causes it to empty the composter.
'''quickMoveStack({{Tooltip|...|Player player, int slotIndex}})'''
So I thought this was a bug related to the bone meal, where it had the property of making a hopper empty a composter. But no, any empty hopper does this, regardless of the items in the slot. The part of the code that tests if the item is bone meal, I thought it was testing if the item in the hopper slot was bone meal and that this would cause the bug.
Rereading the code now I saw that the bug was bigger than I thought and that the bone meal testing property was more useless than I thought. --Aloi4 -->


=== LightBlock ===
When using the quick click ({{Keys|Shift}} + click) in the inventory with the cartography table menu is open, it attempts to move these items to slot 1. Notes:
* If the item has the {{cd|map_id}} component, it attempts to move it to slot 0 and does not go to slot 1 (even if it fails to go to slot 0).
* This prevents quick clicking from moving them between [[Minecraft:Inventory#Slots|storage slots]] and hotbar slots and vice versa, when the cartography table menu is open. Even if the itens fails to move to the slot 1.


{{Infobox hip|class=LightBlock|Items={{InvLink|Light|link=Light (block)}}|pac=world.level.block}}
{{-}}
=== EnchantmentMenu ===
{{Infobox hardcoded item property|class=EnchantmentMenu|Book|Lapis Lazuli|pac=world.inventory}}


'''getShape({{tooltip|...|BlockState state, BlockGetter level, BlockPos pos, CollisionContext context}})'''
{{ItemSprite|lapis lazuli}} '''mayPlace({{Tooltip|...|ItemStack itemStack}})'''
{{hatnote|Defined when adding slot 1, within the {{cd|EnchantmentMenu({{tooltip|...|int containerId, Inventory inventory, ContainerLevelAccess access}})}} method.}}
 
Only lapis lazuli can be placed in the [[Minecraft:Java_Edition_protocol/Inventory#Enchantment|slot 1]] of [[Minecraft:enchantment table]].
 
{{ItemSprite|book}} '''clickMenuButton({{tooltip|...|Player player, int buttonId}})'''


Define the [[Minecraft:light (block)|light]] block [[Minecraft:Hitbox#Interaction_box|shape]]. The shape depends on the context; if the player is holding the light item, it will be a full block; otherwise, it will be empty.
Right before a book is enchanted on an enchantment table, it becomes an [[Minecraft:enchanted book]].


=== PowderSnowBlock ===
{{ItemSprite|book}} '''getEnchantmentList({{tooltip|...|RegistryAccess access, ItemStack itemStack, int slot, int enchantmentCost}})'''


{{Infobox hip|class=PowderSnowBlock|Leather Boots|pac=world.level.block}}
When creating a list of enchantments to enchant a book on an enchantment table, remove one enchantment at random if the list has more than one enchantment.


'''canEntityWalkOnPowderSnow({{tooltip|...|Entity entity}})'''
{{ItemSprite|lapis lazuli}} '''quickMoveStack({{Tooltip|...|Player player, int slotIndex}})'''


Used in {{cd|getCollisionShape(...)}} to help test whether the [[Minecraft:powder snow]] has a full block [[Minecraft:collision box]].
When using the quick click ({{key|Shift}} + click) in the inventory with the enchantment table menu is open, it attempts to move the lapis lazuli to slot 1. This prevents quick clicking from moving the lapis lazuli to slot 0.


Returns true iff the entity is in {{tag link|entity type|powder_snow_walkable_mobs}} tag or the entity is a living entity and has a leather border in the {{cd|feed}} slot.
{{-}}
=== FurnaceFuelSlot ===
{{Infobox hardcoded item property|class=FurnaceFuelSlot|Bucket|pac=world.inventory}}


By {{cd|getCollisionShape(...)}} the powder snow's collision box is empty by default, but it can change depending on the context:
'''isBucket({{Tooltip|...|ItemStack itemStack}})'''
* If it is being placed or the context does not have an entity: empty
* If the entity is falling for more than 2.5 blocks: A column of 16×14.4×16 pixels
* If the entity is a falling block: Full block (16×16×16)
* If the entity is above the block, isn't [[Minecraft:sneaking]] and {{cd|canEntityWalkOnPowderSnow(...)}}: Full block (16×16×16)


=== PumpkinBlock ===
Check if the item is a bucket. Used twice to determine the behavior of the fuel slot (the lower left slot in blocks [[Minecraft:furnace]], [[Minecraft:smoker]], and [[Minecraft:blast furnace]]):


{{Infobox hip|class=PumpkinBlock|Shears|pac=world.level.block}}
* In {{cd|mayPlace(...)}}, to allow the bucket to be used in the fuel slot, even if it is not [[Minecraft:fuel]] (i.e it does has not the component {{DCL|cooking_fuel}}).
** This does not change the quick move. Because what is tested to determine if an item can have a quick move to the fuel slot is whether it is a fuel.
* In {{cd|getMaxStackSize(...)}}, to limit the maximum number of buckets in the fuel slot to one.


'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult}})'''
{{-}}


When using a shears on a [[Minecraft:pumpkin]], instead of returning 'try_with_empty_hand' like other items, returning 'success' and occurs:
=== GrindstoneMenu ===
* Set {{cd|''direction''}} as the direction of the interaction or in the opposite direction from the player if the interaction occurred on the y-axis,
{{Infobox hardcoded item property|class=GrindstoneMenu|Enchanted Book|pac=world.inventory}}
* Drop the [[Minecraft:loot table]] {{cd|carve/pumpkin}} (4x {{ItemLink|Pumpkin Seeds}}), in {{cd|''direction''}},
* Player the [[Minecraft:sound event]] pumpink carve ({{sound|{{cd|block.pumpkin.carve}}|Pumpkin carve1.ogg|Pumpkin carve2.ogg}}).
* Convert the pumpkin into a [[Minecraft:carved pumpkin]] with the face given by {{cd|''direction''}},
* Reduces the [[Minecraft:durability]] of the shear by 1,
* Produce the [[Minecraft:game event]] {{cd|shear}},
* Increases the item {{cd|used}} [[Minecraft:statistic]] by one.


===RespawnAnchorBlock===
'''removeNonCursesFrom({{Tooltip|...|ItemStack item}})'''


{{Infobox hip|class=RespawnAnchorBlock|Glowstone|Inv=t|pac=world.level.block}}
When using an enchanted book on the [[Minecraft:grindstone]], after all non-curses enchantments have been removed, if the enchanted book does not retain an (curse) enchantment, it is transmuted into a [[Minecraft:book]].


'''isRespawnFuel({{Tooltip|...|ItemStack itemInHand}})'''
{{-}}
=== BeehiveBlock ===
{{Infobox hardcoded item property|class=BeehiveBlock|Shears|Glass Bottle|pac=world.level.block}}


Used in {{cd|useItemOn(...)}} to test if the item is fuel for the [[Minecraft:respawn anchor]]. Returns true iff the item is a glowstone.
'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult(ItemStack item}})'''


In {{cd|useOn(...)}}, when use the glowstone on the respawn anchor with {{cd|charge}} < 4, the following occurs:
It encodes the interaction of an item on a [[Minecraft:bee nest]] and on a [[Minecraft:beehive]].
* Increase the anchor's {{cd|charge}} by one
* Produce the [[Minecraft:game event]] {{cd|block_change}},
* Player the [[Minecraft:sound event]] respawn anchor charge ({{sound|{{cd|block.respawn_anchor.charge}}|Respawn anchor charge1.ogg|Respawn anchor charge2.ogg|Respawn anchor charge3.ogg}}),
* Shrink the item stack by one,
* Retunr {{cd|SUCCESS}}


If the player has glowstone in their offhand but in their mainhand, and is interacting with the mainhand, and the {{cd|charge}} is less than 4, returns 'pass' instead of 'try with empty hand'. This prevents the setting respawn and exploding at the anchor at the same time.
If the honey level is less than 5, or the item is not one of those listed below, the interaction returns 'try with empathy hand', otherwise returns success. The interaction depends on the item:


===SweetBerryBushBlock===
* If the item is a shears, apply in the following order:
{{Infobox hip|class=SweetBerryBushBlock|Bone Meal|pac=world.level.block}}
** drop the loot table {{cd|harvest/beehive}} (3x {{ItemLink|Honeycomb}});
** the [[Minecraft:sound event]] beehive shear ({{cd|block.beehive.shear}}) is played;
** causes one damage from the shear;
** and produce the game event {{cd|shear}}.
* If is glass bottle, apply in the following order:
** shrink the item by one;
** the sound event bottle fill ({{cd|item.bottle.fill}}) is played;
** give the player a [[Minecraft:honey bottle]], placing it in their hand if it's empty; otherwise, try placing it in their inventory. If that's not possible, the honey bottle is dropped;
** and produce the game event {{cd|fluid_pickup}}.


'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult}})'''
For both items, after that, increases the item used [[Minecraft:statistic]] by one and test if the beehive is in the smoke. If not, proceed in the following order:
* if there is at least one bee in the hive, each [[Minecraft:bee]] in a 17x13x17 area around the hive becomes aggressive toward a random player in the same area;
* all the bees leave the hive and become aggressive toward the player.
Then, even if the beehive is in the smoke, the honey level is reduced to zero.


If the item stack is a bone meal and the [[Minecraft:sweet berry bush]]'s {{cd|age}} is not 3, the maximum, then return 'pass' instead of 'try with empty hand'. This causes the bone meal effect to be applied (see {{Slink||useOn(...)}} and {{Slink||BoneMealItem}}) and prevents the attempt to harvest the sweet berry bush.
{{-}}


===TntBlock===
=== CandleCakeBlock ===
 
{{Infobox hardcoded item property|class=CandleCakeBlock|Flint and Steel|Fire Charge|pac=world.level.block}}
{{Infobox hip|class=TntBlock|Flint and Steel|Fire Charge|pac=world.level.block}}


'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult}})'''
'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult}})'''


If the item used in [[Minecraft:TNT]] is one of these:
When interacting with an flint and steel or a fire charge on a [[Minecraft:candle cake|cake with candle]] or a cake with dyed candle, the method immediately returns {{cd|PASS}}. The effect of these items on the cake is determined by {{cd|useOn(...)}} in its classes (see {{slink||useOn(...)}}, {{slink||FlintAndSteelItem}} and {{slink||FireChargeItem}}).
* If the {{gmr|tnt_explodes}} game rule is {{cd|false}}:
** Send in [[Minecraft:action bar]] "TNT explosion are disabled"  ({{cd|&#123;"translate":"block.minecraft.tnt.disabled"&#125;}}),
** Return {{cd|PASS}}
* If the game rule is {{cd|true}}:
** Summon a [[Minecraft:primed TNT]] (with {{cd|fuse}} 80) in the block's position,
** Play the [[Minecraft:sound event]] tnt primed ({{Sound|{{cd|entity.tnt.primed}}|Fuse.ogg}}),
** Produce the [[Minecraft:game event]] {{cd|prime_fuse}},
** Set air block at the block's position,
** If the item is [[Minecraft:flint and steel]], reduces the [[Minecraft:durability]] by 1, else, shrink the item stack by one,
** Increase the item used statistic by one,
** Return {{cd|SUCCESS}}.


Otherwise, it returns 'try with empty hand' (but currently TNT has no effect on {{cd|useWithoutItem(...)}}, thus is the same that return 'pass').
This also prevents the player from trying to eat the cake, unlike all other items. Note that with these items, the player cannot eat the cake even if the candle is already lit.
{{-}}
=== ChiseledBookShelfBlock ===
{{Infobox hardcoded item property|class=ChiseledBookShelfBlock|Enchanted Book|pac=world.level.block}}


===TripWireBlock===
'''addBook({{tooltip|...|Level level, BlockPos pos, Player player, ChiseledBookShelfBlockEntity bookshelfBlock, ItemStack itemStack, int slot}})'''
{{Infobox hip|class=TripWireBlock|Shears|pac=world.level.block}}


'''playerWillDestroy({{Tooltip|...|Level level, BlockPos pos, BlockState state, Player player}})'''
When adding an enchanted book to the [[Minecraft:chiseled bookshelf]], use [[Minecraft:sound event]] {{cd|block.chiseled_bookshelf.insert.enchanted}} ({{sound||Chiseled bookshelf insert enchanted1.ogg
|Chiseled bookshelf insert enchanted2.ogg
|Chiseled bookshelf insert enchanted3.ogg
|Chiseled bookshelf insert enchanted4.ogg}}) instead of {{cd|block.chiseled_bookshelf.insert}} ({{sound||Chiseled bookshelf insert1.ogg
|Chiseled bookshelf insert2.ogg
|Chiseled bookshelf insert3.ogg
|Chiseled bookshelf insert4.ogg}}).


When a player destroys a [[Minecraft:tripwire]], just before it is removed, if the item in mainhand is a shears:
Note: The items that can be added to the chiseled bookshelf are controlled by the tag {{tag link|item|bookshelf_books}}, therefore it is not a hardcoded property.
* Set the tripwire's {{cd|disarmed}} to true and update the adjacent blocks,
* Produce the [[Minecraft:game event]] {{cd|shear}}.


After the tripwire is broken, it updates the neighboring blocks as if it still existed and was {{cd|powered}} true. This causes the {{Tooltip|connected|up to 40 blocks}} [[Minecraft:tripwire hook]] to recalculate its stats, considering this wire as "wireSource". If {{cd|disarmed}} is false, the tipwire hook will set its {{cd|powered}} to true (because has a connected tripwire that is {{cd|powered}} and not {{cd|disarmed}}). If {{cd|disarmed}} is true, because the disarmed tripwire is the "wireSource", it will set the tripwire hood's {{cd|attempt}} to false, and consequently set {{cd|powered}} to false. In both cases, because there is a "wireSource", the tripwire hood will be recalculated its stats at 10 ticks (this time without a "wireSource", and probably resulting in both {{cd|attempt}} and {{cd|powered}} false).
'''removeBook({{tooltip|...|Level level, BlockPos pos, Player player, ChiseledBookShelfBlockEntity bookshelfBlock, int slot}})'''
 
When remove an enchanted book to the chiseled bookshelf, use sound event {{cd|block.chiseled_bookshelf.pickup.enchanted}} ({{sound||Chiseled bookshelf pickup enchanted1.ogg
|Chiseled bookshelf pickup enchanted2.ogg
|Chiseled bookshelf pickup enchanted3.ogg}}) instead of {{cd|block.chiseled_bookshelf.pickup}} ({{sound||Chiseled bookshelf pickup1.ogg
|Chiseled bookshelf pickup2.ogg
|Chiseled bookshelf pickup3.ogg}}).
{{-}}
=== OutputContainer ===
 
{{Infobox hardcoded item property|class=OutputContainer|Bone Meal|pac=world.level.block|out={{cd|ComposterBlock}}}}


In other words, unless there are other tripwire interfering:
'''canTakeItemThroughFace({{Tooltip|...|final int slot, final ItemStack itemStack, final Direction direction}})'''
* Destroy a tripwire without shears: the connected tripwire hooks immediately set {{cd|powered}} true and remain {{cd|attempt}} true. After 10 ticks they set {{cd|powered}} and {{cd|attempt}} to false.
* Destroy a tripwire with shears: the tripwire hooks immediately set {{cd|attempt}} to false and remain {{cd|powered}} false.


===WeatheringCopperGolemStatueBlock===
Returns whether a {{cd|level}} 8 [[Minecraft:composter]] face can move an item to a [[Minecraft:hopper]] or [[Minecraft:minecart with hopper]].
{{Infobox hip|class=WeatheringCopperGolemStatueBlock|Honeycomb|pac=world.level.block}}


'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult(ItemStack item}})'''
Returns true iff the face is dowm, the item to be removed is a bone meal, and no item has been removed from the container.


When using an item that is not in {{tag link|item|axes}} in the [[Minecraft:copper golem statue]], [[Minecraft:exposed copper golem statue]], [[Minecraft:weathered copper golem statue]], or [[Minecraft:oxidized copper golem statue]]:
In practice, requiring the item to be bone meal doesn't change anything, as this is the only item that can be in the simple container, and this is hardcoded when generating the simple container. Although this may change with [[Minecraft:mods]] or future updates (such as composter extraction being controlled by a [[Minecraft:loot table]]).
* If the item is a honeycomb, return {{cd|PASS}}. Thus, the use of the item will depend on the {{cd|HoneycombItem.useOn(...)}}  (see {{Slink||useOn(...)}} and {{Slink||HoneycombItem}})
* Else, update the golem pose and return {{cd|SUCCESS}}.


If the item is in the tag {{cd|#axes}}:
Whenever a hopper is enabled and not {{Tooltip|full|all slots with full packs}}, it attempts to remove an item from the composter; even if it fails, the composter is emptied. For example, a hopper with a single redstone in each slot under a composter will empty it but won't extract anything.<ref>{{Bug|MC-175090}}</ref><!--I had done some tests before and discovered that placing a renamed bone meal in a hopper causes it to empty the composter.
* If the block is (unaffected) copper golem statue it will try to generate a copper golem, if successful it will return {{cd|SUCCESS}}.
So I thought this was a bug related to the bone meal, where it had the property of making a hopper empty a composter. But no, any empty hopper does this, regardless of the items in the slot. The part of the code that tests if the item is bone meal, I thought it was testing if the item in the hopper slot was bone meal and that this would cause the bug.
* Else, return {{cd|PASS}}.
Rereading the code now I saw that the bug was bigger than I thought and that the bone meal testing property was more useless than I thought. --Aloi4 -->
{{-}}


===WitherSkullBlock===
=== LightBlock ===
{{Infobox hip|class=WitherSkullBlock|Wither Skeleton Skull|Inv=t|pac=world.level.block}}


'''canSpawnMob({{Tooltip|...|Level level, BlockPos pos, ItemStack itemStack}})'''
{{Infobox hardcoded item property|class=LightBlock|Items={{InvLink|Light|link=Light (block)}}|pac=world.level.block}}


Used to test if an item to be [[Minecraft:dispenser|dispensed]] can be helpful in spawning the [[Minecraft:wither]]. For the item to be dispensed as a block, it is necessary that, in addition to this method returning true, that the {{cd|''pos''}} (the target where the dispenser attempts to place the block) is [[Minecraft:air]], cave air or void air.
'''getShape({{tooltip|...|BlockState state, BlockGetter level, BlockPos pos, CollisionContext context}})'''


Returns true if all the points below occur:
Define the [[Minecraft:light (block)|light]] block [[Minecraft:Hitbox#Interaction_box|shape]]. The shape depends on the context; if the player is holding the light item, it will be a full block; otherwise, it will be empty.
* The item is a wither skeleton skull.
{{-}}
* The y-axis of the {{cd|''pos''}} is at least two blocks above the dimension y-minimum.
=== PowderSnowBlock ===  
* The difficulty is not peaceful.
* In any of the three axes and in any of the four rotations forms the pattern below, where some {{BlockSprite|Red Wool}} is the {{cd|''pos''}} (it can have any block in {{BlockSprite|Red Wool}}), {{BlockSprite|Soul Sand}} is a block in the tag {{tag link|block|wither_summon_base_blocks}} and {{BlockSprite|Air}} is air, cave air or void air.
{{BlockGrid|scale=2|w=+Red wool|s=Soul Sand?Block_tag_(Java_Edition)#wither_summon_base_blocks|a=Air| www| sss| asa}}


Requiring the item to be a wither skeleton skull is circular, since only the wither skeleton skull has the behavior in the dispenser to try to spawn the wither, and this behavior is also hardcoded (see {{Slink||DispenseItemBehavior}}). However, this property may be effective if in the future it becomes possible to customize item behaviors in the dispenser.<!--This section documents part of the skull's property in DispenseItemBehavior that will not be documented in DispenseItemBehavior-->
{{Infobox hardcoded item property|class=PowderSnowBlock|Leather Boots|pac=world.level.block}}


===AbstractFurnaceBlockEntity===
'''canEntityWalkOnPowderSnow({{tooltip|...|Entity entity}})'''
{{Infobox hip|class=AbstractFurnaceBlockEntity|Wet Sponge|Bucket|Water Bucket|Inv=t|pac=world.level.block.entity}}


Define the behavior of [[Minecraft:block entity]] associated with a [[Minecraft:furnace]], [[Minecraft:blast furnace]] and [[Minecraft:smoker]].
Used in {{cd|getCollisionShape(...)}} to help test whether the [[Minecraft:powder snow]] has a full block [[Minecraft:collision box]].


{{InvLink|Wet Sponge|link=None|text=}} {{ItemSprite|Bucket}} '''burn({{tooltip|...|NonNullList&lt;ItemStack&gt; items, ItemStack inputItemStack, ItemStack result}})'''
Returns true iff the entity is in {{tag link|entity type|powder_snow_walkable_mobs}} tag or the entity is a living entity and has a leather border in the {{cd|feed}} slot.


Used at the end of the [[Minecraft:smelting]] process, to add the result to [[Minecraft:Java_Edition_protocol/Inventory#Furnace|output slot]] (slot 2).
By {{cd|getCollisionShape(...)}} the powder snow's collision box is empty by default, but it can change depending on the context:
* If it is being placed or the context does not have an entity: empty
* If the entity is falling for more than 2.5 blocks: A column of 16×14.4×16 pixels
* If the entity is a falling block: Full block (16×16×16)
* If the entity is above the block, isn't [[Minecraft:sneaking]] and {{cd|canEntityWalkOnPowderSnow(...)}}: Full block (16×16×16)
{{-}}
=== PumpkinBlock ===


After adding the result to output slot, if the item in ingredient slot (slot 0) is a wet sponge and the item in fuel slot (slot 1) is a bucket, set a water bucket in fuel slot.
{{Infobox hardcoded item property|class=PumpkinBlock|Shears|pac=world.level.block}}


After that, shrink 1 item from ingredient slot.
'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult}})'''


{{ItemSprite|Bucket}} {{ItemSprite|Water Bucket}} '''canTakeItemThroughFace({{tooltip|...|int slot, ItemStack itemStack, Direction direction}})'''
When using a shears on a [[Minecraft:pumpkin]], instead of returning 'try_with_empty_hand' like other items, returning 'success' and occurs:
* Set {{cd|''direction''}} as the direction of the interaction or in the opposite direction from the player if the interaction occurred on the y-axis,
* Drop the [[Minecraft:loot table]] {{cd|carve/pumpkin}} (4x {{ItemLink|Pumpkin Seeds}}), in {{cd|''direction''}},
* Player the [[Minecraft:sound event]] pumpink carve ({{sound|{{cd|block.pumpkin.carve}}|Pumpkin carve1.ogg|Pumpkin carve2.ogg}}).
* Convert the pumpkin into a [[Minecraft:carved pumpkin]] with the face given by {{cd|''direction''}},
* Reduces the [[Minecraft:durability]] of the shear by 1,
* Produce the [[Minecraft:game event]] {{cd|shear}},
* Increases the item {{cd|used}} [[Minecraft:statistic]] by one.
{{-}}
===RespawnAnchorBlock===


Tests whether the container item can be take by a [[Minecraft:hopper]] or [[Minecraft:minecart with hopper]].
{{Infobox hardcoded item property|class=RespawnAnchorBlock|Glowstone|Inv=t|pac=world.level.block}}
Returns true only if the face is the down. If it's the fuel slot (slot 1), the item must also be a bucket or a bucket of water.


Note: the down face only gives access to fuel and output slots (slots 1 and 2), so only items from the slots can be take.
'''isRespawnFuel({{Tooltip|...|ItemStack itemInHand}})'''


{{ItemSprite|Bucket}} '''canPlaceItem({{tooltip|...|int slot, ItemStack itemStack}})'''
Used in {{cd|useItemOn(...)}} to test if the item is fuel for the [[Minecraft:respawn anchor]]. Returns true iff the item is a glowstone.


Tests whether a hopper, minecart with hopper or a [[Minecraft:dropper]] can place item in the container.
In {{cd|useOn(...)}}, when use the glowstone on the respawn anchor with {{cd|charge}} < 4, the following occurs:
* Increase the anchor's {{cd|charge}} by one
* Produce the [[Minecraft:game event]] {{cd|block_change}},
* Player the [[Minecraft:sound event]] respawn anchor charge ({{sound|{{cd|block.respawn_anchor.charge}}|Respawn anchor charge1.ogg|Respawn anchor charge2.ogg|Respawn anchor charge3.ogg}}),
* Shrink the item stack by one,
* Retunr {{cd|SUCCESS}}


It always returns true for ingredient slot (slot 0) and always returns false for output slots (slot 2).
If the player has glowstone in their offhand but in their mainhand, and is interacting with the mainhand, and the {{cd|charge}} is less than 4, returns 'pass' instead of 'try with empty hand'. This prevents the setting respawn and exploding at the anchor at the same time.
{{-}}
===SweetBerryBushBlock===
{{Infobox hardcoded item property|class=SweetBerryBushBlock|Bone Meal|pac=world.level.block}}


For fuel slot (slot 1), it returns true if the item is fuel (see {{slink||FuelValues}}) or if the item is a bucket but there is no bucket already in the slot.
'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult}})'''


Note: the up face only gives access to ingredient slot (slot 0), and the side faces only give access to fuel slot (slot 1).
If the item stack is a bone meal and the [[Minecraft:sweet berry bush]]'s {{cd|age}} is not 3, the maximum, then return 'pass' instead of 'try with empty hand'. This causes the bone meal effect to be applied (see {{Slink||useOn(...)}} and {{Slink||BoneMealItem}}) and prevents the attempt to harvest the sweet berry bush.
{{-}}
===TntBlock===


===BrewingStandBlockEntity===
{{Infobox hardcoded item property|class=TntBlock|Flint and Steel|Fire Charge|pac=world.level.block}}
{{Infobox hip|class=BrewingStandBlockEntity|Potion|Splash Potion|Lingering Potion|Glass Bottle|pac=world.level.block.entity}}


Define the behavior of [[Minecraft:block entity]] associated with a [[Minecraft:brewing stand]].
'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult}})'''


'''canPlaceItem({{tooltip|...|int slot, ItemStack itemStack}})'''
If the item used in [[Minecraft:TNT]] is one of these:
* If the {{gmr|tnt_explodes}} game rule is {{cd|false}}:
** Send in [[Minecraft:action bar]] "TNT explosion are disabled"  ({{cd|&#123;"translate":"block.minecraft.tnt.disabled"&#125;}}),
** Return {{cd|PASS}}
* If the game rule is {{cd|true}}:
** Summon a [[Minecraft:primed TNT]] (with {{cd|fuse}} 80) in the block's position,
** Play the [[Minecraft:sound event]] tnt primed ({{Sound|{{cd|entity.tnt.primed}}|Fuse.ogg}}),
** Produce the [[Minecraft:game event]] {{cd|prime_fuse}},
** Set air block at the block's position,
** If the item is [[Minecraft:flint and steel]], reduces the [[Minecraft:durability]] by 1, else, shrink the item stack by one,
** Increase the item used statistic by one,
** Return {{cd|SUCCESS}}.


Tests whether a [[Minecraft:hopper]], [[Minecraft:minecart with hopper]] or [[Minecraft:dropper]] can place item in the container.
Otherwise, it returns 'try with empty hand' (but currently TNT has no effect on {{cd|useWithoutItem(...)}}, thus is the same that return 'pass').
{{-}}
===TripWireBlock===
{{Infobox hardcoded item property|class=TripWireBlock|Shears|pac=world.level.block}}


* If it's [[Minecraft:Java_Edition_protocol/Inventory#Brewing_Stand|slot 3]], it returns if the item is a potion brewing ingredient (see {{slink||PotionBrewing}}),
'''playerWillDestroy({{Tooltip|...|Level level, BlockPos pos, BlockState state, Player player}})'''
* If it's slot 4, it return true if  the item is in the tag {{Tag link|item|brewing fuel}},
* If it's a potion slot (slot 0, 1 or 2), return true if the item is a potion, splash potion, lingering potion, or a glass bottle and the slot is empty


Note: the up face only gives access to slot 3; the side faces only give access to slots 0, 1, 2 and 4; and the down face only give access to slots 0, 1, 2 and 3.
When a player destroys a [[Minecraft:tripwire]], just before it is removed, if the item in mainhand is a shears:
* Set the tripwire's {{cd|disarmed}} to true and update the adjacent blocks,
* Produce the [[Minecraft:game event]] {{cd|shear}}.


{{ItemSprite|Glass Bottle}} '''canTakeItemThroughFace({{tooltip|...|int slot, ItemStack itemStack, Direction direction}})'''
After the tripwire is broken, it updates the neighboring blocks as if it still existed and was {{cd|powered}} true. This causes the {{Tooltip|connected|up to 40 blocks}} [[Minecraft:tripwire hook]] to recalculate its stats, considering this wire as "wireSource". If {{cd|disarmed}} is false, the tipwire hook will set its {{cd|powered}} to true (because has a connected tripwire that is {{cd|powered}} and not {{cd|disarmed}}). If {{cd|disarmed}} is true, because the disarmed tripwire is the "wireSource", it will set the tripwire hood's {{cd|attempt}} to false, and consequently set {{cd|powered}} to false. In both cases, because there is a "wireSource", the tripwire hood will be recalculated its stats at 10 ticks (this time without a "wireSource", and probably resulting in both {{cd|attempt}} and {{cd|powered}} false).


Tests whether the item in the container can be take by a hopper or minecart with hopper.
In other words, unless there are other tripwire interfering:
* Destroy a tripwire without shears: the connected tripwire hooks immediately set {{cd|powered}} true and remain {{cd|attempt}} true. After 10 ticks they set {{cd|powered}} and {{cd|attempt}} to false.
* Destroy a tripwire with shears: the tripwire hooks immediately set {{cd|attempt}} to false and remain {{cd|powered}} false.
{{-}}
===WeatheringCopperGolemStatueBlock===
{{Infobox hardcoded item property|class=WeatheringCopperGolemStatueBlock|Honeycomb|pac=world.level.block}}
 
'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult(ItemStack item}})'''


Returns true only if the slot is not the slot 3, or if the slot is 3 and the item is a glass bottle.  
When using an item that is not in {{tag link|item|axes}} in the [[Minecraft:copper golem statue]], [[Minecraft:exposed copper golem statue]], [[Minecraft:weathered copper golem statue]], or [[Minecraft:oxidized copper golem statue]]:
* If the item is a honeycomb, return {{cd|PASS}}. Thus, the use of the item will depend on the {{cd|HoneycombItem.useOn(...)}}  (see {{Slink||useOn(...)}} and {{Slink||HoneycombItem}})
* Else, update the golem pose and return {{cd|SUCCESS}}.


This was probably intended to take the glass bottle that could be obtained by using a single [[Minecraft:dragon's breath]] in slot 3, however, due to a bug, the craft remainder doesn't work in this situation{{note|name=a}}. Currently, it's only possible to place a glass bottle in slot 3 via command (like {{cmd|/item}}).
If the item is in the tag {{cd|#axes}}:
* If the block is (unaffected) copper golem statue it will try to generate a copper golem, if successful it will return {{cd|SUCCESS}}.
* Else, return {{cd|PASS}}.
{{-}}
===WitherSkullBlock===
{{Infobox hardcoded item property|class=WitherSkullBlock|Wither Skeleton Skull|Inv=t|pac=world.level.block}}


Note: The down face not give access to slot 4, since the hoppers only try to take items from the down face, they should never take items from slot 4.
'''canSpawnMob({{Tooltip|...|Level level, BlockPos pos, ItemStack itemStack}})'''


=== DecoratedPotPatterns ===
Used to test if an item to be [[Minecraft:dispenser|dispensed]] can be helpful in spawning the [[Minecraft:wither]]. For the item to be dispensed as a block, it is necessary that, in addition to this method returning true, that the {{cd|''pos''}} (the target where the dispenser attempts to place the block) is [[Minecraft:air]], cave air or void air.
{{Infobox hip|class=DecoratedPotPatterns|Brick|Angler Pottery Sherd|Archer Pottery Sherd|Arms Up Pottery Sherd|Blade Pottery Sherd|Brewer Pottery Sherd|Burn Pottery Sherd|Danger Pottery Sherd|Explorer Pottery Sherd|Flow Pottery Sherd|Friend Pottery Sherd|Guster Pottery Sherd|Heart Pottery Sherd|Heartbreak Pottery Sherd|Howl Pottery Sherd|Miner Pottery Sherd|Mourner Pottery Sherd|Plenty Pottery Sherd|Prize Pottery Sherd|Scrape Pottery Sherd|Sheaf Pottery Sherd|Shelter Pottery Sherd|Skull Pottery Sherd|Snort Pottery Sherd|pac=world.level.block.entity}}
'''{{Tooltip|ITEM_TO_POT_TEXTURE|Map&lt;Item, ResourceKey&lt;DecoratedPotPattern&gt;&gt;}}'''


Associates each item with a decorated pot pattern, which is associated with a texture in {{mono|assets\minecraft\textures\entity\decorated_pot\<assetId>.png}}.
Returns true if all the points below occur:
* The item is a wither skeleton skull.
* The y-axis of the {{cd|''pos''}} is at least two blocks above the dimension y-minimum.
* The difficulty is not peaceful.
* In any of the three axes and in any of the four rotations forms the pattern below, where some {{BlockSprite|Red Wool}} is the {{cd|''pos''}} (it can have any block in {{BlockSprite|Red Wool}}), {{BlockSprite|Soul Sand}} is a block in the tag {{tag link|block|wither_summon_base_blocks}} and {{BlockSprite|Air}} is air, cave air or void air.  
{{BlockGrid|scale=2|w=+Red wool|s=Soul Sand?Block_tag_(Java_Edition)#wither_summon_base_blocks|a=Air| www| sss| asa}}


Used for [[Minecraft:decorated pot]] block model, with the {{DCL|pot_decorations}} component. Used in the {{cd|special}} item model, type [[Minecraft:Items_model_definition#decorated_pot|{{cd|decorated_pot}}]].
Requiring the item to be a wither skeleton skull is circular, since only the wither skeleton skull has the behavior in the dispenser to try to spawn the wither, and this behavior is also hardcoded (see {{Slink||DispenseItemBehavior}}). However, this property may be effective if in the future it becomes possible to customize item behaviors in the dispenser.<!--This section documents part of the skull's property in DispenseItemBehavior that will not be documented in DispenseItemBehavior-->
{{-}}
===AbstractFurnaceBlockEntity===
{{Infobox hardcoded item property|class=AbstractFurnaceBlockEntity|Wet Sponge|Bucket|Inv=t|pac=world.level.block.entity}}


For items that do not have a pattern or when they is empty in one side, the texture {{mono|decorated_pot_side}} is used; therefore, this property currently has no effect on the brick.
Define the behavior of [[Minecraft:block entity]] associated with a [[Minecraft:furnace]], [[Minecraft:blast furnace]] and [[Minecraft:smoker]].


{| class="wikitable"
{{InvLink|Wet Sponge|link=None|text=}} {{ItemSprite|Bucket}} '''burn({{tooltip|...|NonNullList&lt;ItemStack&gt; items, ItemStack inputItemStack, ItemStack result}})'''
!Item !! Pattern !! Asset ID !! Texture
 
|-collapsed collapsible
Used at the end of the [[Minecraft:smelting]] process, to add the result to [[Minecraft:Java_Edition_protocol/Inventory#Furnace|output slot]] (slot 2).
|{{ItemLink|Brick}} || blank || {{mono|decorated_pot_side}} || style="text-align: center" | [[File:Decorated Pot (side texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Angler Pottery Sherd}} || angler || {{mono|angler_pottery_pattern}} || style="text-align: center" | [[File:Angler Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Archer Pottery Sherd}} || archer || {{mono|archer_pottery_pattern}} || style="text-align: center" | [[File:Archer Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Arms Up Pottery Sherd}} || arms_up || {{mono|arms_up_pottery_pattern}}|| style="text-align: center" | [[File:Arms Up Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Blade Pottery Sherd}} || blade || {{mono|blade_pottery_pattern}} || style="text-align: center" | [[File:Blade Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Brewer Pottery Sherd}} || brewer || {{mono|brewer_pottery_pattern}} || style="text-align: center" | [[File:Brewer Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Burn Pottery Sherd}} || burn || {{mono|burn_pottery_pattern}} ||style="text-align: center" | [[File:Burn Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Danger Pottery Sherd}} || danger || {{mono|danger_pottery_pattern}} ||style="text-align: center" | [[File:Danger Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Explorer Pottery Sherd}} || explorer || {{mono|explorer_pottery_pattern}} || style="text-align: center" | [[File:Explorer Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Flow Pottery Sherd}} || flow || {{mono|flow_pottery_pattern}} || style="text-align: center" | [[File:Flow Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Friend Pottery Sherd}} || friend ||  {{mono|friend_pottery_pattern}}||style="text-align: center" | [[File:Friend Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Guster Pottery Sherd}} || guster || {{mono|guster_pottery_pattern}} ||style="text-align: center" | [[File:Guster Pottery Pattern (texture).png|40px|class=pixel-image]]  
|-
|{{ItemLink|Heart Pottery Sherd}} || heart || {{mono|heart_pottery_pattern}} ||style="text-align: center" | [[File:Heart Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Heartbreak Pottery Sherd}} || heartbreak || {{mono|heartbreak_pottery_pattern}}  || style="text-align: center" | [[File:Heartbreak Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Howl Pottery Sherd}} || howl || {{mono|howl_pottery_pattern}}||style="text-align: center" | [[File:Howl Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Miner Pottery Sherd}} || miner || {{mono|miner_pottery_pattern}} ||style="text-align: center" | [[File:Miner Pottery Pattern (texture).png|40px|class=pixel-image]]  
|-
|{{ItemLink|Mourner Pottery Sherd}} || mourner ||{{mono|mourner_pottery_pattern}}|| style="text-align: center" | [[File:Mourner Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Plenty Pottery Sherd}} || plenty || {{mono|plenty_pottery_pattern}} ||style="text-align: center" | [[File:Plenty Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Prize Pottery Sherd}} || prize || {{mono|prize_pottery_pattern}}||style="text-align: center" | [[File:Prize Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Scrape Pottery Sherd}} || scrape || {{mono|scrape_pottery_pattern}}|| style="text-align: center" | [[File:Scrape Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Sheaf Pottery Sherd}} || sheaf || {{mono|sheaf_pottery_pattern}}||style="text-align: center" | [[File:Sheaf Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Shelter Pottery Sherd}} || shelter || {{mono|shelter_pottery_pattern}} ||style="text-align: center" | [[File:Shelter Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Skull Pottery Sherd}} || skull ||  {{mono|skull_pottery_pattern}} ||style="text-align: center" | [[File:Skull Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|{{ItemLink|Snort Pottery Sherd}} || snort || {{mono|snort_pottery_pattern}} ||style="text-align: center" | [[File:Snort Pottery Pattern (texture).png|40px|class=pixel-image]]
|-
|}


===FuelValues===
After adding the result to output slot, if the item in ingredient slot (slot 0) is a wet sponge and the item in fuel slot (slot 1) is a bucket, set a water bucket in fuel slot.
{{Infobox hip|class=FuelValues|Lava Bucket|Blaze Rod|Coal|Charcoal|Bow|Fishing Rod|Wooden Shovel|Wooden Sword||Wooden Spear|Wooden Hoe|Wooden Axe|Wooden Pickaxe|Stick|Bowl|Crossbow|pac=world.level.block.entity}}


'''vanillaBurnTimes({{tooltip|...|HolderLookup.Provider registries, FeatureFlagSet enabledFeatures, int baseUnit}})'''
After that, shrink 1 item from ingredient slot.


Used to set the time and which items can be used as [[Minecraft:fuel]]. Added both directly to items, item tags, and blocks as items (See {{slink||BlockItem}}).
{{ItemSprite|Bucket}} '''canPlaceItem({{tooltip|...|int slot, ItemStack itemStack}})'''


When an item appears twice, for example because it's in a tag, the last value is used, according to the table below.
Tests whether a hopper, minecart with hopper or a [[Minecraft:dropper]] can place item in the container.


Adding any item to tag {{Tag link|item|non_flammable_wood}} causes it to cease being a fuel item.
It always returns true for ingredient slot (slot 0) and always returns false for output slots (slot 2).


Only lava bucket, [[Minecraft:block of coal]], blaze rod, coal, charcoal, [[Minecraft:dried kelp block]], [[Minecraft:bamboo]] and [[Minecraft:scaffolding]] have times that cannot be added to any other item via tags.
For fuel slot (slot 1), it returns true if the item is fuel (has a data component {{DCL|cooking_fuel}}) or if the item is a bucket but there is no bucket already in the slot.


Note that the higher up in the table, or when it doesn't belong to the table, the more customizable the item is, as its value can be substituted from a tag. Ironically, most hardcoded fuels have less customizable fuel time than other items. Tags with a green or orange background are the most suitable for adding items, as they can change a greater number of items. Items below these tags cannot have the fuel value given by them. Tags with an orange background are also used in other places, however, they are only used in the vanilla datapack, making it easy to substitute other uses.
Note: the up face only gives access to ingredient slot (slot 0), and the side faces only give access to fuel slot (slot 1).
{{-}}


Many fuel times exist for both items and tags, but some are exclusive to items, giving items with that time a unique property. Times marked in dark green are unique to a certain item, while light green times are unique to items, but more than one item has that time. There are also times unique to tags, marked in gray.
===BrewingStandBlockEntity===
{{Infobox hardcoded item property|class=BrewingStandBlockEntity|Glass Bottle|pac=world.level.block.entity}}


Only items [[Minecraft:bamboo mosaic]], [[Minecraft:bamboo mosaic stairs]], and [[Minecraft:bamboo mosaic slab]] are hardcoded fuel items and can be as customizable as a non-hardcoded fuel item and do not have a unique time.
Define the behavior of [[Minecraft:block entity]] associated with a [[Minecraft:brewing stand]].


{| class="wikitable collapsible"
'''canTakeItemThroughFace({{tooltip|...|int slot, ItemStack itemStack, Direction direction}})'''
! rowspan="2" | Items
 
! colspan="2" | Time
Tests whether the item in the container can be take by a hopper or minecart with hopper.
|-collapsed
 
!{{Tooltip|Base Unit|200 ticks {{=}} fuel one item}} !! Ticks
Returns true only if the slot is not the slot 3, or if the slot is 3 and the item is a glass bottle.
|-
 
|{{ItemLink|Lava Bucket}} || {{tc|in|100}} || {{tc|in|20000}}
This was probably intended to take the glass bottle that could be obtained by using a single [[Minecraft:dragon's breath]] in slot 3, by the craft remainder.
|-
 
|{{BlockLink|Block of Coal}} || {{tc|in|80}} || {{tc|in|16000}}
Note: The down face not give access to slot 4, since the hoppers only try to take items from the down face, they should never take items from slot 4.
|-
{{-}}
|{{ItemLink|Blaze Rod}} || {{tc|in|12}} || {{tc|in|2400}}
 
|-
===VaultConfig===
|{{ItemLink|Coal}} || {{tc|yes|8}} || {{tc|yes|1600}}
 
|-
{{Infobox hardcoded item property|class=VaultConfig|Trial Key|pac=world.level.block.entity.vault}}
|{{ItemLink|Charcoal}} || {{tc|yes|8}} || {{tc|yes|1600}}
 
|-
'''VaultConfig()'''
|{{BlockSprite|Logs}} {{tag link|item|logs}} || {{frac|3|2}} || 300
 
|-
Define the default {{cd|key_item}} in the {{cd|config}} in {{cd|vault}} [[Minecraft:block entity]] as trial key. So the trial key can open [[Minecraft:vault]]s whose {{cd|key_item}} has not been changed.
|{{BlockSprite|Bamboo blocks}} {{tag link|item|bamboo_blocks}} ||  {{frac|3|2}} || 300
 
|-
However, it is possible to change the {{cd|key_item}} using commands, this key property only applies to default vaults.
|{{BlockSprite|Planks}} {{tag link|item|planks}} || {{frac|3|2}} || 300
{{-}}
|-
===AgeableMob===
|{{BlockLink|Bamboo Mosaic}} || {{frac|3|2}} || 300
 
|-
{{Infobox hardcoded item property|class=AgeableMob|block=1|Golden Dandelion|pac=world.entity}}
|{{BlockSprite|wooden stairs}} {{tag link|item|wooden_stairs}} || {{frac|3|2}} || 300
 
|-
'''canUseGoldenDandelion({{Tooltip|...|ItemStack itemInHand, boolean isBaby, int cooldown, Mob mob}})'''
|{{BlockLink|Bamboo Mosaic Stairs}} || {{frac|3|2}} || 300
 
|-
Returns true when the following occur simultaneously:
|{{tc|Rarely|{{BlockSprite|wooden slabs}} {{tag link|item|wooden_slabs}}}} ||  {{frac|3|4}} || 50
* The item in hand is a golden dandelion
|-
* {{cd|isBaby}} is true
|{{BlockLink|Bamboo Mosaic Slab}} ||  {{frac|3|4}} || 50
* {{cd|cooldown}} is zero
|-
* The mob is not in the {{tag link|entity_type|cannot_be_age_locked}} tag
|{{BlockSprite|wooden trapdoors}} {{tag link|item|wooden_trapdoors}} ||  {{frac|3|2}} || 300
 
|-
This method is used twice:
|{{BlockSprite|wooden pressure plates}} {{tag link|item|wooden_pressure_plates}} ||  {{frac|3|2}} || 300
 
|-
* {{jcp|net.minecraft.world.entity.AgeableMob}}.{{cd|mobInteract({{Tooltip|...|Player player, InteractionHand hand}})}} —  The {{cd|isBaby}} parameter actually checks if the ageable mob is a baby ({{cd|age}} < 0 and [[Minecraft:Baby#List_of_baby_mobs|can be a baby]]), and the {{cd|cooldown}} is {{cd|ageLockParticleTimer}}. If it returns true, sets age locked and returns {{cd|SUCCESS}}. Otherwise, it returns {{cd|PASS}} (via the super method). Most ageable mobs do not have this interaction directly, as the method has many overrides; however, at some point, it is activated via the super method.
|{{BlockSprite|shelves}} {{tag link|item|wooden_shelves}} ||  {{frac|3|2}} || 300
 
|-
* {{jcp|net.minecraft.world.entity.animal.frog.Tadpole}}.{{cd|mobInteract({{Tooltip|...|Player player, InteractionHand hand}})}} — The {{cd|isBaby}} parameter is always true, and the {{cd|cooldown}} is the same as above. Before testing whether the golden dandelion works, try feeding the tadpole (feed it when the item is in the {{tag link|item|frog_food}} tag and the tadpole is not age-locked). If it doesn't feed, try using the golden dandelion; if successful, set it to age-locked and return it to the {{Cd|SUCCESS}}. Otherwise, try to catch the tadpole in the bucket.
|{{BlockSprite|wooden fences}} {{tag link|item|wooden_fences}} || {{frac|3|2}} || 300
 
|-
When age locked is set, it occurs in order:
|{{tc|always|{{BlockSprite|fence gates}} {{tag link|item|fence_gates}}}} ||  {{frac|3|2}} || 300
# Invert the value of the NBT tag {{cd|age_locked}};
|-
# Sets the {{cd|age}} to 0 for tadpoles, −48000 for sniffers, and −24000 for other mobs;
|{{BlockLink|Note Block}} || {{frac|3|2}} || 300
# Set {{cd|ageLockParticleTimer}} to 40;
|-
# Consume one item from the player's hand.
|{{BlockLink|Bookshelf}} || {{frac|3|2}} || 300
# If age is locked:
|-
::* Set persistence required
|{{BlockLink|Chiseled Bookshelf}} || {{frac|3|2}} || 300
::* Paly sound {{cd|golden_dandelion.use}} ({{sound||Golden dandelion use.ogg}})
|-
:: Otherwise
|{{BlockLink|Lectern}} || {{frac|3|2}} || 300
::* Paly sound {{cd|golden_dandelion.unuse}} ({{sound||Golden dandelion unuse.ogg}})
|-
 
|{{BlockLink|Jukebox}} || {{frac|3|2}} || 300
===Bucketable===
|-
 
|{{BlockLink|Chest}} || {{frac|3|2}} || 300
{{Infobox hardcoded item property|class=Bucketable|Water Bucket|pac=world.entity}}
|-
 
|{{BlockLink|Trapped Chest}} || {{frac|3|2}} || 300
{{-}}
|-
 
|{{BlockLink|Crafting Table}} || {{frac|3|2}} || 300
===Entity===
|-
 
|{{BlockLink|Daylight Detector}} || {{frac|3|2}} || 300
{{Infobox hardcoded item property|class=Entity|Shears|Lead|pac=world.entity}}
|-
 
|{{ItemSprite|banners}} {{tag link|item|banners}} ||  {{frac|3|2}} || 300
 
|-
'''interact({{Tooltip|...|Player player, InteractionHand hand, Vec3 location}})'''
|{{ItemLink|Bow}} || {{frac|3|2}} || 300
 
|-
Attempt to interact with the entity in the following order. If one attempt fails, try the next.
|{{ItemLink|Fishing Rod}} ||{{frac|3|2}} || 300
 
|-
'''1.''' The player attempts to attach entities currently leashed to them onto the entity being interacted with. This interaction does not depend on the item held in hand. If at least one entity is successfully leashed, the interaction returns success (and concludes).
|{{BlockLink|Ladder}} || {{frac|3|2}} || 300
|-
|{{tc|always|{{ItemSprite|signs}} {{tag link|item|signs}}}} || 1 || 200
|-
|{{tc|always|{{ItemSprite|hanging signs}} {{tag link|item|hanging_signs}}}} || {{tc|Unknown|4}} || {{tc|Unknown|800}}
|-
|{{ItemLink|Wooden Shovel}} || 1 || 200
|-
|{{ItemLink|Wooden Sword}} || 1 || 200
|-
|{{ItemLink|Wooden Spear}} || 1 || 200
|-
|{{ItemLink|Wooden Hoe}} || 1 || 200
|-
|{{ItemLink|Wooden Axe}} || 1 || 200
|-
|{{ItemLink|Wooden Pickaxe}} || 1 || 200
|-
|{{BlockSprite|wooden doors}} {{tag link|item|wooden_doors}} || 1 || 200
|-
|{{tc|Rarely|{{ItemSprite|boats}} {{tag link|item|boats}}}} || {{tc|Unknown|6}} || {{tc|Unknown|1200}}
|-
|{{BlockSprite|wool}} {{tag link|item|wool}} || {{frac|1|2}} || 100
|-
|{{BlockSprite|wooden buttons}} {{tag link|item|wooden_buttons}} || {{frac|1|2}} || 100
|-
|{{ItemLink|Stick}} || {{frac|1|2}} || 100
|-
|{{tc|always|{{BlockSprite|saplings}} {{tag link|item|saplings}}}} ||  {{frac|1|2}} || 100
|-
|{{ItemLink|Bowl}} || {{frac|1|2}} || 100
|-
|{{tc|Rarely|{{BlockSprite|carpets}} {{tag link|item|wool_carpets}}}} || {{tc|Unknown|{{frac|1|3}} + 0.005}} || {{tc|Unknown|67}}
|-
|{{BlockLink|Dried Kelp Block}} || {{tc|in|20 + 0.005}} || {{tc|in|4001}}
|-
|{{ItemLink|Crossbow}} ||{{frac|3|2}} || 300
|-
|{{BlockLink|Bamboo}} || {{tc|yes|{{frac|1|4}}}} || {{tc|yes|50}}
|-
|{{BlockLink|Dead Bush}} || {{frac|1|2}} || 100
|-
|{{BlockLink|Short Dry Grass}} || {{frac|1|2}} || 100
|-
|{{BlockLink|Tall Dry Grass}} || {{frac|1|2}} || 100
|-
|{{BlockLink|Scaffolding}} || {{tc|yes|{{frac|1|4}}}} || {{tc|yes|50}}
|-
|{{BlockLink|Loom}} || {{frac|3|2}} || 300
|-
|{{BlockLink|Barrel}} || {{frac|3|2}} || 300
|-
|{{BlockLink|Cartography Table}} || {{frac|3|2}} || 300
|-
|{{BlockLink|Fletching Table}} || {{frac|3|2}} || 300
|-
|{{BlockLink|Smithing Table}} || {{frac|3|2}} || 300
|-
|{{BlockLink|Composter}} || {{frac|3|2}} || 300
|-
|{{BlockLink|Azalea}} || {{frac|1|2}} || 100
|-
|{{BlockLink|Flowering Azalea}} || {{frac|1|2}} || 100
|-
|{{BlockLink|Mangrove Roots}} || {{frac|3|2}} || 300
|-
|{{BlockLink|Leaf Litter}} || {{frac|1|2}} || 100
|}
 
The fuel list is used in:
* {{jcp|net.minecraft.world.inventory.AbstractFurnaceMenu}}.{{cd|quickMoveStack({{Tooltip|...|Player player, int slotIndex}})}}: Used to allow fuel o be moved from the inventory to the [[Minecraft:Java_Edition_protocol/Inventory#Furnace|fuel slot]] (slot 1) with a quick click (click + Shift), in any [[Minecraft:Smelting#Methods|furnace]].
** If the item can smelt, it will attempt to go to the ingredient slot (slot 0), and not to the fuel slot (slot 1).
** This also prevents quick clicking from moving fuel to the between storage slots (slots 3–29) and hotbar slots (slots 30–38) and vice versa, when the any furnace menu is open. Even if the fuel fails to move to the fuel slot.
* {{jcp|net.minecraft.world.inventory.FurnaceFuelSlot}}.{{cd|mayPlace({{Tooltip|...|final ItemStack itemStack}})}}: Used to enable fuel to be placed in the fuel slot, by the menu, in any furnace.
* {{jbcp|entity|AbstractFurnaceBlockEntity}}.{{cd|canPlaceItem({{Tooltip|...|int slot, ItemStack itemStack}})}}: Used to enable fuel to be placed in the fuel slot, by [[Minecraft:hopper]], [[Minecraft:minecart with hopper]] and [[Minecraft:dropper]], in any furnace.
* {{jbcp|entity|AbstractFurnaceBlockEntity}}.{{cd|getBurnDuration({{Tooltip|...|FuelValues fuelValues, ItemStack itemStack}})}}: Return the burn duration time (in ticks)
** Used in {{cd|serverTick(...)}}, so that if the block is not {{cd|lit}}, it has fuel, an ingredient, and the recipe is available, then:  
*** it defines the {{cd|litTimeRemaining}} and the {{cd|litTotalTime}};
*** if it is greater than 0, it consumes the fuel (shrinks 1 item from the item stack and leaves the craft remaining if it is the last one), set the {{cd|lit}} true (included for effects in this same metody).
** In implementations {{jbcp|entity|SmokerBlockEntity}} and {{jbcp|entity|BlastFurnaceBlockEntity}}, returns half the time (rounding down). However, in the vanilla datapack, the recipes in that block take 100 ticks instead of 200 ticks, so the quantity of smelted items is approximately the same (it changes slightly for items in {{cd|#wool_carpets}} tag and for the dried kelp block, where in the [[Minecraft:furnace]] it is respectively 0.335 and 20.005 items and in [[Minecraft:smoker]] and [[Minecraft:blast furnace]] it is respectively 0.33 and 20 items).
 
===PotDecorations===
 
{{Infobox hip|class=PotDecorations|Brick|pac=world.level.block.entity}}
 
'''getItem({{Tooltip|...|List&lt;Item&gt; sherds, int i}})'''
 
Returns the {{cd|i}}-th item from the list {{cd|''sherds''}} given when set the {{DCL|pot_decorations}} component. If {{cd|i}} is greater or equal than the size of {{cd|''sherds''}}, returns {{cd|empty}}. If the {{cd|i}}-th item is a brick, returns {{cd|empty}}; otherwise, returns the item itself.


Used to define the component {{cd|pot_decorations}} ''internally''. Therefore, the items stack {{cd|decorated_pot[pot_decorations{{=}}[]]}} and {{cd|decorated_pot[pot_decorations{{=}}[brick,brick,brick,brick]]}} are the same. The same applies to {{cd|stone[pot_decorations{{=}}[stone]]}} and {{cd|stone[pot_decorations{{=}}[stone,brick]]}}.
'''2.''' If the item held is shears, attempt to remove the leashes from the entity being interacted with.
* This attempts to remove both the leash securing the interacted entity and any leashes from nearby entities (within a 32&times;32&times;32 cuboid centered on the interacted entity) that are attached to the interacted entity.
* When a leash is removed, it is dropped at the position of the leashed entity.
If at least one leash is dropped:
* Produce the game event {{cd|shear}} [[Minecraft:game event]].
* The {{cd|item.shears.snip}} sound plays.
* The shears take one of damage.
* The interaction returns success.


However, sometimes when using the component it does the opposite (it considers the empty space as a brick):  
'''3.''' Attempts to remove equipment from the entity. This is only possible if the following conditions are met simultaneously:
* save the component NBT (except if in completely empty),
* The entity is a [[Minecraft:mob]]
* add itens in tooltip,
* The player is holding shears
* the drop of the [[Minecraft:decorated pot]] block (with {{cd|{"type":"dynamic","name":"sherds"&#125;}} [[Minecraft:Loot_table#Singleton_entry|loot table]]),  
* The player is not [[Minecraft:crouching|{{Control|crouching}}]]
* the side with the empty item uses the same texture as the brick (see {{slink||DecoratedPotPatterns}}).
* If the entity is a wolf, the player is its owner; otherwise, the entity is not being ridden
* At least one item in the entity's equipment slots has {{DCL|equippable.can_be_sheared}} set to true and, unless the player is in Creative mode, does not have an enchantment with {{cd|[[Minecraft:Enchantment_definition#prevent_armor_change|prevent_armor_change]]}} effect components (e.g., [[Minecraft:Curse of Binding]] in vanilla)
In this case, a piece of equipment can be removed:
* The shears take one of damage
* Produce the [[Minecraft:game event]] {{cd|shear}}
* Drop the equipment
* Triggered [[Minecraft:Advancement_definition#minecraft:player_sheared_equipment|{{cd|player_sheared_equipment}}]] advancement trigger
* The interaction returns success.
At most, one piece of equipment is dropped at a time, in the following order of slot priority: main hand, off-hand, feet, legs, chest, head, body and saddle.


===VaultConfig===
'''4.''' ''wip''
 
{{-}}
{{Infobox hip|class=VaultConfig|Trial Key|pac=world.level.block.entity.vault}}
 
'''VaultConfig()'''
 
Define the default {{cd|key_item}} in the {{cd|config}} in {{cd|vault}} [[Minecraft:block entity]] as trial key. So the tiral key can open [[Minecraft:vault]]s whose {{cd|key_item}} has not been changed.
 
However, it is possible to change the {{cd|key_item}} using commands, this key property only applies to default vaults.
 
===AgeableMob===
===Entity===
===LivingEntity===
===Mob===
===Mob===
===CrossbowAttack===
===CrossbowAttack===
Line 2,712: Line 2,916:
===BowAttackGoal===
===BowAttackGoal===
===RangedCrossbowAttackGoal===
===RangedCrossbowAttackGoal===
===Bucketable===
===Armadillo===
===Armadillo===
===Axolotl===
===Axolotl===
Line 2,747: Line 2,950:
===ZombieVillager===
===ZombieVillager===
===Villager===
===Villager===
{{Infobox hardcoded item property|class=LivingEntity|Villager Spawn Egg|pac=world.entity}}
'''mobInteract({{Tooltip|...|Player player,InteractionHand hand}})'''
When interacting with a [[Minecraft:villager]], if the interaction use a '''villager spawn egg''', if the villager is sleeping, currently trading, or is not alive, the interaction returns the result of the supermethod (see {{slink||AgeableMob}}). Note that if the item is the villager spawn egg, it always returns pass.
This prevents starting a [[Minecraft:trade]] or {{cd|setUnhappy()}} (for babies and villagers without trades), and returns success.
However, if the supermethod returns pass, it try to equip the item on the villager, by the {{DCL|equippable}} component, via the {{jicp|-Stack}}.{{cd|interactLivingEntity(...)}} method.
The addition of the villager spawn egg check was likely intended to ensure the egg spawns a baby villager instead starting a trade; however, in the interaction check order, the attempt to spawn a baby villager with a spawn egg occurs before this method. Consequently, it is possible to spawn a baby villager using any spawn egg that possesses the {{DCL|entity_data}} component with the ID {{cd|villager}}. This property also allows the villager spawn egg to be equipped, provided it does not have the {{DCL|entity_data}} component with the ID {{cd|villager}} (which requires removing the default component), which does not occur with other items.<ref>{{bug|MC-306588}}</ref>
{{-}}
===VillagerProfession===
===VillagerProfession===
===WanderingTrader===
===WanderingTrader===
Line 2,753: Line 2,970:
===FishingHook===
===FishingHook===
===ProjectileUtil===
===ProjectileUtil===
===EntityEquipmentPredicate===
===ClientLevel===
===ClientLevel===
===AbstractClientPlayer===
===AbstractClientPlayer===
Line 2,761: Line 2,977:
===LivingEntityRenderer===
===LivingEntityRenderer===
===WitchRenderer===
===WitchRenderer===
{{info needed section|used for potions, or something else?}}
===AvatarRenderer===
===AvatarRenderer===
===CuboidItemModelWrapper===
===CuboidItemModelWrapper===
===Charge===
===Charge===
===PotionBrewing===
===Ingredient===
===Ingredient===
===CrossbowItem===
===CrossbowItem===
Line 2,773: Line 2,989:
===ProjectileWeaponItem===
===ProjectileWeaponItem===
===EnchantRandomlyFunction===
===EnchantRandomlyFunction===
===ExplorationMapFunction===
===FillPlayerHead===
===FillPlayerHead===
===SetEnchantmentsFunction===
===SetEnchantmentsFunction===
===SetStewEffectFunction===
===SetStewEffectFunction===
===EntityEquipmentPredicate===


== Old article stub ==
== Old article stub ==
Line 2,874: Line 3,090:


== History ==
== History ==
{{info needed section|History before [[Minecraft:Java Edition 26.1 Snapshot 1]] and after [[Minecraft:Java Edition 26.2 Snapshot 1]] <!--Previously, properties were controlled by NBT tags, so it still made sense to divide them between hardcoded and non-hardcoded properties. Although it's unlikely anyone will write the history from that long ago, NBT tags generally dealt with customizable aspects in Survival mode, unlike many components. Furthermore, since 2017 there have been properties controlled by tags and recipes that control the properties of items.--@Aloi4 -->}}
{{info needed section|History before [[Minecraft:Java Edition 26.1 Snapshot 1]] (particularly after the release of 1.21) and after [[Minecraft:Java Edition 26.3 Snapshot 2]] <!--Previously, properties were controlled by NBT tags, so it still made sense to divide them between hardcoded and non-hardcoded properties. Although it's unlikely anyone will write the history from that long ago, NBT tags generally dealt with customizable aspects in Survival mode, unlike many components. Furthermore, since 2017 there have been properties controlled by tags and recipes that control the properties of items.--@Aloi4 -->}}


{{HistoryTable
{{HistoryTable
|{{HistoryLine|Java}}
|{{HistoryLine|java}}
|{{HistoryLine||1.20.5|dev=24w09a|Item NBT has been effectively removed, being replaced by the new [[Minecraft:data component format]]. Some hardcoded properties of items have also been migrated to this system.{{info needed|which? I know enchantment_glint_override was one of them, but surely there were others?}}}}
|{{HistoryLine||1.13|dev=17w43a|Add [[Minecraft:datapack]] that control [[Minecraft:Advancement_definition|advancement]]. Items used in advancement triggers are no longer hardcoded, such as iron bars, stone pickaxes, and lava buckets.}}
|{{HistoryLine|||dev=17w48a|[[Minecraft:Recipe (Java Edition)|Recipes]] are now controlled by datapacks, so most recipes are no longer hardcoded, with the exception of special crafting recipes}}
|{{HistoryLine|||dev=17w49a|Added [[Minecraft:Tag (Java Edition)|tag]]s, with the item tags {{tag link|item|planks|wool}}. So, the properties of planks, repair tools, shields, and wool to be used with fuel were no longer hardcoded.}}
|{{HistoryLine||1.14|dev=18w43a|Added  {{cd|match_tool}} loot table condition, Now, the drop rate for using [[Minecraft:shears]] is controlled by [[Minecraft:loot tables]].{{Info needed|The loot table already existed previously, so how was the drop rate controlled?}}}}
|{{HistoryLine||1.20.5|dev=24w09a|Item NBT has been effectively removed, being replaced by the new [[Minecraft:data component format]]. Some hardcoded properties of items have also been migrated to this system.{{info needed|which? surely there were others besides those mentioned below?}}}}
|{{HistoryLine|||dev=?|The enchantment glint override component has been added, which presumably supplanted some unspecified hardcoded behaviour.}}
|{{HistoryLine|||dev=?|Food data is now a component, presumably replacing hardcoded data definitions.}}
|{{HistoryLine|||dev=?|Maximum item stack size is now a component, presumably replacing hardcoded data definitions.}}
|{{HistoryLine|||dev=?|The maximum amount of damage an item can withstand is now a component, presumably replacing hardcoded data definitions.}}
|{{HistoryLine|||dev=?|Whether items are destroyed by fire and lava or not is now a component, presumably replacing hardcoded data definitions.}}
|{{HistoryLine|||dev=?|Rarity is now controlled by a component, presumably replacing hardcoded data definitions.}}
|{{HistoryLine|||dev=?|Tool data is now a component, presumably replacing hardcoded data definitions.}}
|{{HistoryLine|||dev=?|Whether tooltips are visible is now controlled by a component, presumably replacing hardcoded data definitions.}}
|{{HistoryLine|||dev=?|Item names can now be controlled by a component, presumably replacing hardcoded data definitions.}}
|{{HistoryLine||1.21|dev=24w18a|[[Minecraft:Enchantment definition|Enchantment]]s are now controlled by datapacks, so the property of being enchanted by a certain enchantment has ceased to be hardcoded, except for [[Minecraft:book]].}}
|{{HistoryLine|||dev=?|Output items from eating food is now controlled by a component, presumably replacing hardcoded data definitions.}}
|{{HistoryLine|||dev=?|Jukebox item usage is now a component, presumably replacing hardcoded data definitions.}}
<!--
<!--
   26.1 Start
   26.1 Start
-->
-->
|{{HistoryLine||26.1|dev=snap3
|{{HistoryLine||26.1|dev=snap1|[[Minecraft:Villager trade definition|Villager trades]] are now controlled by datapack, so the property of wants items for default trades is no longer hardcoded. Note that the trade could already be modified by command. Removing the classes {{jcp|net.minecraft.world.entity.npc.villager.VillagerTrades}} which had many {{jicp|-s}} accesses}}
|{{HistoryLine|||dev=snap3
|The {{DCL|bundle_contents}} component can now handle errors in the weight,{{note|An error in the weight of the {{cd|bundle_counts}} component, in addition to invalid count data, occurs when the weight exceeds 2<sup>31</sup>-1 (equivalent to 2<sup>31</sup>-1 stacks). This can happen by using {{cmd|give}} to generate items with many layers of the {{cd|bundle_counts}} component, and then using {{cmd|/data}} to place these items in the bundle.}} considering the weight equal to {{cd|error}} and keeping its data. Previously, the component was only deleted. Therefore, instances of {{jicp|Bundle}} considers it as full for the purpose of displaying the bar. However, it continues to delete items when trying to remove an item from the bundle, transfer an item, or view the tooltip.  
|The {{DCL|bundle_contents}} component can now handle errors in the weight,{{note|An error in the weight of the {{cd|bundle_counts}} component, in addition to invalid count data, occurs when the weight exceeds 2<sup>31</sup>-1 (equivalent to 2<sup>31</sup>-1 stacks). This can happen by using {{cmd|give}} to generate items with many layers of the {{cd|bundle_counts}} component, and then using {{cmd|/data}} to place these items in the bundle.}} considering the weight equal to {{cd|error}} and keeping its data. Previously, the component was only deleted. Therefore, instances of {{jicp|Bundle}} considers it as full for the purpose of displaying the bar. However, it continues to delete items when trying to remove an item from the bundle, transfer an item, or view the tooltip.  
| The {{cd|eggs()}} method has been removed from {{jicp|SpawnEgg}} and added new use of instanceof of {{jicp|SpawnEgg}} in {{jcp|net.minecraft.core.dispenser.DispenseItemBehavior}}. Previously, the {{cd|eggs()}} was only used in {{jcp|net.minecraft.core.dispenser.DispenseItemBehavior}} to set the behavior of the spawn eggs in the dispenser. However, it only saved one spawn egg for each id in the default {{DCL|entity_data}}; in practice, this did not change anything, given that there does not exist two [[Minecraft:spawn egg]]s with the same id in the default {{cd|entity_data}}, but this could affect [[Minecraft:mod]]s and future additions to the game.
| The {{cd|eggs()}} method has been removed from {{jicp|SpawnEgg}} and added new use of instanceof of {{jicp|SpawnEgg}} in {{jcp|net.minecraft.core.dispenser.DispenseItemBehavior}}. Previously, the {{cd|eggs()}} was only used in {{jcp|net.minecraft.core.dispenser.DispenseItemBehavior}} to set the behavior of the spawn eggs in the dispenser. However, it only saved one spawn egg for each id in the default {{DCL|entity_data}}; in practice, this did not change anything, given that there does not exist two [[Minecraft:spawn egg]]s with the same id in the default {{cd|entity_data}}, but this could affect [[Minecraft:mod]]s and future additions to the game.
Line 2,892: Line 3,125:
* A [[Minecraft:shulker box]] with an item stack with invalid data appears as {{cd|Air x0}} in the tooltip, and when placing the block on the ground, the item stack disappears.  
* A [[Minecraft:shulker box]] with an item stack with invalid data appears as {{cd|Air x0}} in the tooltip, and when placing the block on the ground, the item stack disappears.  
* Placing an [[Minecraft:arrow]] with invalid data in a [[Minecraft:crossbow]] appears as {{cd|Projectile: [Air]}} in the tooltip, and shoot does not generate any projectile.  
* Placing an [[Minecraft:arrow]] with invalid data in a [[Minecraft:crossbow]] appears as {{cd|Projectile: [Air]}} in the tooltip, and shoot does not generate any projectile.  
* Placing an item stack with invalid data in a [[Minecraft:bundle]] does not drop anything when you try to remove it with a click (although it empties the bundle), and trying to view the bundle's tooltip crashes the game because it cannot render an empty item<ref>{{bug|MC-306072}}</ref>.
* Placing an item stack with invalid data in a [[Minecraft:bundle]] does not drop anything when try to remove it with a click (although it empties the bundle), and trying to view the bundle's tooltip crashes the game because it cannot render an empty item.<ref>{{bug|MC-306072}}</ref>
}}
}}
<!--26.1 snp3 end -->
<!--26.1 snp3 end -->
Line 2,939: Line 3,172:
|
|
The cauldron interactions list has been moved from {{jcp|net.minecraft.core.cauldron.CauldronInteraction}} to the new class {{jcp|net.minecraft.core.cauldron.CauldronInteractions}}.
The cauldron interactions list has been moved from {{jcp|net.minecraft.core.cauldron.CauldronInteraction}} to the new class {{jcp|net.minecraft.core.cauldron.CauldronInteractions}}.
| Brown [[Minecraft:mooshrooms]] now only receive the suspicious effect from {{jicp|Block}} if they are not babies. Because of this, the Golden Duded effect is now applied to baby Brown mooshrooms.
| Dyed item iteration in {{jcp|net.minecraft.core.cauldron.CauldronInteractions}} is now controlled by the {{Tag link|item|cauldron_can_remove_dye}} tag instead of the items leather boots, leather pants, leather tunic, leather cap, leather horse armor, and wolf armor.
| Brown [[Minecraft:mooshrooms]] now only receive the suspicious effect from {{jicp|Block}} if they are not babies. Because of this, the golden dandelion agge locked is now applied to baby brown mooshrooms, and other flowers are no longer applicable.
}}
}}
<!--26.1 snap8 end -->
<!--26.1 snap8 end -->
|{{HistoryLine|||dev=snap10
|{{HistoryLine|||dev=snap10
|The {{cd|bindPlayerMobs(...)}} method of {{jicp|Lead}} hears some changes: early return pass if no leashable entities found in area, split {{cd|LeashFenceKnotEntity.getOrCreateKnot(...)}} into {{cd|LeashFenceKnotEntity.getKnot(...)}} and {{cd|LeashFenceKnotEntity.createKnot(...)}} for explicit control, {{cd|activeKnot.playPlacementSound()}} moved to post-loop (only plays on success), discard newly created knot if no entity was successfully leashed
|The {{cd|bindPlayerMobs(...)}} method of {{jicp|Lead}} hears some changes: early return pass if no leashable entities found in area, split {{cd|LeashFenceKnotEntity.getOrCreateKnot(...)}} into {{cd|LeashFenceKnotEntity.getKnot(...)}} and {{cd|LeashFenceKnotEntity.createKnot(...)}} for explicit control, {{cd|activeKnot.playPlacementSound()}} moved to post-loop (only plays on success), discard newly created knot if no entity was successfully leashed.
| The {{cd|releaseUsing(...)}} method of {{jicp|Trident}} now only activates the spin attack if the player is not a passenger.
| The {{cd|releaseUsing(...)}} method of {{jicp|Trident}} now only activates the spin attack if the player is not a passenger.
| The method {{cd|makeAgeLockedParticle(...)}} in {{jcp|net.minecraft.world.entity.AgeableMob}} has undergone significant changes. Now, the position and type of particle depend on whether the age is locked. Previously, the particle {{cd|happy_villager}} was used.
| The method {{cd|makeAgeLockedParticle(...)}} in {{jcp|net.minecraft.world.entity.AgeableMob}} has undergone significant changes. Now, the position and type of particle depend on whether the age is locked. Previously, the particle {{cd|happy_villager}} was used.
Line 2,949: Line 3,183:
<!--26.1 snap10 end -->
<!--26.1 snap10 end -->
|{{HistoryLine|||dev=pre1
|{{HistoryLine|||dev=pre1
|In {{jicp|-s}}, when registering items with the default components {{DCL|damage_resistant}}, {{DCL|blocks_attacks}}, and {{DCL|provides_banner_patterns}}, the method {{cd|Properties.delayedComponent(...)}} is now used instead of {{cd|Properties.component(...)}}. This makes the items more sensitive to changes in data_pakcs.
|In {{jicp|-s}}, when registering items with the default components {{DCL|damage_resistant}}, {{DCL|blocks_attacks}}, and {{DCL|provides_banner_patterns}}, the method {{cd|Properties.delayedComponent(...)}} is now used instead of {{cd|Properties.component(...)}}. This makes the items more sensitive to changes in datapack.
}}
}}
<!--26.1 pre1 end -->
<!--26.1 pre1 end -->
Line 2,958: Line 3,192:
| The method {{cd|requiredFeatures()}} has been removed from {{jicp|SpawnEgg}}.  
| The method {{cd|requiredFeatures()}} has been removed from {{jicp|SpawnEgg}}.  
}}
}}
<!--26.1 snap2 end -->
<!--26.1 pre2 end -->
|{{HistoryLine|||dev=pre3
|{{HistoryLine|||dev=pre3
| In {{jcp|net.minecraft.world.entity.AgeableMob}}, when setting age locked data, the age is defined according to {{cd|getBabyStartAge()}}, which by default is -24000 and for the sniffer -48000. Previously it was always -24000.
| In {{jcp|net.minecraft.world.entity.AgeableMob}}, when setting age locked data, the age is defined according to {{cd|getBabyStartAge()}}, which by default is &minus;24000 and for the sniffer -48000. Previously it was always &minus;24000.
}}
}}
<!--
<!--
Line 2,966: Line 3,200:
-->
-->
|{{HistoryLine||26.2|dev=snap1
|{{HistoryLine||26.2|dev=snap1
| Added items [[Minecraft:sulfur]], [[Minecraft:potent sulfur]], [[Minecraft:sulfur slab]], [[Minecraft:sulfur stairs]], [[Minecraft:sulfur wall]], [[Minecraft:polished sulfur block]], [[Minecraft:polished sulfur slab]], [[Minecraft:polished sulfur stairs]], [[Minecraft:polished sulfur wall]], [[Minecraft:sulfur bricks]], [[Minecraft:sulfur brick slab]], [[Minecraft:sulfur brick stairs]], [[Minecraft:sulfur brick wall]], [[Minecraft:cinnabar]], [[Minecraft:cinnabar slab]], [[Minecraft:cinnabar stairs]], [[Minecraft:cinnabar wall]], [[Minecraft:polished cinnabar block]], [[Minecraft:polished cinnabar slab]], [[Minecraft:polished cinnabar stairs]], [[Minecraft:polished cinnabar wall]], [[Minecraft:cinnabar bricks]], [[Minecraft:cinnabar brick slab]], [[Minecraft:cinnabar brick stairs]] and [[Minecraft:cinnabar brick wall]] as new instances of {{jicp|Block}}
| Added items [[Minecraft:sulfur]], [[Minecraft:potent sulfur]], [[Minecraft:sulfur slab]], [[Minecraft:sulfur stairs]], [[Minecraft:sulfur wall]], [[Minecraft:polished sulfur block]], [[Minecraft:polished sulfur slab]], [[Minecraft:polished sulfur stairs]], [[Minecraft:polished sulfur wall]], [[Minecraft:sulfur bricks]], [[Minecraft:sulfur brick slab]], [[Minecraft:sulfur brick stairs]], [[Minecraft:sulfur brick wall]], [[Minecraft:cinnabar]], [[Minecraft:cinnabar slab]], [[Minecraft:cinnabar stairs]], [[Minecraft:cinnabar wall]], [[Minecraft:polished cinnabar block]], [[Minecraft:polished cinnabar slab]], [[Minecraft:polished cinnabar stairs]], [[Minecraft:polished cinnabar wall]], [[Minecraft:cinnabar bricks]], [[Minecraft:cinnabar brick slab]], [[Minecraft:cinnabar brick stairs]], and [[Minecraft:cinnabar brick wall]] as new instances of {{jicp|Block}}
| Added the item [[Minecraft:sulfur cube bucket]] as a new {{jicp|MobBucket}} instance
| Added the item [[Minecraft:sulfur cube bucket]] as a new {{jicp|MobBucket}} instance, with content (fluid) and emptySound is empty.
| Added the item [[Minecraft:sulfur cube spawn egg]] as a new {{jicp|SpawnEgg}} instance.
| Added {{jcp|net.minecraft.world.entity.monster.cubemob.SulfurCube}} class, with 3 {{jicp|-s}} member access: sulfur cube bucket, [[Minecraft:bucket]] and [[Minecraft:shears]].
| Added {{jcp|net.minecraft.world.entity.monster.cubemob.SulfurCube}} class, with 3 {{jicp|-s}} member access: sulfur cube bucket, [[Minecraft:bucket]] and [[Minecraft:shears]].
| Colored items, such as [[Minecraft:wool]] and [[Minecraft:dyed shulker box]], are referenced as {{cd|{{jbcp||ColorCollection}}&lt;Item&gt;}}, instead of 16 separate instances. Similarly, copper items, such as [[Minecraft:copper block]] and [[Minecraft:chiseled copper]], are referenced as {{cd|{{jbcp||CopperCollection}}&lt;Item&gt;}}, instead of 8 separate instances. This modified many classes, but only in the code organization, and not in game properties.
| Colored items, such as [[Minecraft:wool]] and [[Minecraft:dyed shulker box]], are referenced as {{cd|{{jbcp||ColorCollection}}&lt;Item&gt;}}, instead of 16 separate instances. Similarly, copper items, such as [[Minecraft:copper block]] and [[Minecraft:chiseled copper]], are referenced as {{cd|{{jbcp||CopperCollection}}&lt;Item&gt;}}, instead of 8 separate instances. This modified many classes, but only in the code organization, and not in game properties.
Line 2,974: Line 3,209:
| The {{cd|tryShearEntity(...)}} method in {{jcp|net.minecraft.core.dispenser.ShearsDispenseItemBehavior}} now checks if the shearable entity is alive before shearing it. Previously, this test was performed using the {{cd|readyForShearing()}} method on each entity.
| The {{cd|tryShearEntity(...)}} method in {{jcp|net.minecraft.core.dispenser.ShearsDispenseItemBehavior}} now checks if the shearable entity is alive before shearing it. Previously, this test was performed using the {{cd|readyForShearing()}} method on each entity.
}}
}}
<!--|{{HistoryLine||26.2|dev=?
<!-- snap2 NONE-->
|{{HistoryLine|||dev=snap3
|Some changes to the {{jicp|-s}} class, but without much impact on the final properties:
|Some changes to the {{jicp|-s}} class, but without much impact on the final properties:
* Now the item IDs are defined in {{jcp|net.minecraft.references.ItemIds}} or {{jcp|net.minecraft.references.BlockItemIds}} (for most ItemBlock and air). Previously, many items had their ID defined by a string literal; items registered with {{cd|registerBlock(...)}} copied the ID from the block; and items registered with {{cd|registerSpawnEgg(...)}} copied the ID from the entity with the suffix {{cd|_spawn_egg}}.
* Now the item IDs are defined in {{jcp|net.minecraft.references.ItemIds}} or {{jcp|net.minecraft.references.BlockItemIds}} (for most ItemBlock and air). Previously, many items had their ID defined by a string literal; items registered with {{cd|registerBlock(...)}} copied the ID from the block; and items registered with {{cd|registerSpawnEgg(...)}} copied the ID from the entity with the suffix {{cd|_spawn_egg}}.
* Air is no longer registered with {{cd|registerBlock(...)}}. It now receives blcok {{cd|descriptionId}} in the registry properties.
* Air is no longer registered with {{cd|registerBlock(...)}}. It now receives blcok {{cd|descriptionId}} in the registry properties.
}}-->
<!--Vanilla tags are no longer added to item instances, but rather to their ID.-->
| {{jicp|MobBucket}} overrides {{jicp|Bucket}}.{{cd|getFluidContext()}}, always using the {{cd|NONE}} context. Previously, the {{cd|getFluidContext()}} method did not exist, and the context was determined by {{cd|use(...)}}.
}}
|{{HistoryLine|||dev=snap4
| Sulfur cube bucket now has {{cd|item.bucket.empty_sulfur_cube}} sound event as emptySound.
| The override of the {{cd|emptyContents(...)}} method in {{jicp|MobBucket}}, now plays emptySound before returning true when the fluid is empty.
}}
|{{HistoryLine|||dev=snap5
| The {{cd|use(...)}} and {{cd|useOn(...)}} methods in {{jicp|SpawnEgg}} return {{cd|FALL}} whenever there is no entity or the entity cannot be spawned at the level (for some when the difficulty is peaceful). Previously, this test was performed at different times, allowing the use of any entity on the [[Minecraft:monster spawner]] even in passive difficulty.<ref>{{Bug|MC-307689}}</ref> A small exception occurs in {{cd|use(...)}}, because the test to ensure the hit result is not a block to return {{cd|PASS}} is performed beforehand.
}}
|{{HistoryLine|||dev=snap7
| Added the item [[Minecraft:music disc bounce]], as just a instance of {{jicp|}}.
}}
|{{HistoryLine|||dev=pre1
| The interaction result when using {{jicp|BoneMeal}} and grow crop is now {{cd|SUCCESS}} on the client side. Previously, it returned {{cd|PASS}} on the client side.
}}
<!--
  26.2 end!
-->
|{{HistoryLine||26.3|dev=snap1
|Removed {{jicp|Bed}}. [[Minecraft:Bed]] (all 16 blocks in ColorCollection) are now just {{jicp|Block}}. Previously, when placing a bed block (using the {{cd|placeBlock(...)}}), it used update flags of 26 instead of 11.<ref>{{bug|MC-308830}}</ref>
|{{Jicp|Instrument}} now, in the method {{cd|use(...)}}, hurt and break the item according to the new tag {{nbt|int|durability_damage}} from the [[Minecraft:instrument definition]], if it exists and is greater than 0. Furthermore, only add the cooldown if it is greater than {{cd|0.0}}.
| {{jicp|SpawnEgg}} when used ({{cd|useOn(...)}}) by op players in [[Minecraft:monster spawner]] or [[Minecraft:trial spawner]], sets the data according to the {{DCL|entity_data}} component; previously, only the entity id was set.
| Access to items in {{jcp|net.minecraft.world.level.block.entity.DecoratedPotPatterns}} has been removed and replaced by the component {{DCL|provides_pottery_pattern}}. Previously, the sides of the decorated pot were saved with item ids, and each id was associated with a texture.
| Access to items in {{jcp|net.minecraft.world.level.block.entity.PotDecorations}} has been removed; the [[Minecraft:brick]] no longer has the property of being the default item for [[Minecraft:decorated pot]] sides, making it possible to decorate pots with an empty side.
| Added [[Minecraft:poplar planks]], [[Minecraft:poplar sapling]], [[Minecraft:poplar log]], [[Minecraft:stripped poplar log]], [[Minecraft:stripped poplar wood]], [[Minecraft:poplar wood]], [[Minecraft:Red Poplar Leaves|red poplar leaves]], [[Minecraft:Orange Poplar Leaves|orange poplar leaves]], [[Minecraft:Yellow Poplar Leaves|yellow poplar leaves]], [[Minecraft:red shrub]], [[Minecraft:wool stairs]] (ColorCollection), [[Minecraft:wool slab]] (ColorCollection), [[Minecraft:shelf mushroom]], [[Minecraft:poplar slab]], [[Minecraft:poplar shelf]], [[Minecraft:poplar fence]], [[Minecraft:poplar stairs]], [[Minecraft:poplar button]], [[Minecraft:poplar pressure plate]], [[Minecraft:poplar door]], [[Minecraft:poplar trapdoor]], and [[Minecraft:poplar fence gate]] as new instances of {{jicp|Block}}.
| Added [[Minecraft:poplar boat]] and [[Minecraft:poplar boat with chest]] as new instances of {{jicp|Boat}}.
| Added [[Minecraft:poplar sign]] as new istance of {{jicp|Sign}}.
| Added [[Minecraft:poplar hanging sign]] as new istance of {{jicp|HangingSign}}.
| In {{jicp|Axe}}, poplar wood and poplar log were added to {{cd|STRIPPABLES}}
| Added potted poplar sapling, a new instance of {{jbcp|FlowerPot}}. Thus, through the {{cd|useItemOn(...)}} method in {{jbcp|FlowerPot}}, which import the {{jicp|Block}}, the poplar sapling has the hardcoded property of interacting with the [[Minecraft:flower pot]].
| The new poplar boat and poplar boat with chest items have the behavior {{cd|BoatDispenseItemBehavior}} in {{jcp|net.minecraft.core.dispenser.DispenseItemBehavior}}.
}}
<!--26.3 snap1 end -->
|{{HistoryLine|||dev=snap2
| {{jicp|Axe}}, {{jicp|Hoe}}, and {{jicp|Shovel}} have been removed. All items previously belonging to these classes ([[Minecraft:axes]], [[Minecraft:hoes]], and [[Minecraft:shovels]]) are now just {{jicp|}}, and their behavior, previously defined by their class properties, is now given by {{DCL|block_transformer}}. In the case of the shovels, some properties now depend on the tag {{tag link|item|dowses_campfires}}.
| The method {{cd|useOn(...)}}, in {{jicp|}}, transforms blocks according to the component {{cd|block_transformer}} or returns {{cd|PASS}} if it does not exist. Previously it always returned {{cd|PASS}}.
| {{jicp|Honeycomb}} now play a sound in the {{cd|useOn(...)}} and {{cd|tryApplyToSign(...)}} methods.
| In {{jicp|DispenseItemBehavior}}, the behavior of [[Minecraft:honeycomb]] now play a sound.
}}
<!--26.3 snap2 end -->
|{{HistoryLine|||dev=?|Brewing is now data-driven using the recipe system, removing some hardcoded item data as a result.}}
|{{HistoryLine|||dev=?|Added CushionItem.}}
|{{HistoryLine|||dev=?|Straw bed, concrete slabs and stairs, now exist under block item definitions of some sort.}}
|{{HistoryLine|||dev=?|Villager food is now component controlled.}}
|{{HistoryLine|||dev=?|Exploration maps are now handled differently.}}
|{{HistoryLine|||dev=?|Composting is now component driven.}}
}}
}}


Line 2,986: Line 3,268:
== References ==
== References ==
{{reflist}}
{{reflist}}
[[Category:Java Edition technical]]

Latest revision as of 11:09, 20 September 2026

Template:Italic title Template:Exclusive Template:Wip Template:Project Template:Cleanup Hardcoded item properties are aspects of Minecraft:items which are tied to the IDs and cannot be customized fully via the use of Minecraft:commands or Minecraft:data packs. That is, if an item has all of its item components removed, and is not a member of any item tags, referenced by any recipes, trades, advancement triggers, or any other more esoteric data-driven definitions (e.g. Minecraft:vault unlock items, Minecraft:predicates used in Minecraft:loot tablesTemplate:Note or what enchantments can be applied to items), it still possesses a functionality based entirely on its item ID which cannot be removed from it, nor assigned to arbitrary other items.

Many of the properties associated with items in the game have been made controllable with Minecraft:data component format; this intends to track things that are not currently controllable via any of the above data-driven item properties (though may be in future).

Some properties are mixed, where they depend both on the hardcoded parts and on references to components, tags, etc. In these cases, items with the same components, tags, etc., would have different properties depending on the item's ID. For example, the properties of the Minecraft:spawn egg, which depend on both the item's ID (being an instance of SpawnEggItem) and the component Template:DCL. These properties are also described on this page.

Template:TOC

Item stacks properties

Most item instances in the game are through item stacks. An item stack is defined by its id, count and components.

Count

The count of an item is the easiest to control, and can largely be controlled even in Survival mode. Changing commands and components gives you more freedom to control it, although items with a count higher than their Template:DCL have some side effects and it is not possible, even with commands, to exceed a count of 99 or be less than 1.

However, the count is rarely used to affect the property of an item stack. Exceptions include the weight of the item in a bundle to test if it is full, the weight of the item in a container to be used by comparators, and using the item in trades. It is possible to control the quantity of items needed for a trade by commands and datapacks, the weight of the item in container is partially controlled by Template:Cd, and in bundles, in addition to being partially controlled by Template:Cd, it is also by Template:DCL and by Template:DCL. Furthermore, most uses of item stacks that do not depend on their count cannot be controlled to have to need it.

Components

Some components are partially controlled by changes made to the item in Survival mode. All components are strongly controlled by commands, although not entirely, as valid data is still required.

It is also possible to control the components of future item instances via datapacks, such as controlling the components of items in a Minecraft:loot table, the components of the result of many Minecraft:recipes (but not all, especially when the recipe result depends on the ingredient components), the components of the gives in villager Minecraft:trade, or the components of items that are in structures but are not part of a loot table (such as some chests in secret rooms of the Minecraft:woodland mansion).

However, there are origins of items that are not controlled by datapacks or commands, thus making it impossible to control the initial components of these items without Minecraft:mods (although it is possible to test when these items are originated and change their components later using datapacks).

Changes to an item's stack properties, depending on whether or not a certain component has it, can vary considerably. In some cases, the component affects all items that possess it and is highly customizable. In other cases, the component only affects stack items with certain IDs, or the component doesn't have much customizable data. Furthermore, some components affect more than one item property, making it impossible to activate only some of them.

Sometimes, properties that can be controlled by components have a lower priority than properties that depend on the item's ID, to the point that being used on certain items partially or completely loses its effect.

Template:Anchor Default components

Default components are components that are defined for each item ID. If an item stack does not have a component defined in the component field, but has it as its default component, it will consider the value of its default component. If it has the component in the component field, it will consider the value of the component field.

With commands and datapacks, this control only extends to additional components, not default components. Default components depend solely on the item's ID and cannot be customized.

It is possible to remove a component of an item stack with Template:Cd. However, this will modify the item's data, adding a new component that serves to remove the previous one. This can impact, for example, comparisons of item data via commands, or picking up a block with a mouse click (since the block is only selected from your inventory if it doesn't have additional components).

Furthermore, some aspects of the items depend on their default component. For example, knowing which spawn egg will be picked up when clicking on an entity, or the villager controlling the number of items in the inventory to know whether to drop it.

Id

Often, an item's stack property depends on its ID. Sometimes it depends only on its ID, and other times it depends on both its ID and its components or count. The main objective of this article is to describe the item properties that depend on their ID; however, not all will be covered, as some item properties that depend on their ID are actually controlled by data packs and not hardcoded.

Note that all these properties, being controlled by ID and not by component, cannot be made so that only some item stacks possess them, because when adding an ID, all item stacks with the same ID will share it. Thus, customizing properties by component instead of ID is more powerful. Due to this and the impossibility of registering new IDs, it is possible that data pack projects will not be viable because they do not have enough items to define properties with different IDs.

Item tags

Many of an item's properties depend exclusively on it belonging to a certain item tag. Sometimes an item tag is used to describe a property that can also be changed at another time; for example, using a tag in a vanilla datapack file would allow you to directly use the item IDs there. However, there are item properties that can only be manipulated without mods by adding them to a tag. See item tag.

Recipes

Recipes can control the properties of items to be used in the manufacture of others. Although largely customizable, there are still some limitations, especially when considering the components of the ingredients for the final result. See Minecraft:recipes.

Enchantment definition

When defining an enchantment, it is necessary to define the items in Template:Cd and Template:Cd to specify which items can be crafted at the anvil and the enchanting table, respectively. See Minecraft:enchantment definition.

Mixed properties

Some properties may depend on the item's id, component, and count. Below is a list of these properties that can be controlled by data packs or commands.

Trade

Trade can be controlled either by commands (with Template:Cmd, editing villager data) or by Minecraft:villager trade definition. With them, you define the properties of an item stack, which can be trade for another by the villagers.

Item predicate

The item predicate is a sub-predicate of Minecraft:predicates. Predicates can be used to test if a certain item satisfies a certain condition, and if so, contribute to the activation a certain Minecraft:loot table or Minecraft:advancement trigger. Loot tables are used to obtain items at various times. Advancement triggers, in addition to being used to receive advancements, are also used to unlock recipes.

Predicates are even more important for customizations, being used in commands or in advancement triggers to activate functions. Some commands like Template:Cmd are also very important in testing items and have an effect. Although we can use such commands to simulate a hardcoded item property or inhibit properties of certain items, this will hardly be done in a completely similar way, and the hardcoded properties will continue to exist, only being inhibited or copied.

Code structure

There are at least three ways in which the game code describes the properties of an item associated with its ID.

Item.Properties

In class Template:Jicp, the game defines a series of functions that can be applied to an item and change its properties. However, the vast majority of these properties ultimately only modify the item's default data components

A complete list of default components in Template:V can be seen at Template:V-diff/items misode/mcmeta. The list for Template:V can be found here. Template:Collapse

Used item Component Used in
Template:ItemLink Template:DCL Template:ItemLink
Template:ItemLink Template:DCL Template:ItemLink
Template:ItemLink Template:DCL Template:ItemLink
Template:ItemLink Template:DCL Template:ItemLink
Template:ItemLink Template:DCL Template:ItemLink
Template:ItemLink Template:DCL Template:ItemLink
Template:ItemLink Template:DCL Template:ItemLink
Template:ItemLink Template:DCL Template:ItemLink
Template:ItemLink Template:DCL Template:ItemLink
Template:ItemLink Template:DCL
(all faces)
Template:InvLink

Template:Collapse

A notable exception is the Template:Cd property, which defines which item will remain in a recipe when using the item as a recipe. See below for a list of all craft reminders:

Item Craft remainder Vanilla use
Template:ItemLink Template:ItemLink Minecraft:Cake recipe.
Template:ItemLink Template:ItemLink Fuel remainder in Minecraft:smelting.
Template:ItemLink Template:ItemLink None.
Template:ItemLink Template:ItemLink Minecraft:Honey block and Minecraft:sugar recipes.
Template:ItemLink Template:ItemLink Ingredient remainder in Minecraft:brewing.Template:Note

All craft remainder can also be used in custom Minecraft:recipes via Minecraft:data packs. In code is also used in the craft display item, however it apparently hasn't been implemented in the gameTemplate:Info needed.

Adding the component Template:DCL to one of the items above allows it to be used as fuel while also having a crafting remainder. In the book and banner cloning recipe, the cloned item (Template:Cd and Template:Cd) remains if it doesn't have a craft remainderTemplate:Note; if it does have a crafting remainder, the crafting remainder takes priority.

Another exception is the item Template:Cd, which can be Template:Cd or Template:Cd. Although its primary use is for the item name, the Template:DCL default component, this description id is also used for other things such as potion names and disc fragment descriptions.

The last exception is the Template:Cd property, although it's not important in the current version. It serves to list which Minecraft:experiments must be active to use a certain item in many cases. Currently, no item is exclusive to any experiment; thus, all have this property with its default value Template:Cd.

Most of the Template:Cd applied to items are applied from the item's registered in Template:Jicp.

Item subclasses (code structure)

In the Template:Jcp package, there are many classes that define properties for a certain item or a certain set of items; these classes extend the Template:Jicp class. A large part of the hardcoded item properties come from here.

These classes have Template:Cd as their name, such as Template:Cd, Template:Cd, and Template:Cd.

In many cases, when an item is registered in Template:Jicp, it is already created as a new instance of one of these classes.

Some of them are abstract classes, not having any item that is restricted as a new instance of that class; however, these classes are extended by other classes, and so on until reaching a class that is at least one item, which is then restricted as a new instance of the class.

Most of the properties of an item defined as belonging to a specific subclass are defined within the subclass itself. However, sometimes in other classes, Template:Cd is used to test if a certain item is an item of that class, and thus new properties can be defined for the item.

List

The table below shows the classes that extend Template:Jicp and the IDs of the items that are restricted as instances of them (in Template:Jicp).

See Template:Slink for details.

Items class member access

In many parts of the game's code, within many contexts, direct access to an item's restricted area is used, by Template:Jicp member access, allowing to determine a property of that item.

In certain cases, this item call only serves to create the vanilla datapack, for example by creating item tags, recipes, Minecraft:loot tables and trades. Therefore, this is a property that can be fully controlled by Minecraft:datapacks. However, it's worth noting that many of these properties that we can fully control through data packs (and not through components) can only be controlled by the item's ID, not by its components.

Furthermore, in some cases, it creates a new instance of the item. This could be due to an item origin not controlled by a loot table (such as equipment or wither flowers), a visual effect (such as using items in a GUI), or some other use (such as a mob using an item as a projectile). In these cases, we are not strictly talking about an item property, as we are not discussing how a pre-existing item modifies the game.Template:Note

List

The table below shows all the classes that has a Template:Jicp memmber access, and the number of uses in each class. According to the code of Minecraft:26.1.

Legend:

  • red The background indicates that all items within that class are used only for generating the vanilla datapack/resourepack.
  • yellowThe background indicates that all items within them are a new instance, representing an item's origin, visual use, etc., and not a property of a pre-existing item.

See Template:Slink, for details of the classes without note

Item class

Template:Expand section

onUseTick(...)

onUseTick
Declaration Header

public void

Parameters

Level level, LivingEntity livingEntity, ItemStack itemStack, int ticksRemaining

Empty, for most items, it doesn't add any properties. However, it can add properties with its implementations, see below.

Uses tree

Template:Blist

Implementations

onDestroyed(...)

onDestroyed
Declaration Header

public void

Parameters

ItemEntity itemEntity

Used for items to drop their contents to be destroyed. By default, nothing happens, having an effect only on instances of classes that implement it, see below.

Uses tree

Template:Blist

Implementations

canDestroyBlock(...)

canDestroyBlock
Declaration Header

public boolean

Parameters

ItemStack itemStack, BlockState state, Level level, BlockPos pos, LivingEntity user

Returns false if the player is in Template:Tooltip and the item has the Template:DCL component with Template:Cd set to false. In other cases it returns true.

Note that this method depends exclusively on the component and is not hardcoded. However, the method still has an implementation.

Uses tree

Template:Blist

Implementations

useOn(...)

useOn
Declaration Header

public InteractionResult

Parameters

UseOnContext context


If the Template:DCL data default of the item in hand is not empty, it attempts to transform the interacted block, with the return value depending on the transformation; otherwise, it returns Template:Cd. However, default Template:Cd data components exist only for Minecraft:hoes, Minecraft:shovels, and Minecraft:axes; many items still rely on hardcoded usage logic (see the implementations below).

Uses tree

Template:Blist

Description of the methods:

Otherwise, call the method implemented in the item stack as item. If the method returns Template:Cd increases the item Template:Cd Minecraft:statistic by one. Returns the return value of the called method.Template:More info
If the player is in the Minecraft:spectator mode:
If the player is not Minecraft:sneaking or doesn't have items in either hand:
  • The player will attempt to use the item, or the empty hand, on the block. However, for this use, the previous method will not be used, but rather Template:Cd, which is a method controlled by the block (Template:Cd). Sometimes this method will give different results depending on the item used; see Template:Sl for details.
  • If the interaction returns any success, [[Minecraft:Advancement_definition#minecraft:item_used_on_block|Template:Cd]] is activated and the method is completed, returning the same result.
  • If the interaction returns Template:Cd and the interacting hand is the mainhand, the player attempts to interact with the block using the Template:Cd method.
    • If the interaction returns any success, [[Minecraft:Advancement_definition#minecraft:default_block_use|Template:Cd]] is activated the method is completed, returning the same result.
  • If neither Template:Cd nor Template:Cd returns success, the method continues.
If the item stack is empty or in cooldown, return Template:Cd.
Finally, the Template:Cd method is called. If the player is in creative mode, the stack item quantity is restored, preventing any loss due to the called method.Template:More info If the return is successful, the Template:Cd is activated. Returns the return of the called method.
In Template:Jcp, output demo reminder and return Template:Cd, if demo timer has end. Otherwise, it calls the supermethod, so the method will proceed normally.
  • Template:Jcp.Template:Cd: Initially, it tests if the interaction is allowed, if positive, call the method. If the return of the called method is successful, the [[Minecraft:Advancement_definition#minecraft:any_block_use|Template:Cd]] is activated.
If the interaction is unsuccessful, the interaction direction is up, the interacted block is at its maximum height, and the item is a Template:Slink or Template:Slink instance with non-empty fluid and is not on cooldown, then send the system error message in Minecraft:action bar with the translation of Template:Cd with the maximum height value of the dimension.
If the return of the called method is Template:Cd or Template:Cd, the player swings the hand used.
Template:More info

Implementations Template:Columns-list Template:Font color The implementation uses a supermethod, calling that method.

use(...)

finishUsingItem(...)

isBarVisible(...)

getBarWidth(...)

getBarColor(...)

overrideStackedOnOther(...)

overrideOtherStackedOnMe(...)

getAttackDamageBonus(...)

getItemDamageSource(...)

hurtEnemy(...)

postHurtEnemy(...)

mineBlock(...)

interactLivingEntity(...)

inventoryTick(...)

onCraftedPostProcess(...)

getUseAnimation(...)

getUseDuration(...)

releaseUsing(...)

appendHoverText(...)

getTooltipImage(...)

getName(...)

isFoil(...)

useOnRelease(...)

getDefaultInstance()

canFitInsideContainerItems()

shouldPrintOpWarning(...)

Item subclasses

Template:Expand section Only subsections marked with an asterisk (Template:Past) aren't empty.

Template:Columns-list

AirItem

Template:Infobox hip

Air has a block Template:Cd, meaning its translation key is Template:Cd. However, unlike other items with this Template:Cd, air is not an instance of Template:Jicp, because Template:Jicp does not extend Template:Jicp.

getName(Template:Tooltip) Template:Hatnote

Defined ignoring the item stack components, therefore, it is always a translation of Template:Cd regardless of the component Template:DCL.

This has an effect on stacked items that are treated as if they were air (for example, items with a count of 0).

Note that many other properties of the air item are defined elsewhere in the code. See Template:Slink.

ArmorStandItem

Template:Infobox hardcoded item property

useOn(Template:Tooltip) Template:Hatnote

If the interaction involves clicking on the bottom face of a block, it fails.

The target position for placing the Minecraft:armor stand is the bottom center of the block next to the interacted block, in the direction of the interacted face. The game simulates the Minecraft:hitbox of an armor stand in this position; if the hitbox collides with a block or intersects with an entity hitbox (except Minecraft:spectators), the interaction fails.

The game attempts to obtain the armor stand, based on the item's components Template:DCL, Template:DCL, and Template:DCL. If it cannot be generated, the interaction fails.

If the armor stand is generated, apply in the following order:

The interaction returns success given no aforementioned fails occur.

Armor stand entity data:

ArrowItem

Template:Infobox hardcoded item property

createArrow(Template:Tooltip)

Creates an Template:Cd projectile entity from the item.

Used by Template:Cd in Template:Slink, and by Minecraft:skeletons and Minecraft:illusioners via Template:Slink.

For regular arrows, creates an arrow projectile with:

asProjectile(Template:Tooltip) Template:Hatnote

Creates an arrow projectile not fired from any weapon, used by Minecraft:dispensers and Minecraft:ominous item spawners, with:



BannerItem

Template:Infobox hardcoded item property

getColor()

Used by the [[Minecraft:Recipe_(Java_Edition)#crafting_special_*|Template:Cd]] recipe type to determine whether the banner colors match, and by the [[Minecraft:Recipe_(Java_Edition)#crafting_special_*|Template:Cd]] recipe type to set the Template:DCL of the shield.

This is done by calling the Template:Cd method of Template:Cd on the item's block form, and as such the block forms of a Template:Cd must extend Template:Cd.


BlockItem

Template:Expand section Template:Infobox hardcoded item property

Each item in this class is associated with a block, defined in Template:Jicp. With few exceptions, the item has the same id as the associated block and Template:Cd is the item's Template:Cd.

Item overrides methods

useOn(Template:Tooltip) Template:Hatnote

Try placing the block with Template:Cd (see Template:Slink for details).

If the result of place is any success and the item does not have the component Template:DCL, return that result from place. Otherwise, use the item (see Template:Slink) and return the result of use.

shouldPrintOpWarning(Template:Tooltip) Template:Hatnote

If the player has Minecraft:Permission level gamemaster (level 2) and the item has the component Template:DCL, it returns true if the block entity id is Template:Cd, Template:Cd, Template:Cd, Template:Cd, Template:Cd, or Template:Cd. Otherwise, it returns false.

canFitInsideContainerItems() Template:Hatnote

Returns false if the associated block is an instance of Template:Jbcp, in other words, one of the 17 Minecraft:shulker boxes.

onDestroyed(Template:Tooltip) Template:Hatnote

Set the Template:DCL component of the entity item to empty. If the component existed previously, drop all the item stacks it contained at the entity item's position.

Place

Template:Empty section

Block by item

Template:Expand section

There are two methods in Template:Jicp related to associating the item with its associated block and vice-versa:

In Template:Jicp, ItemBlocks are registered using either the Template:Cd method or the Template:Cd method.

In Template:Cd given a block, an item is created with the same id, and with the block description id, after that Template:Cd is used to save the block and item in Template:Cd. There are some variations, which can be summarized as: adding default components to the item (by Template:Slink), making the item a different class, a subclass of ItemBlock and put alternative blocks in Template:Jicp.Template:Cd.

Only two items have alternate blocks:

However, in Template:Slink, there is an override of Template:Cd, adding the wallblock corresponding to each item in the list.

In Template:Cd the item's ID is defined separately and uses the item's description ID. Items can have other default components, but it is always a BlockItem and not a subclass. Below is the complete list of items registered with this method:

Resin clump and nether wart has the same ID but it still has different ID descriptions.

The method Template:Cd is only used in Template:Jicp, however Template:Cd has many more uses.

[...]

The Template:Jicp.Template:Cd map is used in the Template:Jicp.Template:Cd method, where for each block it searches for its associated item, and if it doesn't exist, it associates it with the air item. This method is used only in Template:Jbcp.Template:Cd which returns the item associated with the block. The Template:Jbcp.Template:Cd method, however, has multiple uses.

[...]

Usage in instanceof

BoatItem

Template:Infobox hardcoded item property

use(Template:Tooltip) Template:Hatnote

Checks if the player is looking at a block (including fluids) and passes if not. Then checks if any pickable entities' pick hitboxes contain the player's eye position and passes if so.

Then tries to create a boat entity with a type hardcoded for each item ID at the block targeted and fails if the entity cannot be created. If it is spawned, its yaw rotation is set to the player's yaw rotation. Then fails if the boat is intersecting anything except fluid.

Finally, adds the boat to the world, produces an Template:Cd Minecraft:game event, consumes one item from the stack, adds to the item used statistic, and succeeds.


BoneMealItem

Template:Infobox hardcoded item property

All the behavior of bone meal is hardcoded in this class.

useOn(Template:Tooltip) Template:Hatnote

First calls Template:Cd. If it returns Template:Cd, the interaction succeeds, the stack shrinks by one, world event 1505 (bone meal particles and sound) is caused, and an Template:Cd Minecraft:game event is produced.

Otherwise, checks if a full solid face was clicked (passing if not) and calls Template:Cd, succeeding as described above if it returns Template:Cd. If it returns Template:Cd, the interaction passes.

growCrop(Template:Tooltip)

Tries to bone meal a Template:Cd. If it is valid, regardless of whether it succeeds, returns Template:Cd (otherwise returns Template:Cd).

Also used by Minecraft:dispensers and Template:Slink.

growWaterPlant(Template:Tooltip)

Attempts to grow plants underwater, defaulting to Minecraft:seagrass. Returns Template:Cd if the block next to the clicked face is not a full water block, and Template:Cd otherwise.

If used in a biome in Template:Tag link, the block next to the clicked face is replaced with a random block in Template:Tag link if a side face was clicked, and other seagrass blocks that would be placed have a 1/4 chance of being replaced with random blocks from Template:Tag link.

Also used by Minecraft:dispensers.


BottleItem

Template:Infobox hardcoded item property

use(Template:Tooltip) Template:Hatnote

First checks for Minecraft:area effect clouds owned by an Minecraft:ender dragon (i.e. dragon's breath) within 2 blocks of the player's hitbox. If there is at least one, picks one and reduces its radius by 0.5, plays the Template:Cd sound event, produces a Template:Cd game event, triggers the Template:Cd advancement trigger, transforms a bottle (or all of them, if the player is in Creative mode) into Minecraft:dragon's breath, and succeeds.

If there is not any dragon's breath, checks if the player is interacting with water (passing otherwise) and plays the Template:Cd sound event, produces a Template:Cd game event, transforms a bottle (or all of them) into a Minecraft:water bottle, and succeeds.


BowItem

Template:Empty section

BrushItem

Template:Empty section

BucketItem

Template:Empty section

BundleItem

Template:Empty section

CompassItem

Template:Infobox hardcoded item property

isFoil(Template:Tooltip) Template:Hatnote

Overridden to Template:Cd if this stack has the Template:DCL component.

inventoryTick(Template:Tooltip) Template:Hatnote

If this stack has the Template:DCL component, updates the tracker (i.e. sets it to empty if it is invalidated).

useOn(Template:Tooltip) Template:Hatnote

If the clicked block was a Minecraft:lodestone, instead play the Template:Cd sound event and create a lodestone compass by setting the Template:DCL component. If in creative mode or with a stack size greater than 1, all components are copied to a new item that gains Template:DCL and the original stack is shrunk by one. The interaction succeeds.

getName(Template:Tooltip) Template:Hatnote

If this stack has the Template:DCL component, instead return the lodestone compass item name (translation Template:Cd)

CrossbowItem

Template:Empty section

CushionItem

Template:Update Template:Infobox hardcoded item property

useOn(Template:Tooltip) Template:Hatnote

Position the cushion. Method partially described in Template:Slink.

The interaction fails if the clicked face is not the up fece. Otherwise, summon an Axis-Aligned Bounding Box (AABB) with size of a cushion's hitbox (16×4×16 pixels), the X and Z axes centered on the interlocking block, and the minimum of the Y-axis at the clicked position.

If a cushion cannot survive in the AABB block (Template:Jcp.Template:Cd), the interaction fails. The test consists of invoking a new AABB block with the same width, but Template:Frac of a pixel higher than the existing AABB block, below the existing AABB. Then, it checks if at least one block position (entire position) containing the new AABB has a block whose interaction box intersects the AABB. If no block intersects, the test fails.

At this point, the interaction returns success on the client side, and so the player moves their hand. Although the interaction may still fail on the server side, as described below:

  • If the hitbox of an existing cushion is intersected by the AABB, the interaction fails.
  • Try summoning a cushion, with Template:Cd and Template:Cd defined repeatedly by the Template:DCL and Template:DCL components of the item stack. If, for some reason, it is not possible to invoke it, the interaction fails.
  • Position the cushion in the same position as the AABB. The y-rotation of the cushion is defined by Template:Cd, where Template:Cd is the player's y-rotation. The x-rotation is defined as zero.
  • Set the cushion color to match the item color (the item color is defined by ColorCollection when registering them).
  • Play Minecraft:sound event cushion place (Template:Sound)
  • Produce the Minecraft:game event Template:Cd (output 14)
  • Consumes one item from the player, except if the player is in Template:Tooltip.

The interaction returns success given no aforementioned fails occur.

DebugStickItem

Template:Infobox hardcoded item property

Handles all the behavior of the Minecraft:debug stick as described on its page.

canDestroyBlock(Template:Tooltip) Template:Hatnote

Always returns Template:Cd, and triggers an interaction selecting a block state.

useOn(Template:Tooltip) Template:Hatnote

Triggers an interaction cycling the value of a block state, failing if that interaction fails (if the player cannot use game master blocks, if the block has no properties, or if the item does not have the Template:DCL component) and succeeding otherwise.


DiscFragmentItem

Template:Infobox hardcoded item property

appendHoverText(Template:Tooltip) Template:Hatnote

Define the first line of the tooltip as the translation of Template:Cd in gray (Template:Color).

This line cannot be hidden by the Template:DCL component, except to completely hide the tooltip with Template:Cd set to Template:Cd.

DoubleHighBlockItem

Template:Infobox hardcoded item property

placeBlock(Template:Tooltip) Template:Hatnote

Sets the block above to water if there is water above (including waterlogged blocks) and air otherwise before placing the block normally, effectively replacing the block above while leaving water intact for waterlogging.Template:Info needed


DyeItem

Template:Infobox hardcoded item property

Each item has a default Template:DCL component, defined in Template:Jicp.

When two sheep, cats, or dogs breed, take the color of each parent (the color of the wool or the color of the collar) and search all items that have the component Template:Cd of that color as a default and try to create the first recipe for each pair. If the result of some of these recipes is an item with the component Template:Cd, that color will be used for the offspring; otherwise, a random color from the parents is added.

Thus, the color of these animals depends on the hardcoded property of the dyes, and the color can only be edited along with the item's recipes. Only dyes have the component Template:Cd by default, and each value of the component exists in exactly one dye.

interactLivingEntity(Template:Tooltip) Template:Hatnote

The interaction is only successful, instead of pass, when the interacting entity is a non-sheared live Minecraft:sheep of a different color than the Template:Cd component and the item stack has a Template:Cd component.

In case of success, the Minecraft:sound dye use is played, set the sheep color and shrink the item stack by one.

tryApplyToSign(Template:Tooltip) Template:Hatnote

If the stack item does not contain the Template:Cd component, it returns false.

Try changing the text color on the sign, on the side being interacted with, to the color of the dye.

In case of success, the dye used sound is played and returns true. Otherwise, returns false.

EggItem

Template:Infobox hardcoded item property

use(Template:Tooltip) Template:Hatnote

Always succeeds. Plays the Template:Cd sound effect, consumes an item, awards statistics, and spawns an egg projectile with:

The projectile is fired with an uncertainty of 1 and a power of 1.5.

asProjectile(Template:Tooltip) Template:Hatnote

Used by Minecraft:dispensers and Minecraft:ominous item spawners. Creates an egg projectile with:

No item components are used.


EmptyMapItem

Template:Infobox hardcoded item property

use(Template:Tooltip) Template:Hatnote

Always succeeds. Consumes an item, awards statistics, plays the Template:Cd sound effect, creates map data from the player's X and Z position, with a scale of 0, that tracks their position within range, and gives the player a Minecraft:filled map with its Template:DCL component pointing to that map data.


EndCrystalItem

Template:Infobox hardcoded item property

useOn(Template:Tooltip) Template:Hatnote

Fails if the block clicked is not Minecraft:obsidian or Minecraft:bedrock, or if the block above the one clicked is not empty. Then checks for entities in a 1x2x1 box above the clicked block and fails if there are any.

If none of those checks failed, the interaction succeeds, the stack is shrunk by 1, and an end crystal is spawned with:

No item components are used.

Triggers an Template:Cd Minecraft:game event, and checks if the Minecraft:ender dragon should be respawned if the current dimension has a dragon fight.


EnderEyeItem

Template:Infobox hardcoded item property

getUseDuration(Template:Tooltip) Template:Hatnote

Always returns 0, ignoring item components.

useOn(Template:Tooltip) Template:Hatnote

Passes if the targeted block is not an Minecraft:end portal frame or if the frame is already with eye. Then always succeeds, pushes Minecraft:entities up to compensate for the block's new shape (see details below), sets the targeted frame's Template:Cd state to Template:Cd, shrinks the stack by 1, updates attached Minecraft:comparators, and causes world event 1503.

Then checks if and where an end portal should be activated, and fills the end portal blocks accordingly, causing world event 1038 globally from the center of the 3x3 portal. See Template:Slink for more information on activating the portal.

Entity push details: all entities, except Minecraft:spectator players, whose Minecraft:bounding box intersects the new parte of the end portal frame's Minecraft:collision box (known as 8x3x8 pixels, centered on the top face) are subject to push attempts. The entity attempts to move one block upward and stops when it ceases to intercept the collision box; if it fails, it does not move. If it succeeds, it teleports. Note that this moves entities like Minecraft:cushions, which normally don't move.

use(Template:Tooltip) Template:Hatnote

Passes if the player is targeting an end portal frame, even if filled.

Then starts using the item, and tries to find a structure in Template:Tag link, using the same method used in Template:Cmd. The found structure is not necessarily the closest<ref>Template:Bug</ref>. The search process occurs in the following steps.

  1. If the tag is empty, the Minecraft:debug flag Template:Cd is enable, or world option Generate Structures is false, return null
  2. List all Minecraft:structure sets that have at least one structure in the tag, prioritizing structures in tag order. If the list is empty, return null.
  3. For all Template:Cd type structure sets, search for all Minecraft:chunks where the set of structures can be positioned and check if any exist. If found a structure that is in the tag, consider it as block position Template:Cd. Save the block position in Template:Cd and in Template:Cd the Minecraft:euclidian distance from the player's block to that position, if it is the first structure found or if the distance is less than or equal to the previous Template:Cd.
  4. For all Template:Cd type structure sets, search for structures in a 201×201 grid of N×N chunks, where N is the Template:Nbt of the structure set. For each region, a structure is searched for up to one structure.
    • First, search in regions closest to the center, with a Minecraft:manhattan distance (radius varying from 0 to 100). For regions with the same manhattan distance, prioritize those with the smallest X-axis; for regions with the same X-axis, prioritize those with the smallest Z-axis.
    • Upon finding a structure (that is in the tag) with a certain radius, no further searches are made for structures with larger radius, from any structure set. This can lead to premature searches when finding a structure with a large spacing.
    • Upon finding a structure (that is in the tag) with a certain radius, no further searches are made for structures from the same structure set. This creates priority for structures with smaller X or Z axes, even if they are further away from other structures in the same structure set.
    • Each structure found saves its position depending on its chunk position and the Template:Nbt of the structure set. If the player's block position distance is less than or equal to Template:Cd, update Template:Cd and Template:Cd.
  5. Retunr Template:Cd (null if none is found).

The interaction ends and returns to consume if nothing is found.

If one is found, a Template:Cd Minecraft:game event is produced, and an eye of ender projectile is created with:

The ender eye is set to target to the structure, but this is not serialized as NBT data<ref>Template:Bug</ref>. They are saved in three local variables, all of which are reset when the entity is reloaded:

Finally, trigger the advancement trigger [[Minecraft:Advancement_definition#minecraft:used_ender_eye|Template:Cd]], with a distance is calculated by Template:Cd, where Template:Cd are the distance from the player and Template:Cd, the Template:Cd sound event is played at a Template:Tooltip pitch between 0.33 and 0.5, an item is consumed, and Minecraft:statistics (Template:Cd) are awarded. Return success_server.

EnderpearlItem

Template:Infobox hardcoded item property

use(Template:Tooltip) Template:Hatnote

Always succeeds. Plays the Template:Cd sound effect, consumes an item, awards statistics, and spawns an ender pearl projectile with:

  • Template:Nbt Entity data
    • Template:Nbt: Template:Cd
    • Template:Nbt:
    • Template:Nbt: It depends on the owner's rotation (<math>xRot</math> and <math>yRot</math>):
      • Template:Nbt: <math>\left( -\sin\left(yRot \cdot \pi/180\right) \cdot \cos\left(xRot \cdot \pi/180\right) + 0.0172275 \cdot \left(\text{nextDouble}() - \text{nextDouble}()\right) \right) \cdot 1.5</math>
      • Template:Nbt: <math>\left( -\sin\left(xRot \cdot \pi/180\right) + 0.0172275 \cdot \left(\text{nextDouble}() - \text{nextDouble}()\right) \right) \cdot 1.5</math>
      • Template:Nbt: <math> \left( \cos\left(yRot \cdot {\pi}/{180}\right) \cdot \cos\left(xRot \cdot \pi/180\right) + 0.0172275 \cdot \left(\text{nextDouble}() - \text{nextDouble}()\right) \right) \cdot 1.5</math>
    • Template:Nbt: It depends on the Template:Nbt (<math>xMot</math>, <math>yMot</math>, <math>zMot</math>):
      • Template:Nbt: <math>\operatorname{atan2}\left(yMot, \, (xMot)^2 + (zMoy)^2\right) \cdot 57.2957763671875</math>
      • Template:Nbt: <math>\operatorname{atan2}\left(xMot, \, zMot\right) \cdot 57.2957763671875</math>
    • Template:Nbt: a copy of the item stack with the count set to 1.
    • Template:Nbt: The player Minecraft:UUID.
    • Template:Nbt: NBT ags that vary by entity effect according to enchantments with the Template:Cd effect component on the Template:DCL item component. It is calculated last. Such effects have an eventual scope beyond the tags.

The projectile is fired with an uncertainty of 1 and a power of 1.5, defined the motion and rotation (see above).



ExperienceBottleItem

Template:Infobox hardcoded item property

use(Template:Tooltip) Template:Hatnote

Always succeeds. Plays the Template:Cd sound effect, consumes an item, awards statistics, and spawns an experience bottle projectile with:

The projectile is fired with an uncertainty of 1, a power of 0.7, and a pitch offset of -20°.

asProjectile(Template:Tooltip) Template:Hatnote

Used by Minecraft:dispensers and Minecraft:ominous item spawners. Creates an experience bottle projectile with:

No item components are used.

createDispenseConfig() Template:Hatnote

Sets the projectile to be dispensed at 0.5 times the default uncertainty and 1.25 times the default power.

See Minecraft:Projectile#Shot from dispenser for these values.


FireChargeItem

Template:Infobox hardcoded item property

useOn(Template:Tooltip) Template:Hatnote

First checks if the targeted block is an unlit Minecraft:campfire, Minecraft:soul campfire, Minecraft:candle, dyed candle, Minecraft:cake with candle, or cake with dyed candle. If so, its Template:Cd state is set to Template:Cd, the Template:Cd sound effect is played, a Template:Cd Minecraft:game event is produced.

If not, checks if a Minecraft:fire block can be placed adjacent to the clicked face, and if so places the fire block, emits the sound effect, produces a Template:Cd game event.

If either case succeeded, the stack is shrunk by 1 and the interaction succeeds. Otherwise the interaction fails.

asProjectile(Template:Tooltip) Template:Hatnote

Used by Minecraft:dispensers and Minecraft:ominous item spawners. Randomizes the direction slightly and creates a small fireball projectile with:

shoot(Template:Tooltip) Template:Hatnote

Overridden to do nothing, since Template:Nbt is set by Template:Cd instead.

createDispenseConfig() Template:Hatnote

Sets the projectile to be dispensed fully outside the dispenser, with an uncertainty of 6.6666665, a power of 1, and a world event override of 1018.


FireworkRocketItem

Template:Infobox hardcoded item property

useOn(Template:Tooltip) Template:Hatnote

Passes if not used by a gliding player. Otherwise succeeds, shrinking the stack by 1 and spawning a firework rocket projectile with:

use(Template:Tooltip) Template:Hatnote

Passes unless the player is gliding. Otherwise succeeds, breaking all Minecraft:leads attached to the player (and playing Template:Cd if there were any), consuming one item, awarding statistics, and spawning a firework rocket projectile stuck to the player (which is not serialized as NBT data) with:

asProjectile(Template:Tooltip) Template:Hatnote

Creates a firework rocket projectile with:

createDispenseConfig() Template:Hatnote

Sets the projectile to be dispensed 0.50001 blocks away from the center of the dispenser, with an uncertainty of 1, a power of 0.5, and a world event override of 1004.


FishingRodItem

Template:Infobox hardcoded item property

use(Template:Tooltip) Template:Hatnote

Always succeeds.

If the player does not already have a fishing hook attached:

  • Template:Nbt Entity data
    • Template:Nbt: Template:Cd
    • Template:Nbt: The player UUID.
    • Template:Nbt: The player's eye position, offset by 0.3 blocks in the XZ plane in the direction of their Y rotation.
    • Template:Nbt: The vector pointing away from the player in the XZ plane, with a Y motion of <math>clamp(-\tan(-xRotation), -5, 5)</math>, normalized with a length of 0.6, and then offset on each axis by random numbers in a triangular distribution around 0.5 with a spread of 0.0103365.
    • Template:Nbt:
      • Template:Nbt <math>atan2(Motion.x, Motion.z)</math> to degrees
      • Template:Nbt <math>atan2(Motion.y, length(Motion.xz))</math> to degrees
    • Template:Nbt: NBT ags that vary by entity effect according to enchantments with the Template:Cd effect component on the Template:DCL item component. It is calculated last. Such effects have an eventual scope beyond the tags.

If the player does already have a fishing hook attached:

  • The fishing bobber is retrieved.
  • The item stack is damaged by one of these criteria:
    • 3 if an item stack was hooked.
    • 5 if another entity was hooked.
    • 1 if the bobber got a bite fishing, which then rolls the Template:Cd loot table and creates the resulting item.
    • 2 if the bobber was on the ground.
    • 0 by default.
  • The Template:Cd sound effect is played.
  • An Template:Cd game event is produced.


FlintAndSteelItem

Template:Infobox hardcoded item property

useOn(Template:Tooltip) Template:Hatnote

First checks if the targeted block is an unlit Minecraft:campfire, Minecraft:soul campfire, Minecraft:candle, dyed candle, Minecraft:cake with candle, or cake with dyed candle. If so, its Template:Cd state is set to Template:Cd, the Template:Cd sound effect is played, a Template:Cd Minecraft:game event is produced, the item stack is damaged by 1, and the interaction succeeds.

If not, checks if a Minecraft:fire block can be placed adjacent to the clicked face, and if so places the fire block, emits the sound effect, produces a Template:Cd game event, triggers the Template:Cd advancement trigger, damages the item by 1, and succeeds.

If the fire block cannot be placed the interaction fails.


FoodOnAStickItem

Template:Infobox hardcoded item property

Each FoodOnAStickItem has an interactable entity type and an amount to damage the item when used, set for each item ID:

use(Template:Tooltip) Template:Hatnote

If the player is riding an entity that is Template:Cd and that is the entity type set for this item, the entity is boosted, the item is damaged by the amount set for this item, and if it breaks it is converted to Template:Cd (with all components copied, count set to 1, and damage set to 0). The interaction succeeds.

If those conditions are not met, the item used statistic is awarded and the interaction passes.

GameMasterBlockItem

Template:Infobox hardcoded item property

getPlacementState(Template:Tooltip) Template:Hatnote

Overridden to null if placed by a player that cannot use game master blocks (i.e. is not in Creative mode), making place interactions fail.


GlowInkSacItem

Template:Infobox hardcoded item property

tryApplyToSign(Template:Tooltip) Template:Hatnote

Try changing Template:Cd on the Minecraft:sign's front or back text (depending on isFrontText) to Template:Cd.

If successful, the Template:Cd sound effect is played and returns Template:Cd. Otherwise (if the text was already glowing) returns Template:Cd.


HangingEntityItem

Template:Empty section

HangingSignItem

Template:Empty section

HoneycombItem

Template:Empty section

InkSacItem

Template:Info needed section

InstrumentItem

Template:Empty section

ItemFrameItem

Template:Empty section

KnowledgeBookItem

Template:Empty section

LeadItem

Template:Empty section

LingeringPotionItem

Template:Empty section

MaceItem

Template:Empty section

MapItem

Template:Empty section

MinecartItem

Template:Empty section

MobBucketItem

Template:Empty section

NameTagItem

Template:Infobox hardcoded item property

interactLivingEntity(Template:Tooltip) Template:Hatnote

The interaction will only be successful, instead of pass, when:

If the entity is alive, sets its Template:Cd to be the same as the name tag. If the entity is a mob, also sets Template:Cd true. Shrink the item stack of the item by one.

Note: This method is only called for living entities, so it ends up being a redundant under certain conditions. Even though the ender dragon is a living entity, this method is never called by it because when trying to interact with it, the Template:Cd is actually being interacted, which is not a living entity.

PlaceOnWaterBlockItem

Template:Info needed section

PlayerHeadItem

Template:Info needed section

PotionItem

Template:Infobox hardcoded item property

useOn(Template:Tooltip) Template:Hatnote

The interaction will only be successful, instead of pass, when:

  • the face of the interacted block was not directed downward,
  • the block is in the #convertable_to_mud tag, and
  • the potion's content is water.

In case of success, apply in the following order:

  1. Play the generic splash Minecraft:sound event (Template:Cd),
  2. Set Minecraft:glass bottle in hand,
  3. Send splash particles,
  4. Play the bottle empty sound event (Template:Cd),
  5. Produce the Minecraft:game event Template:Cd,
  6. Convert the block to Minecraft:mud.

getName(Template:Tooltip) Template:Hatnote

If the item has the component Template:Cd, the name name is defined from it. The item uses the translation key Template:Cd, where Template:Cd is the custom name of the potion contents, if available, and otherwise is the name of the potion in potion contents (see Template:Slink), if available. If nether is available, is "Template:Cd".

This name will replace the name defined by Template:DCL. However, it can still be replaced by the Template:DCL, if available.

ProjectileWeaponItem

Template:Empty section

ScaffoldingBlockItem

Template:Empty section

ShearsItem

Template:Info needed section

ShieldItem

Template:Infobox hardcoded item property

getName(Template:Tooltip) Template:Hatnote

If the item has the component Template:DCL, the name is defined from it. The item uses the translation key Template:Cd.

This name will replace the name defined by Template:DCL component. However, it can still be replaced by the Template:DCL component, if available.


SmithingTemplateItem

Template:Infobox hardcoded item property

New SmithingTemplateItem

Each instance of SmithingTemplateItem has a series of class-specific attributes, which are defined by Template:Cd. However, these attributes are not defined separately for each item; instead, they are defined by the Template:Cd and Template:Cd methods, where respectively defines the attributes of netherite upgrade and of all armor trims. In Template:Jicp, only the item components are defined (by Template:Slink, which in this case is only the Template:DCL component).

These methods use the Template:Cd, Template:Cd, Template:Cd, and Template:Cd auxiliary methods, and many auxiliary constants to create these attributes. Below is the complete table of these attributes:

Attribute Items Value
appliesTo Armor Trim Minecraft:Text component format Template:Cd
Text in Template:Mono "Armor" (Template:Color)
Netherite Upgrade Text component format Template:Cd
Text in Template:Mono "Diamond Equipment" (Template:Color)
ingredients Armor Trim Text component format Template:Cd
Text in Template:Mono "Ingots & Crystals" (Template:Color)
Netherite Upgrade Text component format Template:Cd
Text in Template:Mono "Netherite Ingot" (Template:Color)
baseSlotDescription Armor Trim Text component format Template:Cd
Text in Template:Mono "Add a piece of armor" (Template:Color)
Netherite Upgrade Text component format Template:Cd
Text in Template:Mono "Add diamond armor, weapon, or tool" (Template:Color)
additionsSlotDescription Armor Trim Text component format Template:Cd
Text in Template:Mono "Add ingot or crystal" (Template:Color)
Netherite Upgrade Text component format Template:Cd
Text in Template:Mono "Add Netherite Ingot" (Template:Color)
baseSlotEmptyIcons Armor Trim Asset ID

Template:Flatlist

Textures

Template:Flatlist

Netherite Upgrade Asset ID Template:Flatlist
Textures Template:Flatlist
additionalSlotEmptyIcons Armor Trim Asset ID Template:Flatlist
Textures Template:Flatlist
Netherite Upgrade Asset ID Template:Flatlist
Textures Template:Flatlist

Asset ID refers to textures file path in Template:Mono.

Append hover text

public void appendHoverText(Template:Tooltip) Template:Hatnote

Add the following lines to the beginning of the item's tooltip, in order:

Smithing table screen

There are 4 methods that always give the assigned values ​​of the sprint items, namely Template:Cd, Template:Cd, Template:Cd, and Template:Cd. All of them are used only in the Template:Jcp class. This class defines the behavior of the menu slots in the Minecraft:smithing table, controlling both the sprint that appears in empty slots and the tooltip when hovering the mouse over an empty slot. Furthermore, this class uses two instanceof of SmithingTemplateItem (and in no other class of the code is it used instanceof of SmithingTemplateItem).

Slot background

Slots 0, 1, and 2 of the menu use a rendering of their variable background given by a list of identifiers (asset IDs), defined by the class Template:Jcp. With each tick update:

  • If the icons list is different from the old icons list, update the icons list and reset the index of the list to zero.
  • If the current list is not empty:
    • Increase the tick count by one.
    • If the tick count is a multiple of 30, increase the index of the identifier by one; return to zero if it exceeds the limit of the list.

And when render the slot background:

  • If the list is empty or the slot is not empty: do nothing.
  • If the tick count is greater than 30 and fewer than t + a < 4.0, where t is how many ticks have passed the last multiple of 30: render the previous icon (one index lower or the last one in the list if the index is zero) with Template:Cd transparency.Template:More info
  • Renderize the current index with Template:Cd of transparency.

Note that in this way each icon occupies the slot for 30 ticks and has a smooth transition of 4 ticks.

In Template:Jcp, each tick updates the tick of Template:Jcp, from slots 0, 1, and 2, with a list that may vary:

Template:Flatlist
  • For slot 1, if there is no instance of SmithingTemplateItem in slot 0, the list is empty. If there is, it is the Template:Cd of the item.
  • For slot 2, if there is no instance of SmithingTemplateItem in slot 0, the list is empty. If there is, it is the Template:Cd of the item.

Boarding Tooltips

Depending on the mouse position, among other factors, the switcher table menu renders a tooltip.

  • Mouse over a rectangular area around the arrow: if the recipe has an error (has items in slots 0, 1, and 3 but no result): "Item can't be upgraded this way" (Template:Color)
  • If the mouse is in slot 0 and it is empty: "Add Smithing Template" (Template:Color)
  • If the mouse is in slot 1, it is not empty, and slot 0 has an instance of SmithingTemplateItem: the Template:Cd from item in slot 0.
  • If the mouse is in slot 2, it is not empty, and slot 0 has an instance of SmithingTemplateItem: the Template:Cd from item in slot 0.
  • In any other case: it does not render a menu tooltip (although it continues to render item tooltips normally).

SnowballItem

Template:Empty section

SolidBucketItem

Template:Empty section

SpawnEggItem

Template:Empty section

SpectralArrowItem

Template:Empty section

SplashPotionItem

Template:Empty section

SpyglassItem

Template:Info needed section

StandingAndWallBlockItem

Template:Info needed section

ThrowablePotionItem

Template:Empty section

TippedArrowItem

Template:Empty section

TridentItem

Template:Empty section

WindChargeItem

Template:Empty section

WritableBookItem

Template:Infobox hardcoded item property

use(Template:Tooltip) Template:Hatnote

Open item GUI and increases the Template:Cd Minecraft:statistic by one. Always returns successful.

Note:

The item GUI depends on the components Template:DCL and Template:DCL. Therefore:

  • If the item does not have either component: nothing is opened, but there is still an increase in statistics and usage animation.
  • If the item has only one of these components: the corresponding GUI opens.
  • If both components are present: both GUIs open, but the written book content GUI completely overlays the writable book content GUI, which the player can see briefly on the screen.

Therefore, the GUI are entirely dependent on the components and independent of the item ID. However, it is only possible to open them with the Minecraft:book and quill and Minecraft:written book, since only these items attempt to open the GUI.

WrittenBookItem

Template:Infobox hardcoded item property

use(Template:Tooltip) Template:Hatnote

Completely identical to Template:Cd; see the Template:Slink.



Items member access

Blocks

Template:Columns-list

Entity

Template:Columns-list

Client Template:Columns-list Item Template:Columns-list Loot Template:Columns-list

Misc Template:Columns-list

CauldronInteractions

Template:Empty section

DispenseItemBehavior

Template:Expand section Template:Infobox hardcoded item property

bootStrap()

Defines the item's behavior when Minecraft:dispenser. The behaviors Template:Cd and Template:Cd are largely defined uniquely for each item.

Item Behavior
Template:InvLink ProjectileBehavior
Template:InvLink
Template:InvLink
Template:ItemLink
Template:InvLink
Template:InvLink
Template:InvLink
Template:InvLink
Template:InvLink
Template:InvLink
Template:InvLink
Template:InvLink DefaultDispenseItemBehavior
Template:InvLink OptionalDispenseItemBehavior
Template:ItemLink BoatDispenseItemBehavior
Template:ItemLink
Template:InvLink filledBucketBehavior
Template:InvLink
Template:InvLink
Template:ItemLink
Template:InvLink DefaultDispenseItemBehavior
Template:InvLink OptionalDispenseItemBehavior
Template:InvLink OptionalDispenseItemBehavior
Template:InvLink OptionalDispenseItemBehavior
Template:BlockLink shulkerBoxDispenseBehavior
Template:InvLink OptionalDispenseItemBehavior
Template:InvLink OptionalDispenseItemBehavior
Template:InvLink ShearsDispenseItemBehavior
Template:InvLink OptionalDispenseItemBehavior
Template:InvLink OptionalDispenseItemBehavior
Template:InvLink DefaultDispenseItemBehavior
Template:InvLink MinecartDispenseItemBehavior
Template:InvLink
Template:InvLink
Template:InvLink
Template:InvLink
Template:InvLink


AnvilMenu

Template:Infobox hardcoded item property

createResult()

If the Minecraft:anvil input is an enchanted book, it will initially consider any Minecraft:enchantment as compatible. However, if the enchantment is the same or does it conflict with any enchantment in the current list of enchantments in the result, it will no longer be considered compatible.

In other words, it's as if the enchanted book were in [[Minecraft:Enchantment_definition#JSON_format|Template:Cd]] for all enchantment definition, when we consider the anvil.


CartographyTableMenu

Template:Infobox hardcoded item property

mayPlace(Template:Tooltip) Template:Hatnote

Returns true only if it is one of the three items listed above. Used to determine which items can be placed in the slot 1 of the Minecraft:cartography table.

setupResultSlot(Template:Tooltip)

Used to define the result item of the cartography table:

  • If it's paper and the Template:Cd is not locked and has a scale less than 4, the resulting is one copy of the Template:Cd with the Template:DCL component set to 1 (SCALE).
  • If it's empty map, the resulting is two copy of the Template:Cd.

Note: It's possible to use the cartography table regardless of the Template:Cd ID; it only needs to have the Template:Cd component with data. However, when retrieving an item that the ID isn't filled_map with the Template:Cd component, the game crashes<ref>Template:Bug</ref>. However, using the empty map still works for item duplication.

quickMoveStack(Template:Tooltip)

When using the quick click (Template:Keys + click) in the inventory with the cartography table menu is open, it attempts to move these items to slot 1. Notes:

  • If the item has the Template:Cd component, it attempts to move it to slot 0 and does not go to slot 1 (even if it fails to go to slot 0).
  • This prevents quick clicking from moving them between storage slots and hotbar slots and vice versa, when the cartography table menu is open. Even if the itens fails to move to the slot 1.


EnchantmentMenu

Template:Infobox hardcoded item property

Template:ItemSprite mayPlace(Template:Tooltip) Template:Hatnote

Only lapis lazuli can be placed in the slot 1 of Minecraft:enchantment table.

Template:ItemSprite clickMenuButton(Template:Tooltip)

Right before a book is enchanted on an enchantment table, it becomes an Minecraft:enchanted book.

Template:ItemSprite getEnchantmentList(Template:Tooltip)

When creating a list of enchantments to enchant a book on an enchantment table, remove one enchantment at random if the list has more than one enchantment.

Template:ItemSprite quickMoveStack(Template:Tooltip)

When using the quick click (Template:Key + click) in the inventory with the enchantment table menu is open, it attempts to move the lapis lazuli to slot 1. This prevents quick clicking from moving the lapis lazuli to slot 0.


FurnaceFuelSlot

Template:Infobox hardcoded item property

isBucket(Template:Tooltip)

Check if the item is a bucket. Used twice to determine the behavior of the fuel slot (the lower left slot in blocks Minecraft:furnace, Minecraft:smoker, and Minecraft:blast furnace):

  • In Template:Cd, to allow the bucket to be used in the fuel slot, even if it is not Minecraft:fuel (i.e it does has not the component Template:DCL).
    • This does not change the quick move. Because what is tested to determine if an item can have a quick move to the fuel slot is whether it is a fuel.
  • In Template:Cd, to limit the maximum number of buckets in the fuel slot to one.


GrindstoneMenu

Template:Infobox hardcoded item property

removeNonCursesFrom(Template:Tooltip)

When using an enchanted book on the Minecraft:grindstone, after all non-curses enchantments have been removed, if the enchanted book does not retain an (curse) enchantment, it is transmuted into a Minecraft:book.


BeehiveBlock

Template:Infobox hardcoded item property

useItemOn(Template:Tooltip)

It encodes the interaction of an item on a Minecraft:bee nest and on a Minecraft:beehive.

If the honey level is less than 5, or the item is not one of those listed below, the interaction returns 'try with empathy hand', otherwise returns success. The interaction depends on the item:

  • If the item is a shears, apply in the following order:
  • If is glass bottle, apply in the following order:
    • shrink the item by one;
    • the sound event bottle fill (Template:Cd) is played;
    • give the player a Minecraft:honey bottle, placing it in their hand if it's empty; otherwise, try placing it in their inventory. If that's not possible, the honey bottle is dropped;
    • and produce the game event Template:Cd.

For both items, after that, increases the item used Minecraft:statistic by one and test if the beehive is in the smoke. If not, proceed in the following order:

  • if there is at least one bee in the hive, each Minecraft:bee in a 17x13x17 area around the hive becomes aggressive toward a random player in the same area;
  • all the bees leave the hive and become aggressive toward the player.

Then, even if the beehive is in the smoke, the honey level is reduced to zero.


CandleCakeBlock

Template:Infobox hardcoded item property

useItemOn(Template:Tooltip)

When interacting with an flint and steel or a fire charge on a cake with candle or a cake with dyed candle, the method immediately returns Template:Cd. The effect of these items on the cake is determined by Template:Cd in its classes (see Template:Slink, Template:Slink and Template:Slink).

This also prevents the player from trying to eat the cake, unlike all other items. Note that with these items, the player cannot eat the cake even if the candle is already lit.

ChiseledBookShelfBlock

Template:Infobox hardcoded item property

addBook(Template:Tooltip)

When adding an enchanted book to the Minecraft:chiseled bookshelf, use Minecraft:sound event Template:Cd (Template:Sound) instead of Template:Cd (Template:Sound).

Note: The items that can be added to the chiseled bookshelf are controlled by the tag Template:Tag link, therefore it is not a hardcoded property.

removeBook(Template:Tooltip)

When remove an enchanted book to the chiseled bookshelf, use sound event Template:Cd (Template:Sound) instead of Template:Cd (Template:Sound).

OutputContainer

Template:Infobox hardcoded item property

canTakeItemThroughFace(Template:Tooltip)

Returns whether a Template:Cd 8 Minecraft:composter face can move an item to a Minecraft:hopper or Minecraft:minecart with hopper.

Returns true iff the face is dowm, the item to be removed is a bone meal, and no item has been removed from the container.

In practice, requiring the item to be bone meal doesn't change anything, as this is the only item that can be in the simple container, and this is hardcoded when generating the simple container. Although this may change with Minecraft:mods or future updates (such as composter extraction being controlled by a Minecraft:loot table).

Whenever a hopper is enabled and not Template:Tooltip, it attempts to remove an item from the composter; even if it fails, the composter is emptied. For example, a hopper with a single redstone in each slot under a composter will empty it but won't extract anything.<ref>Template:Bug</ref>

LightBlock

Template:Infobox hardcoded item property

getShape(Template:Tooltip)

Define the light block shape. The shape depends on the context; if the player is holding the light item, it will be a full block; otherwise, it will be empty.

PowderSnowBlock

Template:Infobox hardcoded item property

canEntityWalkOnPowderSnow(Template:Tooltip)

Used in Template:Cd to help test whether the Minecraft:powder snow has a full block Minecraft:collision box.

Returns true iff the entity is in Template:Tag link tag or the entity is a living entity and has a leather border in the Template:Cd slot.

By Template:Cd the powder snow's collision box is empty by default, but it can change depending on the context:

  • If it is being placed or the context does not have an entity: empty
  • If the entity is falling for more than 2.5 blocks: A column of 16×14.4×16 pixels
  • If the entity is a falling block: Full block (16×16×16)
  • If the entity is above the block, isn't Minecraft:sneaking and Template:Cd: Full block (16×16×16)


PumpkinBlock

Template:Infobox hardcoded item property

useItemOn(Template:Tooltip)

When using a shears on a Minecraft:pumpkin, instead of returning 'try_with_empty_hand' like other items, returning 'success' and occurs:


RespawnAnchorBlock

Template:Infobox hardcoded item property

isRespawnFuel(Template:Tooltip)

Used in Template:Cd to test if the item is fuel for the Minecraft:respawn anchor. Returns true iff the item is a glowstone.

In Template:Cd, when use the glowstone on the respawn anchor with Template:Cd < 4, the following occurs:

If the player has glowstone in their offhand but in their mainhand, and is interacting with the mainhand, and the Template:Cd is less than 4, returns 'pass' instead of 'try with empty hand'. This prevents the setting respawn and exploding at the anchor at the same time.

SweetBerryBushBlock

Template:Infobox hardcoded item property

useItemOn(Template:Tooltip)

If the item stack is a bone meal and the Minecraft:sweet berry bush's Template:Cd is not 3, the maximum, then return 'pass' instead of 'try with empty hand'. This causes the bone meal effect to be applied (see Template:Slink and Template:Slink) and prevents the attempt to harvest the sweet berry bush.

TntBlock

Template:Infobox hardcoded item property

useItemOn(Template:Tooltip)

If the item used in Minecraft:TNT is one of these:

Otherwise, it returns 'try with empty hand' (but currently TNT has no effect on Template:Cd, thus is the same that return 'pass').

TripWireBlock

Template:Infobox hardcoded item property

playerWillDestroy(Template:Tooltip)

When a player destroys a Minecraft:tripwire, just before it is removed, if the item in mainhand is a shears:

After the tripwire is broken, it updates the neighboring blocks as if it still existed and was Template:Cd true. This causes the Template:Tooltip Minecraft:tripwire hook to recalculate its stats, considering this wire as "wireSource". If Template:Cd is false, the tipwire hook will set its Template:Cd to true (because has a connected tripwire that is Template:Cd and not Template:Cd). If Template:Cd is true, because the disarmed tripwire is the "wireSource", it will set the tripwire hood's Template:Cd to false, and consequently set Template:Cd to false. In both cases, because there is a "wireSource", the tripwire hood will be recalculated its stats at 10 ticks (this time without a "wireSource", and probably resulting in both Template:Cd and Template:Cd false).

In other words, unless there are other tripwire interfering:


WeatheringCopperGolemStatueBlock

Template:Infobox hardcoded item property

useItemOn(Template:Tooltip)

When using an item that is not in Template:Tag link in the Minecraft:copper golem statue, Minecraft:exposed copper golem statue, Minecraft:weathered copper golem statue, or Minecraft:oxidized copper golem statue:

If the item is in the tag Template:Cd:

  • If the block is (unaffected) copper golem statue it will try to generate a copper golem, if successful it will return Template:Cd.
  • Else, return Template:Cd.


WitherSkullBlock

Template:Infobox hardcoded item property

canSpawnMob(Template:Tooltip)

Used to test if an item to be dispensed can be helpful in spawning the Minecraft:wither. For the item to be dispensed as a block, it is necessary that, in addition to this method returning true, that the Template:Cd (the target where the dispenser attempts to place the block) is Minecraft:air, cave air or void air.

Returns true if all the points below occur:

Template:BlockGrid

Requiring the item to be a wither skeleton skull is circular, since only the wither skeleton skull has the behavior in the dispenser to try to spawn the wither, and this behavior is also hardcoded (see Template:Slink). However, this property may be effective if in the future it becomes possible to customize item behaviors in the dispenser.

AbstractFurnaceBlockEntity

Template:Infobox hardcoded item property

Define the behavior of Minecraft:block entity associated with a Minecraft:furnace, Minecraft:blast furnace and Minecraft:smoker.

Template:InvLink Template:ItemSprite burn(Template:Tooltip)

Used at the end of the Minecraft:smelting process, to add the result to output slot (slot 2).

After adding the result to output slot, if the item in ingredient slot (slot 0) is a wet sponge and the item in fuel slot (slot 1) is a bucket, set a water bucket in fuel slot.

After that, shrink 1 item from ingredient slot.

Template:ItemSprite canPlaceItem(Template:Tooltip)

Tests whether a hopper, minecart with hopper or a Minecraft:dropper can place item in the container.

It always returns true for ingredient slot (slot 0) and always returns false for output slots (slot 2).

For fuel slot (slot 1), it returns true if the item is fuel (has a data component Template:DCL) or if the item is a bucket but there is no bucket already in the slot.

Note: the up face only gives access to ingredient slot (slot 0), and the side faces only give access to fuel slot (slot 1).

BrewingStandBlockEntity

Template:Infobox hardcoded item property

Define the behavior of Minecraft:block entity associated with a Minecraft:brewing stand.

canTakeItemThroughFace(Template:Tooltip)

Tests whether the item in the container can be take by a hopper or minecart with hopper.

Returns true only if the slot is not the slot 3, or if the slot is 3 and the item is a glass bottle.

This was probably intended to take the glass bottle that could be obtained by using a single Minecraft:dragon's breath in slot 3, by the craft remainder.

Note: The down face not give access to slot 4, since the hoppers only try to take items from the down face, they should never take items from slot 4.

VaultConfig

Template:Infobox hardcoded item property

VaultConfig()

Define the default Template:Cd in the Template:Cd in Template:Cd Minecraft:block entity as trial key. So the trial key can open Minecraft:vaults whose Template:Cd has not been changed.

However, it is possible to change the Template:Cd using commands, this key property only applies to default vaults.

AgeableMob

Template:Infobox hardcoded item property

canUseGoldenDandelion(Template:Tooltip)

Returns true when the following occur simultaneously:

This method is used twice:

  • Template:Jcp.Template:Cd — The Template:Cd parameter is always true, and the Template:Cd is the same as above. Before testing whether the golden dandelion works, try feeding the tadpole (feed it when the item is in the Template:Tag link tag and the tadpole is not age-locked). If it doesn't feed, try using the golden dandelion; if successful, set it to age-locked and return it to the Template:Cd. Otherwise, try to catch the tadpole in the bucket.

When age locked is set, it occurs in order:

  1. Invert the value of the NBT tag Template:Cd;
  2. Sets the Template:Cd to 0 for tadpoles, −48000 for sniffers, and −24000 for other mobs;
  3. Set Template:Cd to 40;
  4. Consume one item from the player's hand.
  5. If age is locked:
Otherwise

Bucketable

Template:Infobox hardcoded item property


Entity

Template:Infobox hardcoded item property


interact(Template:Tooltip)

Attempt to interact with the entity in the following order. If one attempt fails, try the next.

1. The player attempts to attach entities currently leashed to them onto the entity being interacted with. This interaction does not depend on the item held in hand. If at least one entity is successfully leashed, the interaction returns success (and concludes).

2. If the item held is shears, attempt to remove the leashes from the entity being interacted with.

  • This attempts to remove both the leash securing the interacted entity and any leashes from nearby entities (within a 32×32×32 cuboid centered on the interacted entity) that are attached to the interacted entity.
  • When a leash is removed, it is dropped at the position of the leashed entity.

If at least one leash is dropped:

3. Attempts to remove equipment from the entity. This is only possible if the following conditions are met simultaneously:

  • The entity is a Minecraft:mob
  • The player is holding shears
  • The player is not [[Minecraft:crouching|Template:Control]]
  • If the entity is a wolf, the player is its owner; otherwise, the entity is not being ridden
  • At least one item in the entity's equipment slots has Template:DCL set to true and, unless the player is in Creative mode, does not have an enchantment with Template:Cd effect components (e.g., Minecraft:Curse of Binding in vanilla)

In this case, a piece of equipment can be removed:

  • The shears take one of damage
  • Produce the Minecraft:game event Template:Cd
  • Drop the equipment
  • Triggered [[Minecraft:Advancement_definition#minecraft:player_sheared_equipment|Template:Cd]] advancement trigger
  • The interaction returns success.

At most, one piece of equipment is dropped at a time, in the following order of slot priority: main hand, off-hand, feet, legs, chest, head, body and saddle.

4. wip

Mob

CrossbowAttack

TradeWithVillager

UseBonemeal

WorkAtComposter

BegGoal

BowAttackGoal

RangedCrossbowAttackGoal

Armadillo

Axolotl

Camel

AbstractCow

MushroomCow

AbstractChestedHorse

AbstractHorse

Horse

Llama

Goat

CopperGolem

IronGolem

SnowGolem

Panda

Pig

Sheep

Wolf

ArmorStand

LeashFenceKnotEntity

Creeper

CrossbowAttackMob

Strider

Illusioner

Pillager

Piglin

PiglinAi

PiglinBrute

AbstractSkeleton

Bogged

Drowned

DrownedTridentAttackGoal

Zombie

ZombieVillager

Villager

Template:Infobox hardcoded item property

mobInteract(Template:Tooltip)

When interacting with a Minecraft:villager, if the interaction use a villager spawn egg, if the villager is sleeping, currently trading, or is not alive, the interaction returns the result of the supermethod (see Template:Slink). Note that if the item is the villager spawn egg, it always returns pass.

This prevents starting a Minecraft:trade or Template:Cd (for babies and villagers without trades), and returns success.

However, if the supermethod returns pass, it try to equip the item on the villager, by the Template:DCL component, via the Template:Jicp.Template:Cd method.

The addition of the villager spawn egg check was likely intended to ensure the egg spawns a baby villager instead starting a trade; however, in the interaction check order, the attempt to spawn a baby villager with a spawn egg occurs before this method. Consequently, it is possible to spawn a baby villager using any spawn egg that possesses the Template:DCL component with the ID Template:Cd. This property also allows the villager spawn egg to be equipped, provided it does not have the Template:DCL component with the ID Template:Cd (which requires removing the default component), which does not occur with other items.<ref>Template:Bug</ref>


VillagerProfession

WanderingTrader

Player

FireworkRocketEntity

FishingHook

ProjectileUtil

ClientLevel

AbstractClientPlayer

ItemInHandRenderer

AbstractSkeletonRenderer

DrownedRenderer

LivingEntityRenderer

WitchRenderer

Template:Info needed section

AvatarRenderer

CuboidItemModelWrapper

Charge

Ingredient

CrossbowItem

EnchantmentHelper

Item (member access)

ItemStack

ItemStackTemplate

ProjectileWeaponItem

EnchantRandomlyFunction

FillPlayerHead

SetEnchantmentsFunction

SetStewEffectFunction

EntityEquipmentPredicate

Old article stub

Template:Msgbox

List

Template:Collapse

History

Template:Info needed section

Template:HistoryTable

Notes

Template:Notelist

References

Template:Reflist

Contents