Hardcoded item properties (Java Edition)
Note:
Hardcoded item properties are aspects of items which are tied to the IDs and cannot be customized fully via the use of commands or data packs.
Many of the properties associated with items in the game have been made controllable with the newly-introduced data component format; this intends to track things that aren't controllable via components or item tags.
Code structure
There are at least three ways in which the game code describes the properties of an item.
Item.Properties
In class Item.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 data components.
However, even though it's possible to change the components of item stacks, data packs cannot change the default components of the items themselves.
A complete list of default components in 1.21.11 can be seen at misode/mcmeta. The list for 26.1 Snapshot 6 can be found here.
A notable exception is the 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:
| Item | Craft remainder | Vanilla use |
|---|---|---|
| Cake recipe | ||
| Fuel remainder in smelting | ||
| None | ||
| Honey block and sugar recipes. | ||
| Ingredient remainder in brewing.[note 1] |
All craft remainder can also be used in custom recipes via data packs. In code is also used in the craft display item, however it apparently hasn't been implemented in the game.[more information needed]
Another exception is the item descriptionId, which can be minecraft.item.<id> or minecraft.block.<id>. Although its primary use is for the item name, which is customizable by the item_name component, this description id is also used for other things, such as portion names and disc fragment descreipition.
Most of the Item.Properties applied to items are applied from the item's record in Items.
Item subclasses (code structure)
In the item package, there are many classes that define properties for a certain item or a certain set of items; these classes extend the Item class. A large part of the hardcoded item properties come from here.
These classes have [something]Item as their name, such as DyeItem, HoeItem, and NameTagItem.
In many cases, when an item is registered in Items, 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, instanceof 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 Item and the IDs of the items that are restricted as instances of them (in Items).
See § Item subclasses for details.
| Class | Items (id) |
|---|---|
| AirItem | air |
| ArmorStandItem | armor_stand |
| ArrowItem | arrow |
| AxeItem | wooden_axe, copper_axe, stone_axe, golden_axe, iron_axe, diamond_axe |
| BannerItem | white_banner, orange_banner, magenta_banner, light_blue_banner, yellow_banner, lime_banner, pink_banner, gray_banner, light_gray_banner, cyan_banner, purple_banner, blue_banner, brown_banner, green_banner, red_banner, black_banner |
| BedItem | white_bed, orange_bed, magenta_bed, light_blue_bed, yellow_bed, lime_bed, pink_bed, gray_bed, light_gray_bed, cyan_bed, purple_bed, blue_bed, brown_bed, green_bed, red_bed, black_bed |
| BlockItem | 15 items with
createBlockItemWithCustomItemName:
resin_clump, redstone, string, wheat_seeds, cocoa_beans, pumpkin_seeds, melon_seeds, nether_wart, carrot, potato, torchflower_seeds, pitcher_pod, beetroot_seeds, sweet_berries, glow_berries 989 items with |
| 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 | small_dripleaf, sunflower, lilac, rose_bush, peony, tall_grass, large_fern, iron_door, oak_door, spruce_door, birch_door, jungle_door, acacia_door, cherry_door, dark_oak_door, pale_oak_door, mangrove_door, bamboo_door, crimson_door, warped_door, copper_door, exposed_copper_door, weathered_copper_door, oxidized_copper_door, waxed_copper_door, waxed_exposed_copper_door, waxed_weathered_copper_door, waxed_oxidized_copper_door
|
| 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 |
| HoeItem | wooden_hoe, copper_hoe, stone_hoe, golden_hoe, iron_hoe, diamond_hoe |
| HoneycombItem | honeycomb |
| InkSacItem | ink_sac |
| InstrumentItem | goat_horn |
| Item | All, see 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 |
| ShovelItem | wooden_shovel, copper_shovel, stone_shovel, golden_shovel, iron_shovel, diamond_shovel |
| SignItem | warped_sign, spruce_sign, pale_oak_sign, oak_sign, mangrove_sign, jungle_sign, dark_oak_sign, crimson_sign, cherry_sign, birch_sign, bamboo_sign, acacia_sign |
| SmithingTemplateItem |
netherite_upgrade_smithing_template, sentry_armor_trim_smithing_template, dune_armor_trim_smithing_template, coast_armor_trim_smithing_template, wild_armor_trim_smithing_template, ward_armor_trim_smithing_template, eye_armor_trim_smithing_template, vex_armor_trim_smithing_template, tide_armor_trim_smithing_template, snout_armor_trim_smithing_template, rib_armor_trim_smithing_template, spire_armor_trim_smithing_template, wayfinder_armor_trim_smithing_template, shaper_armor_trim_smithing_template, silence_armor_trim_smithing_template, raiser_armor_trim_smithing_template, host_armor_trim_smithing_template, flow_armor_trim_smithing_template, bolt_armor_trim_smithing_template
|
| SnowballItem | snowball |
| SolidBucketItem | powder_snow_bucket |
| SpawnEggItem |
chicken_spawn_egg, cow_spawn_egg, pig_spawn_egg, sheep_spawn_egg, camel_spawn_egg, donkey_spawn_egg, horse_spawn_egg, mule_spawn_egg, cat_spawn_egg, parrot_spawn_egg, wolf_spawn_egg, armadillo_spawn_egg, bat_spawn_egg, bee_spawn_egg, fox_spawn_egg, goat_spawn_egg, llama_spawn_egg, ocelot_spawn_egg, panda_spawn_egg, polar_bear_spawn_egg, rabbit_spawn_egg, axolotl_spawn_egg, cod_spawn_egg, dolphin_spawn_egg, frog_spawn_egg, glow_squid_spawn_egg, nautilus_spawn_egg, pufferfish_spawn_egg, salmon_spawn_egg, squid_spawn_egg, tadpole_spawn_egg, tropical_fish_spawn_egg, turtle_spawn_egg, allay_spawn_egg, mooshroom_spawn_egg, sniffer_spawn_egg, copper_golem_spawn_egg, iron_golem_spawn_egg, snow_golem_spawn_egg, trader_llama_spawn_egg, villager_spawn_egg, wandering_trader_spawn_egg, bogged_spawn_egg, camel_husk_spawn_egg, drowned_spawn_egg, husk_spawn_egg, parched_spawn_egg, skeleton_spawn_egg, skeleton_horse_spawn_egg, stray_spawn_egg, wither_spawn_egg, wither_skeleton_spawn_egg, zombie_spawn_egg, zombie_horse_spawn_egg, zombie_nautilus_spawn_egg, zombie_villager_spawn_egg, cave_spider_spawn_egg, spider_spawn_egg, breeze_spawn_egg, creaking_spawn_egg, creeper_spawn_egg, elder_guardian_spawn_egg, guardian_spawn_egg, phantom_spawn_egg, silverfish_spawn_egg, slime_spawn_egg, warden_spawn_egg, witch_spawn_egg, evoker_spawn_egg, pillager_spawn_egg, ravager_spawn_egg, vindicator_spawn_egg, vex_spawn_egg, blaze_spawn_egg, ghast_spawn_egg, happy_ghast_spawn_egg, hoglin_spawn_egg, magma_cube_spawn_egg, piglin_spawn_egg, piglin_brute_spawn_egg, strider_spawn_egg, zoglin_spawn_egg, zombified_piglin_spawn_egg, ender_dragon_spawn_egg, enderman_spawn_egg, endermite_spawn_egg, shulker_spawn_egg
|
| 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 Items 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, loot tables and trades[upcoming 26.1]. Therefore, this is a property that can be fully controlled by 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.[note 2]
List
The table below shows all the classes (except client classes) that has a Items memmber access, and the number of uses in each class[note 3]. According to the code of 26.1 Snapshot 5.
Legend:
- red The background indicates that all items within that class are used only for generating the vanilla datapack.
- 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 § Items member access, for details of the classes without note.
| Class | Note | Usages |
|---|---|---|
| EntityEquipmentPredicate | 1 | |
| TriggerInstance | Vanilla datapack | 2 |
| CauldronInteraction | 51 | |
| DispenseItemBehavior | 81 | |
| BuiltInRegistries | New item instance | 1 |
| VanillaAdventureAdvancements | Vanilla datapack | 43 |
| VanillaHusbandryAdvancements | Vanilla datapack | 51 |
| VanillaNetherAdvancements | Vanilla datapack | 17 |
| VanillaStoryAdvancements | Vanilla datapack | 13 |
| VanillaTheEndAdvancements | Vanilla datapack | 5 |
| BlockLootSubProvider | Vanilla datapack | 10 |
| TradeRebalanceChestLoot | Vanilla datapack | 6 |
| VanillaArchaeologyLoot | Vanilla datapack | 11 |
| VanillaBlockInteractLoot | Vanilla datapack | 4 |
| VanillaBlockLoot | Vanilla datapack | 49 |
| VanillaChargedCreeperExplosionLoot | Vanilla datapack | 2 |
| VanillaChestLoot | Vanilla datapack | 70 |
| VanillaEntityInteractLoot | Vanilla datapack | 1 |
| VanillaEntityLoot | Vanilla datapack | 62 |
| VanillaEquipmentLoot | Vanilla datapack | 5 |
| VanillaFishingLoot | Vanilla datapack | 5 |
| VanillaGiftLoot | Vanilla datapack | 36 |
| VanillaPiglinBarterLoot | Vanilla datapack | 1 |
| VanillaShearingLoot | Vanilla datapack | 4 |
| RecipeProvider | Vanilla datapack | 38 |
| VanillaRecipeProvider | Vanilla datapack | 1051 |
| VanillaItemTagsProvider | Vanilla datapack | 316 |
| ServerGamePacketListenerImpl | New item instance | 1 |
| AgeableMob | 1 | |
| Entity | 3 | |
| EntityType | New item instance | 20 |
| Leashable | New item instance | 2 |
| LivingEntity | 3 | |
| Mob | 25 | |
| CelebrateVillagersSurvivedRaid | New item instance | 1 |
| CrossbowAttack | 3 | |
| TradeWithVillager | 3 | |
| UseBonemeal | 3 | |
| WorkAtComposter | 6 | |
| BegGoal | 1 | |
| OfferFlowerGoal | New item instance | 1 |
| RangedBowAttackGoal | 2 | |
| RangedCrossbowAttackGoal | 2 | |
| RemoveBlockGoal | New item instance | 1 |
| Bucketable | 1 | |
| Armadillo | 1 | |
| Axolotl | 3 | |
| Camel | 1 | |
| AbstractCow | 2 | |
| MushroomCow | 4 | |
| AbstractChestedHorse | 4 | |
| AbstractHorse | 9 | |
| Horse | 1 | |
| Llama | 2 | |
| SkeletonTrapGoal | New item instance | 1 |
| ZombieHorse | New item instance | 1 |
| Cod | New item instance | 1 |
| Pufferfish | New item instance | 1 |
| Salmon | New item instance | 1 |
| TropicalFish | New item instance | 1 |
| Fox | New item instance | 2 |
| FoxEatBerriesGoal | New item instance | 2 |
| Tadpole | New item instance | 1 |
| Goat | 4 | |
| CopperGolem | 2 | |
| IronGolem | 1 | |
| SnowGolem | 2 | |
| AbstractNautilus | New item instance | 1 |
| Panda | 1 | |
| Pig | 2 | |
| Sheep | 1 | |
| Sniffer | New item instance | 1 |
| Wolf | 3 | |
| EndCrystal | New item instance | 1 |
| WitherBoss | New item instance | 1 |
| ArmorStand | 3 | |
| GlowItemFrame | New item instance | 1 |
| ItemFrame | New item instance | 1 |
| LeashFenceKnotEntity | 2 | |
| Painting | New item instance | 2 |
| Creeper | 1 | |
| CrossbowAttackMob | 1 | |
| EnderMan | New item instance | 1 |
| Monster | New item instance | 1 |
| Strider | 3 | |
| Vex | New item instance | 1 |
| Witch | New item instance | 3 |
| Illusioner | 2 | |
| Pillager | 6 | |
| Vindicator | New item instance | 2 |
| Piglin | 9 | |
| PiglinAi | 4 | |
| PiglinBrute | 2 | |
| AbstractSkeleton | 5 | |
| Bogged | 1 | |
| WitherSkeleton | New item instance | 1 |
| Drowned | 7 | |
| DrownedTridentAttackGoal | 1 | |
| Husk | New item instance | 1 |
| Zombie | 4 | |
| ZombieVillager | 1 | |
| ZombifiedPiglin | New item instance | 2 |
| Villager | 5 | |
| VillagerProfession | 4 | |
| WanderingTrader | 4 | |
| Player | 3 | |
| EyeOfEnder | New item instance | 1 |
| FireworkRocketEntity | 2 | |
| FishingHook | 2 | |
| ProjectileUtil | 1 | |
| Arrow | New item instance | 2 |
| SpectralArrow | New item instance | 1 |
| ThrownTrident | New item instance | 1 |
| Fireball | New item instance | 1 |
| Snowball | New item instance | 1 |
| ThrownEgg | New item instance | 1 |
| ThrownEnderpearl | New item instance | 1 |
| ThrownExperienceBottle | New item instance | 1 |
| ThrownLingeringPotion | New item instance | 1 |
| ThrownSplashPotion | New item instance | 1 |
| Raid | 1 | |
| Minecart | New item instance | 2 |
| MinecartChest | New item instance | 2 |
| MinecartCommandBlock | New item instance | 2 |
| MinecartFurnace | New item instance | 2 |
| MinecartHopper | New item instance | 2 |
| MinecartSpawner | New item instance | 2 |
| MinecartTNT | New item instance | 2 |
| AnvilMenu | 1 | |
| PotionSlot | 4 | |
| CartographyTableMenu | 9 | |
| EnchantmentMenu | 5 | |
| FurnaceFuelSlot | 1 | |
| GrindstoneMenu | 2 | |
| BottleItem | New item instance | 2 |
| BucketItem | New item instance | 1 |
| CompassItem | New item instance | 1 |
| CreativeModeTabs | New item instance | 1696 |
| CrossbowItem | 3 | |
| FoodOnAStickItem | New item instance | 1 |
| HoeItem | New item instance | 1 |
| Item | 2 | |
| Items | 1519 | |
| ItemStack | 4 | |
| ItemStackTemplate | 1 | |
| MapItem | New item instance | 1 |
| PotionItem | New item instance | 1 |
| ProjectileWeaponItem | 2 | |
| PotionBrewing | 61 | |
| BlastingRecipe | New item instance | 1 |
| CampfireCookingRecipe | New item instance | 1 |
| DyeRecipe | New item instance | 1 |
| ImbueRecipe | New item instance | 1 |
| Ingredient | 1 | |
| ShapedRecipe | New item instance | 1 |
| ShapelessRecipe | New item instance | 1 |
| SmeltingRecipe | New item instance | 1 |
| SmithingTransformRecipe | New item instance | 1 |
| SmithingTrimRecipe | New item instance | 1 |
| SmokingRecipe | New item instance | 1 |
| StonecutterRecipe | New item instance | 1 |
| TransmuteRecipe | New item instance | 1 |
| EnchantmentHelper | 5 | |
| Enchantments | New item instance | 1 |
| TradeRebalanceVillagerTrades | Vanilla datapack | 132 |
| VillagerTrades | Vanilla datapack | 430 |
| BambooSaplingBlock | New item instance | 1 |
| BeehiveBlock | 5 | |
| BeetrootBlock | New item instance | 1 |
| BubbleColumnBlock | New item instance | 1 |
| CandleCakeBlock | 2 | |
| CarrotBlock | New item instance | 1 |
| CaveVinesBlock | New item instance | 1 |
| CaveVinesPlantBlock | New item instance | 1 |
| ChiseledBookShelfBlock | 2 | |
| ComposterBlock | 117 | |
| ComposterBlock.OutputContainer | 1 | |
| CropBlock | New item instance | 1 |
| LightBlock | 1 | |
| NetherWartBlock | New item instance | 1 |
| PotatoBlock | New item instance | 1 |
| PowderSnowBlock | 2 | |
| PumpkinBlock | 2 | |
| RespawnAnchorBlock | 1 | |
| SimpleWaterloggedBlock | New item instance | 1 |
| SweetBerryBushBlock | New item instance | 2 |
| TntBlock | 3 | |
| TorchflowerCropBlock | New item instance | 1 |
| TripWireBlock | 1 | |
| WeatheringCopperGolemStatueBlock | 1 | |
| WitherSkullBlock | 1 | |
| AbstractFurnaceBlockEntity | 7 | |
| BrewingStandBlockEntity | 5 | |
| DecoratedPotBlockEntity | New item instance | 1 |
| DecoratedPotPatterns | New item instance | 3 |
| FuelValues | 2 | |
| PotDecorations | 3 | |
| vault.VaultConfig | 1 | |
| Bootstrap | New item instance | 3 |
| EndCityPiece | New item instance | 1 |
| EmptyFluid | New item instance | 1 |
| LavaFluid | New item instance | 1 |
| WaterFluid | New item instance | 1 |
| EnchantRandomlyFunction | 3 | |
| ExplorationMapFunction | 1 | |
| FillPlayerHead | 1 | |
| SetEnchantmentsFunction | 2 | |
| SetStewEffectFunction | 1 |
Item class
getId(...)
byId(...)
byBlock(...)
Item(...)
builtInRegistryHolder()
components()
getDefaultMaxStackSize()
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
Only used in ItemStack by onUseTick(...), after properties relating to consumable and kinetic_waapon components.
- Activated on each tick if the item stack used remains in the same hand of the entity.
- For the crossbow also activated at other times. See § useOnRelease(...).
Implementations
onDestroyed(...)
canDestroyBlock(...)
asItem()
useOn(...)
getDestroySpeed(...)
use(...)
finishUsingItem(...)
isBarVisible(...)
getBarWidth(...)
getBarColor(...)
overrideStackedOnOther(...)
overrideOtherStackedOnMe(...)
getAttackDamageBonus(...)
getItemDamageSource(...)
hurtEnemy(...)
postHurtEnemy(...)
mineBlock(...)
isCorrectToolForDrops(...)
interactLivingEntity(...)
toString()
getCraftingRemainder()
inventoryTick(...)
onCraftedBy(...)
onCraftedPostProcess(...)
getUseAnimation(...)
getUseDuration(...)
releaseUsing(...)
appendHoverText(...)
getTooltipImage(...)
getDescriptionId()
getName(...)
isFoil(...)
getPlayerPOVHitResult(...)
useOnRelease(...)
getDefaultInstance()
canFitInsideContainerItems()
requiredFeatures()
shouldPrintOpWarning(...)
Item subclasses
Only subsections marked with an asterisk (*) aren't empty.
AirItem*
ArmorStandItem*
ArrowItem
AxeItem
BannerItem
BedItem
BlockItem
BoatItem
BoneMealItem
BottleItem
BowItem
BrushItem
BucketItem
BundleItem
CompassItem
CrossbowItem
DebugStickItem
DiscFragmentItem*
DoubleHighBlockItem
DyeItem*
EggItem
EmptyMapItem
EndCrystalItem
EnderEyeItem
EnderpearlItem
ExperienceBottleItem
FireChargeItem
FireworkRocketItem
FishingRodItem
FlintAndSteelItem
FoodOnAStickItem
GameMasterBlockItem
GlowInkSacItem
HangingEntityItem
HangingSignItem
HoeItem
HoneycombItem
InkSacItem
InstrumentItem
Item
ItemFrameItem
KnowledgeBookItem
LeadItem
LingeringPotionItem
MaceItem
MapItem
MinecartItem
MobBucketItem
NameTagItem*
PlaceOnWaterBlockItem
PlayerHeadItem
PotionItem*
ProjectileWeaponItem
ScaffoldingBlockItem
ShearsItem
ShieldItem*
ShovelItem
SignItem
SmithingTemplateItem
SnowballItem
SolidBucketItem
SpawnEggItem
SpectralArrowItem
SplashPotionItem
SpyglassItem
StandingAndWallBlockItem
ThrowablePotionItem
TippedArrowItem
TridentItem
WindChargeItem
WritableBookItem*
WrittenBookItem*
AirItem
| Items |
|---|
Air is generated from register registerBlock(Blocks.AIR, AirItem::new). Therefore, it shares the same ID with the air block (minecraft:air) and has minecraft.block.air as its description ID.
However, unlike all other items defined by some method registerBlock(...), air is not a instance of BlockItem, because AirItem does not extend BlockItem.
getName(...)
Defined ignoring the item stack components, therefore, it is always a translation of minecraft.block.air regardless of the component item_name.
Note that many other properties of the air item are defined elsewhere in the code. See § Items member access.
ArmorStandItem
| Items |
|---|
useOn(...)
If the interaction involves clicking on the dowm side of a block, it fails.
The target position for placing the 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 hitbox of an armor stand in this position; if the hitbox collides with a block or intersects with an (no spectator) entity hitbox, the interaction fails.
The game attempts to obtain the armor stand, based on the item's components custom_name, custom_data, and entity_data. If it cannot be generated, the interaction fails.
In case of 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 sound event armor stand place (
entity.armor_stand.place) is played; - produce the game event
entity_place; - shrink one item of the item stack.
The interaction returns success given no aforementioned fails occur.
ArrowItem
AxeItem
BannerItem
BedItem
BlockItem
BoatItem
BoneMealItem
BottleItem
BowItem
BrushItem
BucketItem
BundleItem
CompassItem
CrossbowItem
DebugStickItem
DiscFragmentItem
| Items |
|---|
appendHoverText(...)
Define the first line of the tooltip as the translation of item.minecraft.disc_fragment.desc in gray (
#AAAAAA).
This line cannot be hidden by the tooltip_display component, except to completely hide the tooltip with hide_tooltip set to true.
DispensibleContainerItem
DoubleHighBlockItem
DyeItem
| Items | |
|---|---|
| Implements |
|
Each item is associated[until JE 26.1] with a dyeColor, that is a list with a ID, name, texture diffuse color, map color, firework color and text color. See Dye § Color values and color in text component format. From map color the white color is SNOW, lime is COLOR_LIGHT_GREEN and the other colors are COLOR_<COLOR NAME>.
Each item has[upcoming JE 26.1] a default dye component, defined in Items.
interactLivingEntity(...)
The interaction is only successful, instead of pass, when the interacting entity is a non-sheared live sheep of a different color than the dye color and the item stack has a dye component[upcoming JE 26.1].
In case of success, the sound dye use is played, set the sheep color (using the ID) and shrink the item stack by one.
getDyeColor()[until JE 26.1]
Get the dyeColor associated with the item. All usages below:
- Cat and Wolf: In
mobInteract, if the animal is tame by the player and the color of the collar is different, set the collar color and remove one item from the item stack. For cats, also setPersistenceRequiredto true. - LoomMenu: In
setupResultSlot, to set the banner pattern color in the loom menu - DyeColor: In
getMixedColor. This function receives twodyeColor, transforms them into dyes, and use they in crafting input. If the result is a dye, its DyeColor is returned. Otherwise, it returns a random color between the two received. It is Used to choose the collar color for baby cats and wolfs, and the baby sheep color, based on the parents' colors. - DyeItem: In
tryApplyToSign, see below. - DyedItemColor: In
applyDyes. This function changes thedyed_colorcomponent of an item based on a list of dyes. See the dye mixing formula for more details. Used for armor dye recipe and for a randomly armor dye for trading. - FireworkStarFadeRecipe and FireworkStarRecipe: In
assemble. Used for the result of firework star special recipes, append the firework color tocolorsandfede_coloresfromfirework explosioncomponent. These recipes cannot be customized by datapacks.
byColor(...)[until JE 26.1]
A function that receives a dyeColor and returns a dye. Used to create vanilla recipes (fully controlled by datapacks!). There are other uses, but these are only uses that assist with getDyeColor(), all of which are listed above.
tryApplyToSign(...)
If the stack item does not contain the dye component, it returns false[upcoming JE 26.1].
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.
Usage in instanceof
In other classes, some items are states of being an instance of DyeItem, meaning they are one of the dyes[until JE 26.1]. All these uses are listed below:
- Cat and Wolf: In
mobInteract(...), for test if the item is a dye before applying thegetDyeColor()method to color the collar.- In Cat, it is also used to prevent the item from being used as food for the cat tamed by the player, even if the item is in the #cat_food tag and not being used (because it is the same color as the old collar). However, for untamed cats, the dye can be used as food.
- LoomMenu: Used twice:
- In
mayPlace(...): Returns true iff the item is a dye. Used to allow items to be used in the loom dye slot. - In
quickMoveStack(...): Used to allow dyes to be moved from the inventory to the loom dye slot with a quick click (click + Shift).- This also prevents quick clicking from moving dyes to the pattern slot (even when the
provides_banner_patternscomponent is present) or moving them between storage slots and hotbar slots and vice versa, when the loom menu is open. Even if the dye fails to move to the dye slot.
- This also prevents quick clicking from moving dyes to the pattern slot (even when the
- In
- ArmorDyeRecipe, FireworkStarFadeRecipe, and FireworkStarRecipe: In each of these classes, used twice:
- In
matches(...): To test if the items in the crafting input can be used for one of these special recipes. - In
assemble(...): Used for the result of the special recipes, to test if the item is a dye before applyingapplyDyes(...)orgetDyeColor().
- In
EggItem
EmptyMapItem
EndCrystalItem
EnderEyeItem
EnderpearlItem
ExperienceBottleItem
FireChargeItem
FireworkRocketItem
FishingRodItem
FlintAndSteelItem
FoodOnAStickItem
GameMasterBlockItem
GlowInkSacItem
HangingEntityItem
HangingSignItem
HoeItem
HoneycombItem
InkSacItem
InstrumentItem
Item
ItemFrameItem
KnowledgeBookItem
LeadItem
LingeringPotionItem
MaceItem
MapItem
MinecartItem
MobBucketItem
NameTagItem
| Items |
|---|
interactLivingEntity(...)
The interaction will only be successful, instead of being passed, when:
- the item has a
custom_namecomponent, and - the entity isn't a player, leash knot, lightning bolt, or fishing bobber.
If the entity is alive, sets its CustomName to be the same as the name tag. If the entity is a mob, also sets PersistenceRequired true. Shrink the item stack of the item by one.
PlaceOnWaterBlockItem
PlayerHeadItem
PotionItem
| Items | |
|---|---|
| Implementations |
|
useOn(...)
The interaction will only be successful when:
- the face of the interacted block was not directed downwards,
- 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 sound generic splash (
entity.generic.splash), - Set glass bottle in hand,
- Send splash particles,
- Play bottle empty sound (
item.bottle.empty), - Produce the game event
fluid_place, - Convert the block to mud.
getName(...)
If the item has the component potion_contents, the name name is defined from it. The item uses the translation key item.minecraft.<item type>.effect.<potion name>, where <potion name> is the custom name of the potion contents, if available, and otherwise is the name of the potion in potion contents (see Potion § Item data), if available. If nether is available, is "empty".
This name will replace the name defined by item_name. However, it can still be replaced by the custom_name, if available.
ProjectileItem
ProjectileWeaponItem
ScaffoldingBlockItem
ShearsItem
ShieldItem
| Items |
|---|
getName(...)
If the item has the component base_color, the name is defined from it. The item uses the translation key item.minecraft.shield.<color>.
This name will replace the name defined by item_name component. However, it can still be replaced by the custom_name component, if available.
ShovelItem
SignItem
SmithingTemplateItem
SnowballItem
SolidBucketItem
SpawnEggItem
SpectralArrowItem
SplashPotionItem
SpyglassItem
StandingAndWallBlockItem
ThrowablePotionItem
TippedArrowItem
TridentItem
WindChargeItem
WritableBookItem
| Items |
|---|
use(...)
Open item GUI and increases the used statistic by one. Always returns successful.
Note:
The item GUI depends on the components writable_book_content and 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 book and quill and written book, since only these items attempt to open the GUI.
WrittenBookItem
| Items |
|---|
use(...)
Completely identical to WritableBookItem; see the § WritableBookItem.
Items member access
Blocks
CauldronInteraction
DispenseItemBehavior
AnvilMenu
PotionSlot
CartographyTableMenu
EnchantmentMenu
FurnaceFuelSlot
GrindstoneMenu
BeehiveBlock
CandleCakeBlock
ChiseledBookShelfBlock
ComposterBlock
ComposterBlock.OutputContainer
LightBlock
PowderSnowBlock
PumpkinBlock
RespawnAnchorBlock
SweetBerryBushBlock
TntBlock
TripWireBlock
WeatheringCopperGolemStatueBlock
WitherSkullBlock
AbstractFurnaceBlockEntity
BrewingStandBlockEntity
FuelValues
PotDecorations
vault.VaultConfig
Entity
AgeableMob[upcoming JE 26.1]
Entity
LivingEntity
Mob
CrossbowAttack
TradeWithVillager
UseBonemeal
WorkAtComposter
BegGoal
RangedBowAttackGoal
RangedCrossbowAttackGoal
Bucketable
Armadillo
Axolotl
Camel[upcoming JE 26.1]
AbstractCow
MushroomCow
AbstractChestedHorse
AbstractHorse
Horse[upcoming JE 26.1]
Llama
Goat
CopperGolem
IronGolem
SnowGolem
Panda[upcoming JE 26.1]
Pig
Sheep
Wolf
ArmorStand
LeashFenceKnotEntity
Creeper
CrossbowAttackMob
Strider
Illusioner
Pillager
Piglin
PiglinAi
PiglinBrute
AbstractSkeleton
Bogged
Drowned
DrownedTridentAttackGoal
Zombie
ZombieVillager
Villager
VillagerProfession
WanderingTrader
Player
FireworkRocketEntity
FishingHook
ProjectileUtil
Raid
Misc
EntityEquipmentPredicate
PotionBrewing
FireworkRocketRecipe[until JE 26.1]
FireworkStarRecipe[until JE 26.1]
FireworkStarFadeRecipe[until JE 26.1]
Ingredient
MapCloningRecipe[until JE 26.1]
MapExtendingRecipe[until JE 26.1]
ShieldDecorationRecipe[until JE 26.1]
TippedArrowRecipe[until JE 26.1]
CrossbowItem
EnchantmentHelper
Item
ItemStack
ItemStackTemplate[upcoming JE 26.1]
ProjectileWeaponItem
EnchantRandomlyFunction
ExplorationMapFunction
FillPlayerHead
SetEnchantmentsFunction
SetStewEffectFunction
CauldronInteraction
DispenseItemBehavior
AnvilMenu
| Items | |
|---|---|
| Package |
|
createResult
If the anvil input is an enchanted book, it will initially consider any 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 supported_items for all enchantment definition, when we consider the anvil.
PotionSlot
| Items | |
|---|---|
| Package |
|
| Outer Class |
|
mayPlaceItem
Returns true only if it is one of the four items listed above. Used to determine which items can be placed in the portion slot of the brewing stand.
It is also used in quickMoveStack, so that these items are attempted to be moved from the inventory to the potion slot with a quick click (click + Shift). Notes:
- If the item is in the #brewing_fuel tag, it will attempt to enter the fuel slot and not the potion slot (even if it fails to enter the fuel slot). Technically, the same would occur with ingredients, however, ingredients are also hardcoded and don't have intersection.
- This prevents quick clicking from moving them between storage slots and hotbar slots and vice versa, when the brewing stand menu is open. Even if the itens fails to move to the potion slot.
CartographyTableMenu
| Items | |
|---|---|
| Package |
|
mayPlace
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 cartography table.
setupResultSlot
Used to define the result item of the cartography table:
- If the
mapStack(item in slot 0) does not have amapData(data associated with itsmap_idcomponent), it will not yield any results.
- If it's paper and the
mapDatais not locked and has a scale less than 4, the resulting is one copy of themapStackwith themap_post_processingcomponent set to 1 (SCALE).
- If it's glass and the
mapDatais not locked, the resulting is one copy of themapStackwith themap_post_processingcomponent set to 0 (LOCK).
- If it's empty map, the resulting is two copy of the
mapStack.
Note: It's possible to use the cartography table regardless of the mapStack ID; it only needs to have the map_id component with data. However, when retrieving an item that the ID isn't filled_map with the map_post_processing component, the game crashes[2]. However, using the empty map still works for item duplication.
quickMoveStack
When using the quick click (click + Shift) in the inventory with the table and control menu, it attempts to move these items to slot 1. Notes:
- If the item has the
map_idcomponent, 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.
Future subsections
Old article stub
List
- Is entity_data used by spawn eggs, boats, minecarts, armor stands, paintings, item frames and end crystals by default, or are those controlled by the item ID?
- Block items
- ID of the block placed
block_statecan control the specific state an item places, but cannot control the exact ID.
- ID of the block placed
- Projectile items: eggs, snowballs, splash potions, lingering potions, bottles o' enchanting, eyes of ender, ender pearls, firework rockets(?), wind charges
- The entity spawned does not appear to be customizable.
- Fishing rods
- What entity is spawned, and presumably many other things.
- Bows
- Almost all aspects of behavior. [more information needed]
- Crossbows
- Much the same: defaults for animation, charge time, accepted items for loading, ...
- Tridents
- Animation, charge time
- Swords
- The ability to sweep attack
- Mace
- Items which can be fed to zombie villagers to cure them
- Lead
- Fire charge
- Dispenser behavior appears to be hardcoded
- ID of block placed
- Flint and Steel
- ID of block placed
- Things in buckets
- ID of block placed, and possibly entity spawned if this isn't handled already
- Cauldron interaction
- Buckets
- What block IDs (and states) / fluid IDs can be deleted on right click
- Milking cows
- Interacting with empty cauldrons
- Bowls
- Milking mooshrooms
- Items that interact with blocks on right click, possibly including a loot table for dropped items, and whether the item should be deleted, damaged, or converted to something else on use
- Hoes on tillable blocks - converting things to farmland, or coarse dirt to dirt
- Shovels on dirt-like blocks, converting them into dirt paths
- Axes on logs/wood and stems/hyphae, stripping
- Axes on oxidised copper, reducing
- Axes on waxed copper, dewaxing
- Honeycomb on unwaxed copper, waxing
- Water bottle on dirt-like blocks, converting to mud
- Eye of Ender on empty end portal frame, adding the eye
- Pottable plants used on flower pots, turning the pot into a potted plant
- Shears on an uncarved pumpkin, carving it and producing seeds
- Shears on a full beehive or bee nest, producing honeycomb and setting honey level to 0
- Empty bottle on a full beehive or bee nest, converting it to a honey bottle and setting honey level to 0
- Bone meal usage
- Items used on entities
- Shears
- On sheep, to shear them
- On mooshrooms, to shear them
- On snow golems, to remove the pumpkin
- On bogged, to obtain mushrooms
- On leashed mobs, to obtain the lead
- On some equipped mobs, to obtain the equipment
- It is possible to control which equipment will be picked up with the scissors with the component
equippable~{can_be_sheared:true}, but not which scissors (and not another item) will be used for this.
- It is possible to control which equipment will be picked up with the scissors with the component
- On copper golems, to obtain the poppy
- Iron ingots
- On iron golems, to heal them
- Dyes
- On sheep, to dye their wool
- On wolves, to dye their collars
- On cats, to dye their collars
- Brush
- On armadillos to get scutes
- Axe
- On oxidized copper golem, reducing
- On waxed copper golem, dewaxing
- Honeycomb
- On unwaxed copper golem, waxing
- Shears
- Empty bottles
- Using on water or water cauldrons to fill the bottle
- Using on dragon breath to fill the bottle
- Water bottles
- Using on empty cauldrons or non-full water cauldrons to fill the cauldron
- Brush usage
History
| Upcoming Java Edition | |||||||
|---|---|---|---|---|---|---|---|
| 26.1 | snap3 | The bundle_contents component can now handle errors in the weight,[note 4] considering the weight equal to error and keeping its data. Previously, the component was only deleted. Therefore, instances of BundleItem 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 | |||||||
|
The spawn egg behavior is now given to any instance of SpawnEggItem that has an | |||||||
|
Added ItemStackTemplate class with reference to | |||||||
Items stack with invalid data (e.g., count greater than max_stack_size) are now considered empty for many uses of the bundle_contents, container, and charged_projectiles components, meaning that items which rely on these components treat such stacks as empty, even though the invalid data may still exist in the data component. For example:
| |||||||
| snap5 | Instances of DyeItem are no longer associated with a dyeColor; instead, each dye has the default dye component. Therefore, their methods use the dye component from item stack, instead of DyeColor, and pass or return false if the component does not exist. Thus, the tryApplyToSign() SignApplicator method has a ItemStack parameter.
| ||||||
The methods getDyeColor() and byColor(...) have been removed from DyeItem, due to the dye component.
| |||||||
All uses of instanceof of DyeItem have been removed, due to the dye component.
| |||||||
| Added golden dandelion as a new BlockItem instance. | |||||||
Added potted golden dandelion, a new instance of FlowerPotBlock. Thus, through the useItemOn(...) method in FlowerPotBlock, which import the BlockItem, the golden dandelion has the hardcoded property of interacting with the flower pot.
| |||||||
| Add new Items member access in AgeableMob, Camel, AbstractChestedHorse, Horse, and Panda classes for properties of the golden dandelion. | |||||||
In AbstractHorse and Llama, added hay bale Items member access, for testing as a possible food. Previously, the Blocks class was used with the asItem() method. Furthermore, these classes require that the animal not be age-locked in order to use a hardcoded food to increase the age.
| |||||||
| The classes FireworkRocketRecipe, FireworkStarRecipe, FireworkStarFadeRecipe, MapExtendingRecipe, and ShieldDecorationRecipe no longer have member access to Items.
The items in these recipes are controlled by datapacks, no longer being a hardcoded item properties, except for ShieldDecorationRecipe; see details below. For the vanilla datapack, the items are controlled by VanillaRecipeProvider. | |||||||
| The classes MapCloningRecipe and TippedArrowRecipe, which previously had access to members of Items, have been removed.
The recipes previously coded by these classes are now coded by the classes TransmuteRecipeBuilder and ImbueRecipe, respectively. The items in these recipes are controlled by datapacks, no longer being a hardcoded item propeties. For the vanilla datapack, the items are controlled by VanillaRecipeProvider. | |||||||
|
The classes BannerDuplicateRecipe, and ShieldDecorationRecipe, those that uses instanceof of BannerItem have been changed Now, in addition to using | |||||||
Notes
- ↑ With two or more dragon's breath in the brewing stand, after the brewing process, a glass bottle drops as an entity. However, with one dragon's breath in the brewing stand, the glass bottle is consumed and cannot be retrieved.[1]
- ↑ It is possible for certain properties of item A to cause the creation of a new instance of item B, but in these cases it will be a property of item A and not item B.
- ↑ Some numbers are lower than the actual number of uses. This occurs when a single line of code contains many Items member and the line is very long. The count was done by a program that prints all lines of code using the Items class, but long lines are not printed in their entirety.
- ↑ An error in the weight of the
bundle_countscomponent, in addition to invalid count data, occurs when the weight exceeds 231-1 (equivalent to 231-1 stacks). This can happen by using/giveto generate items with many layers of thebundle_countscomponent, and then using/datato place these items in the bundle.