Minecraft:Hardcoded item properties (Java Edition): Difference between revisions
More actions
Sync: updated from Minecraft |
Sync: updated from Minecraft |
||
| (35 intermediate revisions by the same user not shown) | |||
| Line 4: | Line 4: | ||
{{project|Hardcoded item}} | {{project|Hardcoded item}} | ||
{{cleanup}} | {{cleanup}} | ||
[[ | <!--{{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|none|limit=2}} | |||
== Item stacks properties == | == Item stacks properties == | ||
| Line 35: | 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 74: | Line 77: | ||
'''Item predicate''' | '''Item predicate''' | ||
The item predicate is a | 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|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|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 82: | 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 | 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 | 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 99: | 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]] | | {{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 | 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 | 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}} | 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 116: | 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| | 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 138: | Line 168: | ||
|- | |- | ||
|ArrowItem || arrow | |ArrowItem || arrow | ||
|- | |- | ||
|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 | ||
|- | |- | ||
|BlockItem || {{Collapse| | |BlockItem || {{Collapse| | ||
| Line 211: | 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 | ||
|- | |- | ||
|HoneycombItem || honeycomb | |HoneycombItem || honeycomb | ||
| Line 253: | Line 277: | ||
|- | |- | ||
|ShieldItem || shield | |ShieldItem || shield | ||
|- | |- | ||
|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 323: | 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 658: | Line 682: | ||
|{{jicp|-Stack}} || || 4 | |{{jicp|-Stack}} || || 4 | ||
|- | |- | ||
|{{jicp|-StackTemplate}} || | |{{jicp|-StackTemplate}} || || 1 | ||
|- | |- | ||
|{{jicp|Map}} || {{tc|Rarely|New instance}} || 1 | |{{jicp|Map}} || {{tc|Rarely|New instance}} || 1 | ||
| Line 766: | Line 790: | ||
|{{jbcp|entity.vault|VaultConfig}} || || 1 | |{{jbcp|entity.vault|VaultConfig}} || || 1 | ||
|- | |- | ||
|{{jcp|net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorPresets.Bootstrap}} || {{tc| | |{{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 800: | Line 824: | ||
===getDefaultMaxStackSize()=== | ===getDefaultMaxStackSize()=== | ||
--> | --> | ||
===onUseTick(...)=== | === onUseTick(...) === | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ style="text-align: left | onUseTick | |+ style="text-align: left | onUseTick | ||
| Line 823: | 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| | |{{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: | {{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 892: | Line 915: | ||
|} | |} | ||
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 927: | Line 950: | ||
|} | |} | ||
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 951: | 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 | ItemStack transformTo = success.heldItemTransformedTo() == null ? this : success.heldItemTransformedTo(); | ||
: If the player is in the [[Minecraft:spectator]] mode: | |||
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 961: | 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 972: | Line 1,004: | ||
{{columns-list|colwidth=16em| | {{columns-list|colwidth=16em| | ||
* {{ItemLink|Armor Stand|ArmorStandItem|link=#ArmorStandItem}} | * {{ItemLink|Armor Stand|ArmorStandItem|link=#ArmorStandItem}} | ||
* {{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 984: | Line 1,016: | ||
* {{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|Honeycomb|HoneycombItem|link=#HoneycombItem}} | * {{ItemLink|Honeycomb|HoneycombItem|link=#HoneycombItem}} | ||
* {{ItemLink|Lead|LeadItem|link=#LeadItem}} | * {{ItemLink|Lead|LeadItem|link=#LeadItem}} | ||
| Line 992: | 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|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,042: | 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|banners|BannerItem|link=#BannerItem}}{{past|ga}} | |||
* {{ItemLink|banners|BannerItem|link=#BannerItem | |||
* {{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|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 | * {{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,098: | 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|signs|SignItem|link=#SignItem}} | * {{ItemLink|signs|SignItem|link=#SignItem}} | ||
* {{ItemLink|smithing templates| | * {{ItemLink|smithing templates| | ||
| Line 1,121: | Line 1,148: | ||
=== AirItem === | === AirItem === | ||
{{Infobox hip|class=AirItem|block= | {{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}}, air 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 | ''' getName({{tooltip|...|ItemStack itemStack}})''' | ||
{{hatnote|Overrides method in [[#getName(...)|{{jicp|}}]] }} | {{hatnote|Overrides method in [[#getName(...)|{{jicp|}}]] }} | ||
| Line 1,136: | Line 1,163: | ||
=== ArmorStandItem === | === ArmorStandItem === | ||
{{Infobox | {{Infobox hardcoded item property|class=ArmorStandItem|Armor Stand}} | ||
'''useOn({{tooltip | '''useOn({{tooltip|...|UseOnContext context}})''' | ||
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]]}} | {{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]]}} | ||
If the interaction involves clicking on the | 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 ( | 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. | ||
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 [[Minecraft:sound event]] armor stand place ({{cd|entity.armor_stand.place}}) is played; | ||
* | * The [[Minecraft:game event]] {{cd|entity_place}} is produced; | ||
* | * 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 === | |||
{{ | {{Infobox hardcoded item property|class=ArrowItem|Arrow|Spectral Arrow|Tipped Arrow|impts={{cd|ProjectileItem}}||impns= | ||
*{{slink||SpectralArrowItem}} | |||
*{{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}}. | ||
{{hatnote|Overrides method in [[# | |||
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 === | |||
{{Infobox hardcoded item property|class=BannerItem|Items={{ItemLink|Banner|id=Banners}} (ColorCollection)|ext= | |||
{{Slink||StandingAndWallBlockItem}} ({{Slink||BlockItem}} )}} | |||
'''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 | {{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||DoubleHighBlockItem}} | *{{slink||DoubleHighBlockItem}} | ||
*{{slink||GameMasterBlockItem}} | *{{slink||GameMasterBlockItem}} | ||
| Line 1,223: | Line 1,295: | ||
====Place==== | ====Place==== | ||
{{empty section}} | |||
====Block by item==== | ====Block by item==== | ||
| Line 1,295: | Line 1,368: | ||
=== BoatItem === | === BoatItem === | ||
{{ | {{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 === | ||
{{ | {{Infobox hardcoded item property|class=BoneMealItem|Bone Meal}} | ||
=== BottleItem === | |||
{{ | All the behavior of bone meal is hardcoded in this class. | ||
=== BowItem === | |||
{{empty section}} | '''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 === | |||
{{empty section}} | |||
=== BrushItem === | === BrushItem === | ||
{{empty section}} | {{empty section}} | ||
| Line 1,309: | Line 1,430: | ||
{{empty section}} | {{empty section}} | ||
=== CompassItem === | === CompassItem === | ||
{{ | {{Infobox hardcoded item property|class=CompassItem|Compass}} | ||
{{ | '''isFoil({{Tooltip|...|ItemStack itemStack}})''' | ||
{{hatnote|Overrides method in [[#isFoil(...)|{{jicp|}}]] }} | |||
Overridden to {{cd|true}} if this stack has the {{DCL|lodestone_tracker}} component. | |||
'''inventoryTick({{Tooltip|...|ItemStack itemStack, ServerLevel level, Entity owner, EquipmentSlot slot}})''' | |||
{{hatnote|Overrides method in [[#inventoryTick(...)|{{jicp|}}]] }} | |||
If this stack has the {{DCL|lodestone_tracker}} component, updates the tracker (i.e. sets it to empty if it is invalidated). | |||
'''useOn({{Tooltip|...|UseOnContext context}})''' | |||
{{ | {{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]] }} | ||
{{ | |||
{{ | 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. | ||
'''getName({{Tooltip|...|ItemStack itemStack}})''' | |||
{{hatnote|Overrides method in [[#getName(...)|{{jicp|}}]] }} | |||
If this stack has the {{DCL|lodestone_tracker}} component, instead return the lodestone compass item name (translation {{cd|item.minecraft.lodestone_compass}}) | |||
=== CrossbowItem === | |||
{{empty section}} | |||
=== CushionItem === | |||
{{Update|section=1|Significant changes in [[Minecraft:26.3-snap4]]}} | |||
{{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. | |||
''' | '''canDestroyBlock({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, LivingEntity user}})''' | ||
{{hatnote|Overrides method in {{ | {{hatnote|Overrides method in [[#canDestroyBlock(...)|{{jicp|}}]] }} | ||
Always returns {{cd|false}}, and triggers an interaction selecting a block state. | |||
'''useOn({{Tooltip|...|UseOnContext context}})''' | |||
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]] }} | |||
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. | |||
{{-}} | |||
{{ | |||
=== | === DiscFragmentItem === | ||
{{ | |||
{{Infobox hardcoded item property|class=DiscFragmentItem|Disc Fragment}} | |||
{{ | |||
'''appendHoverText({{tooltip|...|ItemStack itemStack, Item.TooltipContext context, TooltipDisplay display, Consumer<Component> builder, TooltipFlag tooltipFlag}})''' | |||
{{ | {{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}}). | ||
{{ | 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}}. | ||
{{ | === DoubleHighBlockItem === | ||
=== | {{Infobox hardcoded item property|class=DoubleHighBlockItem|Items={{Flatlist|*{{BlockLink|Small Dripleaf}} | ||
{{ | *{{BlockLink|Sunflower}} | ||
== | *{{BlockLink|Lilac}} | ||
{{ | *{{BlockLink|Rose Bush}} | ||
*{{BlockLink|Peony}} | |||
{{ | *{{BlockLink|Tall Grass}} | ||
*{{BlockLink|Large Fern}} | |||
{{ | *{{BlockLink|Doors}} | ||
}}|ext={{slink||BlockItem}}}} | |||
{{ | |||
{{ | |||
{{ | |||
{{ | |||
{{ | |||
{{ | '''placeBlock({{Tooltip|...|BlockPlaceContext context, BlockState placementState}})''' | ||
{{hatnote|Overrides method in [[#BlockItem|{{jicp|Block}}]]}} | |||
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.}} | |||
{{ | |||
{{-}} | {{-}} | ||
=== DyeItem === | |||
{{Infobox hardcoded item property|class=DyeItem|Items={{ItemLink|Dye}} (ColorCollection)|impts={{cd|SignApplicator}}}} | |||
Each item has a default {{DCL|dye}} component, defined in {{jicp|-s}}. | |||
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. | |||
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. | |||
'''interactLivingEntity({{tooltip|...|ItemStack itemStack, Player player, LivingEntity target, InteractionHand type}})''' | |||
{{ | {{hatnote|Overrides method in [[#interactLivingEntity(...)|{{jicp|}}]]}} | ||
{{ | |||
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. | |||
}} | |||
In case of success, the [[Minecraft:sound]] dye use is played, set the sheep color and shrink the item stack by one. | |||
'''tryApplyToSign({{tooltip|...|Level level, SignBlockEntity sign, boolean isFrontText, Player player}})''' | |||
{{hatnote|Overrides method in {{cd|SignApplicator}}}} | |||
If the stack item does not contain the {{cd|dye}} 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 === | |||
{{Infobox hardcoded item property|class=EggItem|Blue Egg|Brown Egg|Egg}} | |||
'''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})''' | |||
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}} | |||
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: | |||
<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. | |||
'''asProjectile({{Tooltip|...|Level level, Position position, ItemStack itemStack, Direction direction}})''' | |||
{{hatnote|Overrides method in {{cd|{{jicp|Projectile}}}}}} | |||
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. | |||
{{-}} | |||
{{ | |||
=== | === EmptyMapItem === | ||
{{ | {{Infobox hardcoded item property|class=EmptyMapItem|Empty Map}} | ||
{{ | '''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})''' | ||
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]] }} | |||
{{ | |||
{{ | 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. | ||
{{-}} | |||
=== EndCrystalItem === | |||
{{Infobox hardcoded item property|class=EndCrystalItem|End Crystal}} | |||
'''useOn({{Tooltip|...|UseOnContext context}})''' | |||
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]] }} | |||
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. | |||
{{-}} | {{-}} | ||
=== | === EnderEyeItem === | ||
{{Infobox hardcoded item property|class=EnderEyeItem|Eye of Ender}} | |||
'''getUseDuration({{Tooltip|...|ItemStack itemStack, LivingEntity user}})''' | |||
{{hatnote|Overrides method in [[#getUseDuration(...)|{{jicp|}}]]}} | |||
Always returns 0, ignoring item components. | |||
'''useOn({{Tooltip|...|UseOnContext context}})''' | |||
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]]}} | |||
{| | 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. | ||
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. | |||
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. | |||
'''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})''' | |||
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}} | |||
|{{ | Passes if the player is targeting an end portal frame, even if filled. | ||
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. | |||
# 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. | ||
# 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. | |||
| | #* 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 {{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). | ||
The interaction ends and returns to consume if nothing is found. | |||
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: | |||
<div class="treeview"> | |||
* {{nbt|compound}} Entity data | |||
** {{Nbt|string|id}}: {{cd|minecraft:eye_of_ender}} | |||
** {{Nbt|list|Pos}}: The center of the player's bounding box. | |||
** {{Nbt|compound|Item}}: The item stack with the count set to 1. | |||
</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: | |||
| | * {{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. | ||
* {{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) > 0}} defined with an 80% chance of being {{cd|true}}. Set to {{cd|false}} on reload. | |||
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. | |||
{{-}} | |||
| | === EnderpearlItem === | ||
{{Infobox hardcoded item property|class=EnderpearlItem|Ender Pearl}} | |||
| | '''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})''' | ||
| | {{hatnote|Overrides method in [[#use(...)|{{jicp|}}]] }} | ||
| | |||
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: | |||
{{-}} | |||
<div class="treeview"> | |||
* {{nbt|compound}} Entity data | |||
** {{Nbt|string|id}}: {{cd|minecraft:ender_pearl}} | |||
** {{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|list|Motion}}: It depends on the owner's rotation (<math>xRot</math> and <math>yRot</math>): | |||
*** {{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> | |||
*** {{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> | |||
}} | *** {{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> | ||
** {{nbt|list|Rotation}}: It depends on the {{nbt|list|Motion}} (<math>xMot</math>, <math>yMot</math>, <math>zMot</math>): | |||
| | *** {{nbt|float}}: <math>\operatorname{atan2}\left(yMot, \, (xMot)^2 + (zMoy)^2\right) \cdot 57.2957763671875</math> | ||
{{ | *** {{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]]. | |||
** {{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 projectile is fired with an uncertainty of 1 and a power of 1.5, defined the motion and rotation (see above). | ||
{{-}} | |||
=== ExperienceBottleItem === | |||
{{Infobox hardcoded item property|class=ExperienceBottleItem|Bottle o' Enchanting}} | |||
'''use({{Tooltip|...|Level level, Player player, InteractionHand hand}})''' | |||
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}} | |||
* {{ | 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: | ||
* {{ | <div class="treeview"> | ||
* {{nbt|compound}} Entity data | |||
* {{ | ** {{Nbt|string|id}}: {{cd|minecraft:experience_bottle}} | ||
}} | ** {{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, a power of 0.7, and a pitch offset of -20°. | ||
* | '''asProjectile({{Tooltip|...|Level level, Position position, ItemStack itemStack, Direction direction}})''' | ||
{{hatnote|Overrides method in {{cd|{{jicp|Projectile}}}}}} | |||
* | |||
Used by [[Minecraft:dispenser]]s and [[Minecraft:ominous item spawner]]s. | |||
Creates an experience bottle projectile with: | |||
}} | <div class="treeview"> | ||
* {{nbt|compound}} Entity data | |||
** {{Nbt|string|id}}: {{cd|minecraft:experience_bottle}} | |||
** {{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. | ||
* {{ | '''createDispenseConfig()''' | ||
{{hatnote|Overrides method in {{cd|{{jicp|Projectile}}}}}} | |||
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 === | |||
{{Infobox hardcoded item property|class=FireChargeItem|Fire Charge}} | |||
'''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.firecharge.use}} sound effect is played, a {{cd|block_change}} [[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 {{cd|block_place}} game event. | ||
}} | |||
| | If either case succeeded, the stack is shrunk by 1 and the interaction succeeds. Otherwise the interaction fails. | ||
* | '''asProjectile({{Tooltip|...|Level level, Position position, ItemStack itemStack, Direction direction}})''' | ||
}} | {{hatnote|Overrides method in {{cd|{{jicp|Projectile}}}}}} | ||
|} | |||
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: | |||
<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 | {{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}}. | |||
{{-}} | |||
=== 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?}} | |||
=== 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 hardcoded item property|class=NameTagItem|Name Tag}} | |||
'''interactLivingEntity({{tooltip|...|ItemStack itemStack, Player player, LivingEntity target, InteractionHand type}})''' | |||
{{hatnote|Overrides method in [[#interactLivingEntity(...)|{{jicp|}}]]}} | |||
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]]. | |||
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. | |||
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. | |||
=== PlaceOnWaterBlockItem === | |||
{{info needed section|Presumably concerns lily pads and frogspawn, but what about spawn eggs and boats?}} | |||
=== 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?}} | |||
* | === PotionItem === | ||
* | {{Infobox hardcoded item property|class=PotionItem|Potion|Splash Potion|Lingering Potion|impns= | ||
* {{cd|SplashPotionItem}} | |||
* {{cd|ThrowablePotionItem}} | |||
* {{cd|LingeringPotionItem}} | |||
* | }} | ||
* | |||
'''useOn({{tooltip|...|UseOnContext context}})''' | |||
{{hatnote|Overrides method in [[#useOn(...)|{{jicp|}}]]}} | |||
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. | |||
In case of success, apply in the following order: | |||
{{ | # Play the generic splash [[Minecraft:sound event]] ({{cd|''entity.generic.splash''}}), | ||
# Set [[Minecraft:glass bottle]] in hand, | |||
{{empty | # 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|...|ItemStack itemStack}})''' | |||
{{empty | {{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. | |||
=== ProjectileWeaponItem === | |||
{{empty section}} | {{empty section}} | ||
=== | === ScaffoldingBlockItem === | ||
{{empty section}} | {{empty section}} | ||
=== | === ShearsItem === | ||
{{ | {{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}} | ||
=== ShieldItem === | |||
{{Infobox hardcoded item property|class=ShieldItem|Shield}} | |||
'''getName({{tooltip|...|ItemStack itemStack}})''' | |||
{{hatnote|Overrides method in [[#getName(...)|{{jicp|}}]]}} | |||
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>''}}. | |||
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. | |||
{{-}} | |||
=== 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}} | |||
=== | ==== 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<Identifier> baseSlotEmptyIcons, List<Identifier> 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: | ||
{| class="wikitable reset-wrap sortable" <!--style="text-align:center"--> | |||
! Attribute | |||
! Items | |||
! colspan="2"| Value | |||
|- | |||
|rowspan="4"| appliesTo | |||
< | |rowspan=2 | Armor Trim | ||
|[[Minecraft:Text component format]] | |||
|{{cd|{"translate":"item.minecraft.smithing_template.armor_trim.applies_to",color:"blue"}}} | |||
|- | |||
|Text in {{mono|en_us}} || "Armor" ({{color|Blue}}) | |||
|- | |||
|rowspan=2 | Netherite Upgrade | |||
| Text component format||{{cd|{"translate":"item.minecraft.smithing_template.netherite_upgrade.applies_to",color:"blue"}}} | |||
|- | |||
|Text in {{mono|en_us}} || "Diamond Equipment" ({{color|Blue}}) | |||
|- | |||
|rowspan="4"| ingredients | |||
|rowspan=2 | Armor Trim | |||
|Text component format||{{cd|{"translate":"item.minecraft.smithing_template.armor_trim.ingredients",color:"blue"}}} | |||
|- | |||
|Text in {{mono|en_us}} || "Ingots & Crystals" ({{color|Blue}}) | |||
|- | |||
|rowspan=2 | Netherite Upgrade | |||
| Text component format||{{cd|{"translate":"item.minecraft.smithing_template.netherite_upgrade.ingredients",color:"blue"}}} | |||
|- | |||
|Text in {{mono|en_us}} || "Netherite Ingot" ({{color|Blue}}) | |||
|- | |||
|rowspan="4"| baseSlotDescription | |||
|rowspan=2 | Armor Trim | |||
|Text component format||{{cd|{"translate":"item.minecraft.smithing_template.armor_trim.base_slot_description"}}} | |||
|- | |||
|Text in {{mono|en_us}} || "Add a piece of armor" ({{color|White}}) | |||
|- | |||
|rowspan=2 | Netherite Upgrade | |||
| Text component format||{{cd|{"translate":"item.minecraft.smithing_template.netherite_upgrade.base_slot_description"}}} | |||
|- | |||
|Text in {{mono|en_us}} || "Add diamond armor, weapon, or tool" ({{color|White}}) | |||
|- | |||
|rowspan="4"| additionsSlotDescription | |||
|rowspan=2 | Armor Trim | |||
|Text component format||{{cd|{"translate":"item.minecraft.smithing_template.armor_trim.additions_slot_description"}}} | |||
|- | |||
|Text in {{mono|en_us}} || "Add ingot or crystal" ({{color|White}}) | |||
|- | |||
|rowspan=2 | Netherite Upgrade | |||
| Text component format||{{cd|{"translate":"item.minecraft.smithing_template.netherite_upgrade.additions_slot_description"}}} | |||
|- | |||
|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}} | |||
}} | |||
|- | |||
|Textures || | |||
{{Flatlist| | |||
* [[File:Slot helmet.png|40px|class=pixel-image]] | |||
* [[File:Slot chestplate.png|40px|class=pixel-image]] | |||
* [[File:Slot leggings.png|40px|class=pixel-image]] | |||
* [[File:Slot boots.png|40px|class=pixel-image]] | |||
* {{ | |||
* {{ | |||
* {{ | |||
* {{ | |||
* | |||
* | |||
* | |||
* | |||
}} | }} | ||
|- | |||
|rowspan=2 | Netherite Upgrade | |||
| Asset ID||{{Flatlist| | |||
* {{mono|container/slot/helmet}} | |||
* {{mono|container/slot/sword}} | |||
* {{mono|container/slot/chestplate}} | |||
* {{mono|container/slot/pickaxe}} | |||
* {{mono|container/slot/leggings}} | |||
* {{mono|container/slot/axe}} | |||
* {{ | * {{mono|container/slot/boots}} | ||
* {{ | * {{mono|container/slot/hoe}} | ||
* {{ | * {{mono|container/slot/shovel}} | ||
* {{ | * {{mono|container/slot/nautilus_armor}} | ||
* {{ | * {{mono|container/slot/spear}}<ref>{{bug|MC-303941}}</ref> | ||
* {{ | }} | ||
* {{ | |- | ||
* {{ | |Textures || {{Flatlist| | ||
* {{ | * [[File:Slot helmet.png|40px|class=pixel-image]] | ||
* {{ | * [[File:Slot sword.png|40px|class=pixel-image]] | ||
* [[File:Slot chestplate.png|40px|class=pixel-image]] | |||
* [[File:Slot pickaxe.png|40px|class=pixel-image]] | |||
* {{ | * [[File:Slot leggings.png|40px|class=pixel-image]] | ||
* [[File:Slot axe.png|40px|class=pixel-image]] | |||
* | * [[File:Slot boots.png|40px|class=pixel-image]] | ||
* | * [[File:Slot hoe.png|40px|class=pixel-image]] | ||
* | * [[File:Slot shovel.png|40px|class=pixel-image]] | ||
* | * [[File:Slot nautilus_armor.png|40px|class=pixel-image]] | ||
* | * [[File:Slot spear.png|40px|class=pixel-image]] | ||
* | |||
* | |||
* | |||
* | |||
* | |||
* | |||
}} | }} | ||
|- | |||
|rowspan="4"| additionalSlotEmptyIcons | |||
|rowspan=2 | Armor Trim | |||
|Asset ID||{{Flatlist| | |||
* {{mono|container/slot/ingot}} | |||
* {{mono|container/slot/redstone_dust}} | |||
* {{mono|container/slot/lapis_lazuli}} | |||
* {{mono|container/slot/quartz}} | |||
* {{mono|container/slot/diamond}} | |||
* {{mono|container/slot/esmerald}} | |||
}} | |||
|- | |||
|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 ==== | |||
{| | '''public void appendHoverText({{Tooltip|...|ItemStack itemStack, Item.TooltipContext context, TooltipDisplay display, Consumer<Component> builder, TooltipFlag tooltipFlag}})''' | ||
{{hatnote|Overrides method in [[#appendHoverText(...)|{{jicp|}}]]}} | |||
| | |||
|{{ | Add the following lines to the beginning of the item's tooltip, in order: | ||
* "Smithing Template" ({{Color|Gray}}) | |||
** {{cd|{"translate":"item.minecraft.smithing_template",color:"gray"}}} | |||
* Empty line | |||
** {{cd|{"text":""}}} | |||
* "Applies to:" ({{Color|Gray}}) | |||
** {{cd|{"translate":"item.minecraft.smithing_template.applies_to",color:"gray"}}} | |||
* Space append to {{cd|''appliesTo''}} | |||
** {{cd|[{"text":" "},''appliesTo'']}} | |||
* "Ingredients:" ({{Color|Gray}}) | |||
** {{cd|{"translate":"item.minecraft.smithing_template.ingredients",color:"gray"}}} | |||
* Space append to {{cd|''ingredients''}} | |||
** {{cd|[{"text":" "},''ingredients'']}} | |||
==== Smithing table screen ==== | |||
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). | |||
'''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 {{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''' | |||
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" ({{color|White}}) | |||
** {{cd|{"translate":"container.upgrade.error_tooltip"}}} | |||
** When there is a recipe error, it also renders a red X above the arrow: | |||
*** [[File:GUI_error.png|28px]] {{mono|container/smithing/error}} | |||
* If the mouse is in slot 0 and it is empty: "Add Smithing Template" ({{color|White}}) | |||
|- | ** {{cd|{"translate":"container.upgrade.missing_template_tooltip"}}} | ||
* 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. | |||
* In any other case: it does not render a menu tooltip (although it continues to render item tooltips normally). | |||
|{{ | |||
|{ | |||
{{ | === SnowballItem === | ||
=== | {{empty section}} | ||
=== SolidBucketItem === | |||
{{empty section}} | |||
=== SpawnEggItem === | |||
{{empty section}} | |||
=== SpectralArrowItem === | |||
{{empty section}} | |||
=== SplashPotionItem === | |||
{{empty section}} | |||
=== SpyglassItem === | |||
{{info needed section|How does this apply its camera overlay? It's different from carved pumpkins: {{bug|MC-277451}}}} | |||
{{ | === StandingAndWallBlockItem === | ||
{{info needed section|I assume this handles torches, but are signs, hanging signs, banners and heads also relevant? what about hoppers?}} | |||
=== ThrowablePotionItem === | |||
{{empty section}} | |||
=== TippedArrowItem === | |||
{{empty section}} | |||
=== TridentItem === | |||
{{empty section}} | |||
=== WindChargeItem === | |||
{{empty section}} | |||
=== WritableBookItem === | |||
{{Infobox hardcoded item property|class=WritableBookItem|Book and Quill}} | |||
'''use({{tooltip|...|Level level, Player player, InteractionHand hand}})''' | |||
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}} | |||
{{ | Open item GUI and increases the {{cd|used}} [[Minecraft:statistic]] by one. Always returns successful. | ||
Note: | |||
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. | |||
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 === | |||
{{ | {{Infobox hardcoded item property|class=WrittenBookItem|Written Book}} | ||
{{ | '''use({{tooltip|...|Level level, Player player, InteractionHand hand}})''' | ||
{{hatnote|Overrides method in [[#use(...)|{{jicp|}}]]}} | |||
Completely identical to {{cd|WritableBookItem}}; see the {{slink||WritableBookItem}}. | |||
<br> | |||
== Items member access == | |||
'''Blocks''' | |||
{{columns-list| | |||
* | * {{BlockLink|Cauldron-top|{{jcp|net.minecraft.core.cauldron.CauldronInteractions}}|link=#CauldronInteractions}} | ||
* {{BlockLink|Dispenser|{{jcp|net.minecraft.core.dispenser.DispenseItemBehavior}}|link=#DispenseItemBehavior}} | |||
* | * {{BlockLink|Anvil|{{jcp|net.minecraft.world.inventory.AnvilMenu}}|link=#AnvilMenu}} | ||
* {{BlockLink|Cartography Table|{{jcp|net.minecraft.world.inventory.CartographyTableMenu}}|link=#CartographyTableMenu}} | |||
* {{BlockLink|Enchanting Table|{{jcp|net.minecraft.world.inventory.EnchantmentMenu}}|link=#EnchantmentMenu}} | |||
* {{BlockLink|Lit Furnace|{{jcp|net.minecraft.world.inventory.FurnaceFuelSlot}}|link=#FurnaceFuelSlot}} | |||
* {{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}} | |||
}} | |||
'''Entity''' | |||
{{ | {{columns-list|colwidth=16em| | ||
* {{InvLink|Golden Dandelion|{{jcp|net.minecraft.world.entity.AgeableMob}}|link=#AgeableMob}} | |||
* {{EntityLink|salmon|{{jcp|net.minecraft.world.entity.Bucketable}}|link=#Bucketable}} | |||
{{ | * {{ItemLink|Lead|{{jcp|net.minecraft.world.entity.Entity}}|link=#Entity}} | ||
* {{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}} | |||
* {{EntityLink|Villager|{{jcp|net.minecraft.world.entity.ai.behavior.TradeWithVillager}}|link=#TradeWithVillager}} | |||
{{ | * {{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}} | |||
* {{ItemLink|Bone|{{jcp|net.minecraft.world.entity.ai.goal.BegGoal}}|link=#BegGoal}} | |||
* {{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}} | ||
* {{EntityLink|Armadillo|{{jcp|net.minecraft.world.entity.animal.armadillo.Armadillo}}|link=#Armadillo}} | |||
* {{EntityLink|Axolotl|{{jcp|net.minecraft.world.entity.animal.axolotl.Axolotl}}|link=#Axolotl}} | |||
* {{EntityLink|Camel|{{jcp|net.minecraft.world.entity.animal.camel.Camel}}|link=#Camel}} | |||
{{ | * {{EntityLink|Cow|{{jcp|net.minecraft.world.entity.animal.cow.AbstractCow}}|link=#AbstractCow}} | ||
=== | * {{EntityLink|mooshroom|{{jcp|net.minecraft.world.entity.animal.cow.MushroomCow}}|link=#MushroomCow}} | ||
{{ | * {{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}} | |||
* {{EntityLink|Llama|{{jcp|net.minecraft.world.entity.animal.equine.Llama}}|link=#Llama}} | |||
* {{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}} | |||
* | * {{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}} | ||
* | * {{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}} | |||
}} | |||
''' | '''Client''' | ||
{{columns-list|colwidth=16em| | |||
* {{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''' | |||
{{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}} | |||
}} | |||
{{- | '''Misc''' | ||
{{columns-list|colwidth=16em| | |||
{{ | * {{ItemLink|ominous-banner|{{jcp|net.minecraft.advancements.criterion.EntityEquipmentPredicate}}|link=#EntityEquipmentPredicate}} | ||
}} | |||
=== CauldronInteractions === | |||
{{empty section}} | |||
=== DispenseItemBehavior === | |||
{{Expand section}} | |||
{{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}} | |||
'''bootStrap()''' | |||
Defines the item's behavior when [[Minecraft:dispenser]]. The behaviors {{cd|OptionalDispenseItemBehavior()}} and {{cd|DefaultDispenseItemBehavior()}} are largely defined uniquely for each item. | |||
{|class="wikitable sortable collapsible" | |||
! Item !! Behavior | |||
|- | |||
|{{InvLink|Arrow}} | |||
|rowspan="11"|ProjectileBehavior | |||
|- | |||
|{{InvLink|Tipped Arrow}} | |||
|- | |||
{ | |{{InvLink|Spectral Arrow}} | ||
|- | |||
|{{ItemLink|Eggs}} | |||
|- | |||
|{{InvLink|Snowball}} | |||
|- | |||
|{{InvLink|Bottle o' Enchanting}} | |||
|- | |||
|{{InvLink|Splash Potion}} | |||
|- | |||
|{{InvLink|Lingering Potion}} | |||
|- | |||
|{{InvLink|Firework Rocket}} | |||
|- | |||
|{{InvLink|Fire Charge}} | |||
|- | |||
| | |{{InvLink|Wind Charge}} | ||
|- | |||
|{{InvLink|Armor Stand}} ||DefaultDispenseItemBehavior | |||
|- | |||
|{{InvLink|Chest}} ||OptionalDispenseItemBehavior | |||
|- | |||
|{{ItemLink|Boats}} | |||
|rowspan="2"|BoatDispenseItemBehavior | |||
|- | |||
|{{ItemLink|Boats with chest|id=All boats with chest}} | |||
| | |- | ||
| | |{{InvLink|Lava Bucket}} | ||
|rowspan="4"|filledBucketBehavior | |||
| | |- | ||
|{{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 === | ||
{{Infobox | {{Infobox hardcoded item property|class=AnvilMenu|Enchanted book|pac=world.inventory}} | ||
''' | '''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 [[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. | |||
{{ | 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. | ||
{{-}} | |||
=== CartographyTableMenu === | |||
{{Infobox hardcoded item property|class=CartographyTableMenu|Paper|Empty Map|Glass Pane|pac=world.inventory|Inv=t}} | |||
'''mayPlace({{Tooltip|...|ItemStack itemStack}})''' | |||
{{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]]. | |||
''' | '''setupResultSlot({{tooltip|...|ItemStack mapStack, ItemStack additionalStack, ItemStack resultStack}})''' | ||
Used to define the result item of the cartography table: | |||
{{ | * 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. | ||
''' | * 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). | ||
* 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). | |||
* If it's empty map, the resulting is ''two'' copy of the {{cd|''mapStack''}}. | |||
''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. | |||
'''quickMoveStack({{Tooltip|...|Player player, int slotIndex}})''' | |||
{{ | |||
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. | |||
{{-}} | {{-}} | ||
=== | === EnchantmentMenu === | ||
{{Infobox hardcoded item property|class=EnchantmentMenu|Book|Lapis Lazuli|pac=world.inventory}} | |||
{{ | {{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}})''' | |||
Right before a book is enchanted on an enchantment table, it becomes an [[Minecraft:enchanted book]]. | |||
{{ItemSprite|book}} '''getEnchantmentList({{tooltip|...|RegistryAccess access, ItemStack itemStack, int slot, int enchantmentCost}})''' | |||
{{ | |||
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. | |||
{{ItemSprite|lapis lazuli}} '''quickMoveStack({{Tooltip|...|Player player, int slotIndex}})''' | |||
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. | |||
{{-}} | {{-}} | ||
=== | === FurnaceFuelSlot === | ||
{{Infobox | {{Infobox hardcoded item property|class=FurnaceFuelSlot|Bucket|pac=world.inventory}} | ||
'''isBucket({{Tooltip|...|ItemStack itemStack}})''' | |||
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 {{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. | |||
{{-}} | {{-}} | ||
=== GrindstoneMenu === | |||
{{Infobox hardcoded item property|class=GrindstoneMenu|Enchanted Book|pac=world.inventory}} | |||
'''removeNonCursesFrom({{Tooltip|...|ItemStack 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]]. | |||
{{-}} | {{-}} | ||
=== | === BeehiveBlock === | ||
{{Infobox | {{Infobox hardcoded item property|class=BeehiveBlock|Shears|Glass Bottle|pac=world.level.block}} | ||
'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult(ItemStack item}})''' | |||
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: | |||
** 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}}. | |||
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 === | |||
{{Infobox hardcoded item property|class=CandleCakeBlock|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}})''' | |||
{{ | 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}}). | ||
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}} | |||
'''addBook({{tooltip|...|Level level, BlockPos pos, Player player, ChiseledBookShelfBlockEntity bookshelfBlock, ItemStack itemStack, int slot}})''' | |||
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}}). | |||
Note: the | 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. | ||
{{ | |||
'''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}}}} | |||
'''canTakeItemThroughFace({{Tooltip|...|final int slot, final ItemStack itemStack, final Direction direction}})''' | |||
Returns whether a {{cd|level}} 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 {{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. | |||
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 === | |||
{{Infobox hardcoded item property|class=LightBlock|Items={{InvLink|Light|link=Light (block)}}|pac=world.level.block}} | |||
'''getShape({{tooltip|...|BlockState state, BlockGetter level, BlockPos pos, CollisionContext context}})''' | |||
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. | |||
{{-}} | {{-}} | ||
=== | === PowderSnowBlock === | ||
{{Infobox | {{Infobox hardcoded item property|class=PowderSnowBlock|Leather Boots|pac=world.level.block}} | ||
'''{{ | |||
'''canEntityWalkOnPowderSnow({{tooltip|...|Entity entity}})''' | |||
Used in {{cd|getCollisionShape(...)}} to help test whether the [[Minecraft:powder snow]] has a full block [[Minecraft:collision box]]. | |||
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. | |||
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 === | |||
{{Infobox hardcoded item property|class=PumpkinBlock|Shears|pac=world.level.block}} | |||
'''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: | ||
* 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=== | |||
{{Infobox hardcoded item property|class=RespawnAnchorBlock|Glowstone|Inv=t|pac=world.level.block}} | |||
'''isRespawnFuel({{Tooltip|...|ItemStack itemInHand}})''' | |||
Used in {{cd|useItemOn(...)}} to test if the item is fuel for the [[Minecraft:respawn anchor]]. Returns true iff the item is a glowstone. | |||
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}} | |||
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}} | |||
'''useItemOn({{Tooltip|...|ItemStack itemStack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult}})''' | |||
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=== | |||
{{Infobox hardcoded item property|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}})''' | |||
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|{"translate":"block.minecraft.tnt.disabled"}}}), | |||
** 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'). | |||
{{-}} | |||
===TripWireBlock=== | |||
{{Infobox hardcoded item property|class=TripWireBlock|Shears|pac=world.level.block}} | |||
'''playerWillDestroy({{Tooltip|...|Level level, BlockPos pos, BlockState state, Player player}})''' | |||
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}}. | |||
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). | |||
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}})''' | |||
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}}. | |||
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}} | |||
{{ | '''canSpawnMob({{Tooltip|...|Level level, BlockPos pos, ItemStack itemStack}})''' | ||
''' | 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. | ||
Returns the | 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}} | |||
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--> | |||
However, | |||
{{-}} | {{-}} | ||
=== | ===AbstractFurnaceBlockEntity=== | ||
{{Infobox hardcoded item property|class=AbstractFurnaceBlockEntity|Wet Sponge|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]]. | |||
'''VaultConfig()''' | {{InvLink|Wet Sponge|link=None|text=}} {{ItemSprite|Bucket}} '''burn({{tooltip|...|NonNullList<ItemStack> items, ItemStack inputItemStack, ItemStack result}})''' | ||
Used at the end of the [[Minecraft:smelting]] process, to add the result to [[Minecraft:Java_Edition_protocol/Inventory#Furnace|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. | |||
{{ItemSprite|Bucket}} '''canPlaceItem({{tooltip|...|int slot, ItemStack itemStack}})''' | |||
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 {{DCL|cooking_fuel}}) 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=== | |||
{{Infobox hardcoded item property|class=BrewingStandBlockEntity|Glass Bottle|pac=world.level.block.entity}} | |||
Define the behavior of [[Minecraft:block entity]] associated with a [[Minecraft:brewing stand]]. | |||
'''canTakeItemThroughFace({{tooltip|...|int slot, ItemStack itemStack, Direction direction}})''' | |||
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=== | |||
{{Infobox hardcoded item property|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 trial 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=== | |||
{{Infobox hardcoded item property|class=AgeableMob|block=1|Golden Dandelion|pac=world.entity}} | |||
'''canUseGoldenDandelion({{Tooltip|...|ItemStack itemInHand, boolean isBaby, int cooldown, Mob mob}})''' | |||
Returns true when the following occur simultaneously: | |||
* The item in hand is a golden dandelion | |||
* {{cd|isBaby}} is true | |||
* {{cd|cooldown}} is zero | |||
* The mob is not in the {{tag link|entity_type|cannot_be_age_locked}} tag | |||
This method is used twice: | |||
* {{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. | |||
* {{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. | |||
When age locked is set, it occurs in order: | |||
# 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; | |||
# Set {{cd|ageLockParticleTimer}} to 40; | |||
# Consume one item from the player's hand. | |||
# If age is locked: | |||
::* Set persistence required | |||
::* Paly sound {{cd|golden_dandelion.use}} ({{sound||Golden dandelion use.ogg}}) | |||
:: Otherwise | |||
::* Paly sound {{cd|golden_dandelion.unuse}} ({{sound||Golden dandelion unuse.ogg}}) | |||
===Bucketable=== | |||
{{Infobox hardcoded item property|class=Bucketable|Water Bucket|pac=world.entity}} | |||
{{-}} | |||
===Entity=== | |||
{{Infobox hardcoded item property|class=Entity|Shears|Lead|pac=world.entity}} | |||
'''interact({{Tooltip|...|Player player, InteractionHand hand, Vec3 location}})''' | |||
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: | |||
* 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. | |||
'''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|{{Control|crouching}}]] | |||
* 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. | |||
'''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=== | |||
{{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,795: | Line 2,970: | ||
===FishingHook=== | ===FishingHook=== | ||
===ProjectileUtil=== | ===ProjectileUtil=== | ||
===ClientLevel=== | ===ClientLevel=== | ||
===AbstractClientPlayer=== | ===AbstractClientPlayer=== | ||
| Line 2,803: | Line 2,977: | ||
===LivingEntityRenderer=== | ===LivingEntityRenderer=== | ||
===WitchRenderer=== | ===WitchRenderer=== | ||
{{info needed section|used for potions, or something else?}} | |||
===AvatarRenderer=== | ===AvatarRenderer=== | ||
===CuboidItemModelWrapper=== | ===CuboidItemModelWrapper=== | ||
===Charge=== | ===Charge=== | ||
===Ingredient=== | ===Ingredient=== | ||
===CrossbowItem=== | ===CrossbowItem=== | ||
| Line 2,815: | Line 2,989: | ||
===ProjectileWeaponItem=== | ===ProjectileWeaponItem=== | ||
===EnchantRandomlyFunction=== | ===EnchantRandomlyFunction=== | ||
===FillPlayerHead=== | ===FillPlayerHead=== | ||
===SetEnchantmentsFunction=== | ===SetEnchantmentsFunction=== | ||
===SetStewEffectFunction=== | ===SetStewEffectFunction=== | ||
===EntityEquipmentPredicate=== | |||
== Old article stub == | == Old article stub == | ||
| Line 2,916: | Line 3,090: | ||
== History == | == History == | ||
{{info needed section|History before [[Minecraft:Java Edition 26.1 Snapshot 1]] and after [[Minecraft:Java Edition 26.2 | {{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? | |{{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,934: | 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 | * 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,981: | 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 dandelion agge locked 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,991: | 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 | |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 3,000: | 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 | <!--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 | | 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. | ||
}} | }} | ||
<!-- | <!-- | ||
| Line 3,008: | 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}}<Item>}}, instead of 16 separate instances. Similarly, copper items, such as [[Minecraft:copper block]] and [[Minecraft:chiseled copper]], are referenced as {{cd|{{jbcp||CopperCollection}}<Item>}}, 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}}<Item>}}, instead of 16 separate instances. Similarly, copper items, such as [[Minecraft:copper block]] and [[Minecraft:chiseled copper]], are referenced as {{cd|{{jbcp||CopperCollection}}<Item>}}, instead of 8 separate instances. This modified many classes, but only in the code organization, and not in game properties. | ||
| Line 3,016: | 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|| | <!-- 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 3,028: | 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.
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
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.
| Class | Items (id) |
|---|---|
| AirItem | air |
| ArmorStandItem | armor_stand |
| ArrowItem | arrow |
| 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 |
| BlockItem | Template:Collapse |
| BoatItem | cherry_boat, birch_chest_boat, birch_boat, acacia_chest_boat, acacia_boat, spruce_chest_boat, spruce_boat, pale_oak_chest_boat, pale_oak_boat, oak_chest_boat, oak_boat, mangrove_chest_boat, mangrove_boat, jungle_chest_boat, jungle_boat, dark_oak_chest_boat, dark_oak_boat, cherry_chest_boat, bamboo_raft, bamboo_chest_raft |
| BoneMealItem | bone_meal |
| BottleItem | glass_bottle |
| BowItem | bow |
| BrushItem | brush |
| BucketItem | bucket, water_bucket, lava_bucket |
| BundleItem | bundle, white_bundle, orange_bundle, magenta_bundle, light_blue_bundle, yellow_bundle, lime_bundle, pink_bundle, gray_bundle, light_gray_bundle, cyan_bundle, purple_bundle, blue_bundle, brown_bundle, green_bundle, red_bundle, black_bundle |
| CompassItem | compass |
| CrossbowItem | crossbow |
| DebugStickItem | debug_stick |
| DiscFragmentItem | disc_fragment_5 |
| DoubleHighBlockItem | Template:Collapse |
| DyeItem | white_dye, orange_dye, magenta_dye, light_blue_dye, yellow_dye, lime_dye, pink_dye, gray_dye, light_gray_dye, cyan_dye, purple_dye, blue_dye, brown_dye, green_dye, red_dye, black_dye |
| EggItem | egg, blue_egg, brown_egg |
| EmptyMapItem | map |
| EndCrystalItem | end_crystal |
| EnderEyeItem | ender_eye |
| EnderpearlItem | ender_pearl |
| ExperienceBottleItem | experience_bottle |
| FireChargeItem | fire_charge |
| FireworkRocketItem | firework_rocket |
| FishingRodItem | fishing_rod |
| FlintAndSteelItem | flint_and_steel |
| FoodOnAStickItem | carrot_on_a_stick, warped_fungus_on_a_stick |
| GameMasterBlockItem | command_block, repeating_command_block, chain_command_block, structure_block, jigsaw, test_block, test_instance_block |
| GlowInkSacItem | glow_ink_sac |
| HangingEntityItem | painting |
| 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 |
| HoneycombItem | honeycomb |
| InkSacItem | ink_sac |
| InstrumentItem | goat_horn |
| Item | All, see Minecraft:Java_Edition_data_values/Items |
| ItemFrameItem | item_frame |
| KnowledgeBookItem | knowledge_book |
| LeadItem | lead |
| LingeringPotionItem | lingering_potion |
| MaceItem | mace |
| MapItem | filled_map |
| MinecartItem | minecart, chest_minecart, furnece_minecart, tnt_minecart, hopper_minecart, command_block_minecart |
| MobBucketItem | pufferfish_bucket, salmon_bucket, cod_bucket, tropical_fish_bucket, axolotl_bucket, tadpole_bucket |
| NameTagItem | name_tag |
| PlaceOnWaterBlockItem | lily_pad, frogspawn |
| PlayerHeadItem | player_head |
| PotionItem | potion |
| ProjectileWeaponItem | |
| ScaffoldingBlockItem | scaffolding |
| ShearsItem | shears |
| ShieldItem | shield |
| 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 |
| SmithingTemplateItem | |
| SnowballItem | snowball |
| SolidBucketItem | powder_snow_bucket |
| SpawnEggItem | |
| SpectralArrowItem | spectral_arrow |
| SplashPotionItem | splash_potion |
| SpyglassItem | spyglass |
| StandingAndWallBlockItem | torch, soul_torch, copper_torch, tube_coral_fan, brain_coral_fan, bubble_coral_fan, fire_coral_fan, horn_coral_fan, dead_tube_coral_fan, dead_brain_coral_fan, dead_bubble_coral_fan, dead_fire_coral_fan, dead_horn_coral_fan, redstone_torch, skeleton_skull, wither_skeleton_skull, zombie_head, creeper_head, dragon_head, piglin_head |
| ThrowablePotionItem | |
| TippedArrowItem | tipped_arrow |
| TridentItem | trident |
| WindChargeItem | wind_charge |
| WritableBookItem | writable_book |
| WrittenBookItem | written_book |
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
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
Implementations
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
Implementations
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
Implementations
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
Description of the methods:
- Template:Jicp.Template:Cd: If the player is in Minecraft:adventure mode and the item stack does not have the Template:DCL component corresponding to the clicked block, it returns fail.
- 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
- Template:Jcp.Template:Cd: 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 menu, open the menu and return Template:Cd
- If the block is a portal (end gateway, end portal, or 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 Template:Cd in red on Minecraft:action bar. Return Template:Cd.
- Otherwise return Template:Cd.
- 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.
AirItem
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 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 (Template:Cd) is played;
- The Minecraft:game event Template:Cd is produced;
- The item stack is shrunk by one.
The interaction returns success given no aforementioned fails occur.
Armor stand entity data:
- Template:Nbt Entity data
- Template:Nbt inherit/apply components from item stack
- Template:Nbt: Template:Cd.
- Template:Nbt: 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 Template:DCL component.
- Template:Nbt:
- Template:Nbt: See above.
- Template:Nbt: Template:Cd.
- Template:Nbt: With the exception of id, Rotation, Passengers , and UUID, it can be defined by Template:DCL. The Template:DCL only has an effect if the Template:DCL is Template:Cd. CustomName, data, and Pos have priority to be defined by component Template:DCL.
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:
- Template:Nbt Entity data
- Template:Nbt inherit/apply components from item stack
- Template:Nbt: Template:Cd.
- Template:Nbt:
- Template:Nbt: Owner's X coordinate.
- Template:Nbt: Owner's eye Y coordinate minus Template:Cd.
- Template:Nbt: Owner's Z coordinate.
- Template:Nbt: The item stack copy, with count 1.
- Template:Nbt: The fired from weapon copy, if it exists.
- Template:Nbt: According to the effect components Template:Cd of the weapon enchantments, if it exists. The item stack can be used for requirements.
- Template:Nbt: Template:Cd (creative only) if the item has the component Template:DCL, Template:Cd (allowed) otherwise.
- Template:Nbt: The owner Minecraft:UUID.
asProjectile(Template:Tooltip) Template:Hatnote
Creates an arrow projectile not fired from any weapon, used by Minecraft:dispensers and Minecraft:ominous item spawners, with:
- Template:Nbt Entity data
- Template:Nbt inherit/apply components from item stack
- Template:Nbt: Template:Cd.
- Template:Nbt: The position.
- Template:Nbt: The item stack copy, with count 1.
- Template:Nbt: Template:Cd (allowed), regardless of Template:DCL.
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
Block by item
There are two methods in Template:Jicp related to associating the item with its associated block and vice-versa:
- Template:Cd: Returns the block Template:Cd, defined when registering the item in Template:Jicp.
- Template:Cd: Put the pair Template:Cd in Template:Cd. Used only with the Template:Jicp.Template:Cd map.
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:
- Template:InvLink: has the Template:BlockLink as an alternate block,
- Template:InvLink: has Template:BlockLink, Template:BlockLink, and Template:BlockLink as 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
BrushItem
BucketItem
BundleItem
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
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:
- Template:Nbt Entity data
- Template:Nbt: Template:Cd
- Template:Nbt:
- Template:Nbt: Owner's X coordinate.
- Template:Nbt: Owner's eye Y coordinate minus Template:Cd.
- Template:Nbt: Owner's Z coordinate.
- Template:Nbt: a copy of the item stack with the count set to 1.
- Template:Nbt: The player Minecraft:UUID.
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:
- Template:Nbt Entity data
- Template:Nbt: Template:Cd
- Template:Nbt: The position.
- Template:Nbt: a copy of the item stack with the count set to 1.
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:
- Template:Nbt Entity data
- Template:Nbt: Template:Cd
- Template:Nbt: The bottom center of the block above the one clicked.
- Template:Nbt: Template:Cd
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.
- If the tag is empty, the Minecraft:debug flag Template:Cd is enable, or world option Generate Structures is false, return null
- 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.
- 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.
- 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.
- 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:
- Template:Nbt Entity data
- Template:Nbt: Template:Cd
- Template:Nbt: The center of the player's bounding box.
- Template:Nbt: The item stack with the count set to 1.
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:
- Template:Nbt: It may not exist. If this exists, each tick changes the Template:Nbt of the ender eye as it approaches that position. Defined as Template:Cd if Template:Cd or Template:Cd otherwise, where Template:Cd are the distance from the corner of the block position Template:Cd minus the initial position of the ender eye. Set to null on reload.
- Template:Nbt: Each tick increases by one; if it exceeds 80, it emits the Template:Cd sound event (volume 1, pitch 1) and the eye is destroyed. Set to 0. Set to 0 on reload.
- Template:Nbt: 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 Template:Nbt; the components are not preserved. If false, causes world event 2003. Template:Tooltip defined with an 80% chance of being Template:Cd. Set to Template:Cd on reload.
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: Owner's X coordinate.
- Template:Nbt: Owner's eye Y coordinate minus Template:Cd.
- Template:Nbt: Owner's Z coordinate.
- 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:
- Template:Nbt Entity data
- Template:Nbt: Template:Cd
- Template:Nbt:
- Template:Nbt: Owner's X coordinate.
- Template:Nbt: Owner's eye Y coordinate minus Template:Cd.
- Template:Nbt: Owner's Z coordinate.
- Template:Nbt: a copy of the item stack with the count set to 1.
- Template:Nbt: The player Minecraft:UUID.
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:
- Template:Nbt Entity data
- Template:Nbt: Template:Cd
- Template:Nbt: The position.
- Template:Nbt: a copy of the item stack with the count set to 1.
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:
- Template:Nbt Entity data
- Template:Nbt: Template:Cd
- Template:Nbt: The position.
- Template:Nbt: The randomized direction. Each axis receives the value -1, 0, or 1 (depending on the direction) plus a random number Template:Cd. Each axis has the random number calculated separately. After that, the vector is normalized and mutilates by 0.1.Template:More info
- Template:Nbt: A copy of the item stack with the count set to 1.
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:
- Template:Nbt Entity data
- Template:Nbt: Template:Cd
- Template:Nbt: The clicked location, offset away from the block by 0.15 blocks.
- Template:Nbt: A copy of the item stack.
- Template:Nbt: 0
- Template:Nbt: The firework lifetime depending on its Template:DCL component: 10 * Template:Cd (or 0 if there is no Template:DCL component) + random(0 to 5) + random(0 to 6)
- Template:Nbt: The player Minecraft:UUID.
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:
- Template:Nbt Entity data
- Template:Nbt: Template:Cd
- Template:Nbt: The player's position.
- Template:Nbt: A copy of the item stack.
- Template:Nbt: 0
- Template:Nbt: The firework lifetime, same formula as above.
- Template:Nbt: The player Minecraft:UUID.
asProjectile(Template:Tooltip) Template:Hatnote
Creates a firework rocket projectile with:
- Template:Nbt Entity data
- Template:Nbt: Template:Cd
- Template:Nbt: The position.
- Template:Nbt: A copy of the item stack with the count set to 1.
- Template:Nbt: 0
- Template:Nbt: The firework lifetime, same formula as above.
- Template:Nbt: Template:Cd
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:
- The Template:Cd sound effect is played.
- The Template:Cd and Template:Cd effect components are applied from enchantments on the item stack, they define local fishing bobber variables without saving them in the NBT tag:
- Template:Nbt: Used in the Minecraft:loot context of the fishing loot table, Template:Cd. Defined by the maximum between 0 and the value given by Template:Cd.
- Template:Nbt: 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 Template:Cd.
- A Minecraft:fishing bobber is spawned with the fishing time reduction and luck bonus (which are not serialized) and with:
- 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.
- Template:Nbt Entity data
- The item used statistic is awarded.
- An Template:Cd 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 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:
- Minecraft:Carrot on a Stick can interact with Minecraft:pigs and is damaged by 7 when used.
- Minecraft:Warped Fungus on a Stick can interact with Minecraft:striders and is damaged by 1 when used.
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
HangingSignItem
HoneycombItem
InkSacItem
InstrumentItem
ItemFrameItem
KnowledgeBookItem
LeadItem
LingeringPotionItem
MaceItem
MapItem
MinecartItem
MobBucketItem
NameTagItem
Template:Infobox hardcoded item property
interactLivingEntity(Template:Tooltip) Template:Hatnote
The interaction will only be successful, instead of pass, when:
- the item has a Template:DCL 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 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
PlayerHeadItem
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:
- Play the generic splash Minecraft:sound event (Template:Cd),
- Set Minecraft:glass bottle in hand,
- Send splash particles,
- Play the bottle empty sound event (Template:Cd),
- Produce the Minecraft:game event Template:Cd,
- 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
ScaffoldingBlockItem
ShearsItem
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 | |
| Textures | |||
| 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 Template" (Template:Color)
- Empty line
- "Applies to:" (Template:Color)
- Space append to Template:Cd
- "Ingredients:" (Template:Color)
- Space append to Template:Cd
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:
- For slot 0, a list of two elements is always used; these are: Template:Mono and Template:Mono.
- 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)
- Template:Cd
- When there is a recipe error, it also renders a red X above the arrow:
- 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
SolidBucketItem
SpawnEggItem
SpectralArrowItem
SplashPotionItem
SpyglassItem
StandingAndWallBlockItem
ThrowablePotionItem
TippedArrowItem
TridentItem
WindChargeItem
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
Entity
Client Template:Columns-list Item Template:Columns-list Loot Template:Columns-list
CauldronInteractions
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.
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 the Template:Cd (item in slot 0) does not have a Template:Cd (data associated with its Template:DCL component), it will not yield any results.
- 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 glass and the Template:Cd is not locked, the resulting is one copy of the Template:Cd with the Template:Cd component set to 0 (LOCK).
- 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:
- drop the loot table Template:Cd (3x Template:ItemLink);
- the Minecraft:sound event beehive shear (Template:Cd) is played;
- causes one damage from the shear;
- and produce the game event Template:Cd.
- 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:
- Set Template:Cd 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 Template:Cd (4x Template:ItemLink), in Template:Cd,
- Player the Minecraft:sound event pumpink carve (Template:Sound).
- Convert the pumpkin into a Minecraft:carved pumpkin with the face given by Template:Cd,
- Reduces the Minecraft:durability of the shear by 1,
- Produce the Minecraft:game event Template:Cd,
- Increases the item Template:Cd Minecraft:statistic by one.
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:
- Increase the anchor's Template:Cd by one
- Produce the Minecraft:game event Template:Cd,
- Player the Minecraft:sound event respawn anchor charge (Template:Sound),
- Shrink the item stack by one,
- Retunr Template:Cd
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:
- If the Template:Gmr game rule is Template:Cd:
- Send in Minecraft:action bar "TNT explosion are disabled" (Template:Cd),
- Return Template:Cd
- If the game rule is Template:Cd:
- Summon a Minecraft:primed TNT (with Template:Cd 80) in the block's position,
- Play the Minecraft:sound event tnt primed (Template:Sound),
- Produce the Minecraft:game event Template:Cd,
- 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 Template:Cd.
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:
- Set the tripwire's Template:Cd to true and update the adjacent blocks,
- Produce the Minecraft:game event Template:Cd.
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:
- Destroy a tripwire without shears: the connected tripwire hooks immediately set Template:Cd true and remain Template:Cd true. After 10 ticks they set Template:Cd and Template:Cd to false.
- Destroy a tripwire with shears: the tripwire hooks immediately set Template:Cd to false and remain Template:Cd false.
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 a honeycomb, return Template:Cd. Thus, the use of the item will depend on the Template:Cd (see Template:Slink and Template:Slink)
- Else, update the golem pose and return Template:Cd.
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:
- The item is a wither skeleton skull.
- The y-axis of the Template:Cd 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 Template:BlockSprite is the Template:Cd (it can have any block in Template:BlockSprite), Template:BlockSprite is a block in the tag Template:Tag link and Template:BlockSprite is air, cave air or void air.
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:
- The item in hand is a golden dandelion
- Template:Cd is true
- Template:Cd is zero
- The mob is not in the Template:Tag link tag
This method is used twice:
- Template:Jcp.Template:Cd — The Template:Cd parameter actually checks if the ageable mob is a baby (Template:Cd < 0 and can be a baby), and the Template:Cd is Template:Cd. If it returns true, sets age locked and returns Template:Cd. Otherwise, it returns Template:Cd (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.
- 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:
- Invert the value of the NBT tag Template:Cd;
- Sets the Template:Cd to 0 for tadpoles, −48000 for sniffers, and −24000 for other mobs;
- Set Template:Cd to 40;
- Consume one item from the player's hand.
- If age is locked:
- Set persistence required
- Paly sound Template:Cd (Template:Sound)
- Otherwise
- Paly sound Template:Cd (Template:Sound)
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:
- Produce the game event Template:Cd Minecraft:game event.
- The Template:Cd sound plays.
- The shears take one of damage.
- The interaction returns success.
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>