Package net.minecraft.item
Class Item
java.lang.Object
net.minecraft.item.Item
- Direct Known Subclasses:
ArmorItem,ArmorStandItem,BedItem,BlockItem,BoatItem,BookItem,BowItem,BucketItem,CarrotOnAStickItem,CoalItem,DyeItem,EggItem,EnchantedBookItem,EnderEyeItem,EnderPearlItem,ExperienceBottleItem,FireChargeItem,FireworkChargeItem,FireworkItem,FishingRodItem,FlintAndSteelItem,FoodItem,GlassBottleItem,HoeItem,LeadItem,MilkBucketItem,MinecartItem,MusicDiscItem,NameTagItem,NetherStarItem,NetworkSyncedItem,PlaceableItem,PotionItem,RedstoneItem,SaddleItem,ShearsItem,SignItem,SkullItem,SnowballItem,SpawnEggItem,SwordItem,ToolItem,WallHangableItem,WheatSeedsItem,WoodenDoorItem,WritableBookItem,WrittenBookItem
public class Item extends Object
The Item class provides useful methods and fields for creation of Items.
All items extend the Item class.
The Item class also registers all items.
- See Also:
Items- Mappings:
Namespace Name official zwintermediary net/minecraft/class_2054named net/minecraft/item/Item
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classItem.ToolMaterialTypeThe ToolMaterialType enum is the basis for all tool materials. -
Field Summary
Fields Modifier and Type Field Description protected static UUIDATTACK_DAMAGE_MODIFIER_UUIDprivate static Map<Block,Item>BLOCK_ITEMSA map containing all BlockItems, with their corresponding Block and Item variantsprotected booleandamageableSets whether the item has durabilityprivate ItemGroupgroupThe Item's ItemGroupprotected booleanhandheldSets whether the item is handheldprotected intmaxCountThe maximum stack size of an itemprivate intmaxDamageThe maximum durability of an Itemprotected static RandomRANDOMprivate ItemrecipeRemainderThe item's recipe remainder.static SimpleRegistry<Identifier,Item>REGISTRYThe Registry where all items get registered to.private StringstatusEffectStringA description of the brewing recipe for their ingredientsprivate StringtranslationKeyThe Item's translation key. -
Constructor Summary
Constructors Constructor Description Item()Sets the max stack size of an Item to 64 -
Method Summary
Modifier and Type Method Description voidappendItemStacks(Item item, ItemGroup group, List<ItemStack> list)Registers an item's sub itemsvoidappendTooltip(ItemStack stack, PlayerEntity player, List<String> lines, boolean advanced)static ItembyRawId(int id)Returns an Item for its numeric IdbooleancanRepair(ItemStack stack, ItemStack ingredient)Returns whether the item can be repaired via an anvil or crafting table.booleancanUseOnEntity(ItemStack stack, PlayerEntity player, LivingEntity entity)static ItemfromBlock(Block block)Returns a BlockItem from a blockMultimap<String,AttributeModifier>getAttributeModifierMap()Returns a map containing entity attributes that are modified by the itemintgetDisplayColor(ItemStack stack, int color)StringgetDisplayName(ItemStack stack)intgetEnchantability()Returns the enchantability of an Item.static ItemgetFromId(String id)Returns an Item from its name or its numeric Id as a StringItemGroupgetItemGroup()Returns the itemgroup that the item is inStringgetItemstackTranslatedName(ItemStack stack)Returns the translated name of an ItemStackintgetMaxCount()Returns the max stack size of an ItemintgetMaxDamage()Returns the maximum durability of the current Item.intgetMaxUseTime(ItemStack stack)intgetMeta(int i)floatgetMiningSpeedMultiplier(ItemStack stack, Block block)RaritygetRarity(ItemStack stack)Returns the rarity of the current Item.static intgetRawId(Item item)Returns a numeric id for an ItemItemgetRecipeRemainder()Returns the current Item's recipe remainderStringgetStatusEffectString(ItemStack stack)Returns the status effect string for the current item.StringgetTranslationKey()Returns the translation key of the current ItemStringgetTranslationKey(ItemStack stack)UseActiongetUseAction(ItemStack stack)Returns the UseAction for an item when the item is used.booleanhasEnchantmentGlint(ItemStack stack)Returns whether the current item has an enchantment glint.booleanhasStatusEffectString(ItemStack stack)Returns whether the current item has a status effect stringbooleanhasSubTypes()voidinventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected)Runs every tick when the item is in an inventory.booleanisDamageable()Returns whether the current item is damageable.booleanisEffectiveOn(Block block)booleanisEnchantable(ItemStack stack)Returns whether the current item can have enchantments.booleanisFood()booleanisHandheld()Returns whether the item is supposed to look as handheld.booleanisNetworkSynced()booleanisUnbreakable()Returns whether the item is unbreakablebooleanonBlockBroken(ItemStack stack, World world, Block block, BlockPos pos, LivingEntity entity)voidonCraft(ItemStack stack, World world, PlayerEntity player)Runs when the item is craftedbooleanonEntityHit(ItemStack stack, LivingEntity entity1, LivingEntity entity2)ItemStackonFinishUse(ItemStack stack, World world, PlayerEntity player)protected HitResultonHit(World world, PlayerEntity player, boolean liquid)Returns the HitResult for an item when the player's arm is swung while holding the item.ItemStackonStartUse(ItemStack stack, World world, PlayerEntity player)voidonUseStopped(ItemStack stack, World world, PlayerEntity player, int remainingTicks)booleanpostProcessTag(CompoundTag tag)private static voidregister(int id, String name, Item item)Overloaded method that registers an Item to the registryprivate static voidregister(int id, Identifier name, Item item)Registers an item to the registryprivate static voidregisterBlockItem(Block block)Overloaded method that registers a BlockItem to the registryprotected static voidregisterBlockItem(Block block, Item blockItem)Registers a BlockItem to the registryItemsetHandheld()Sets the item to look as handheld.ItemsetItemGroup(ItemGroup group)Sets the itemgroup that the current item should be inItemsetMaxCount(int count)Sets the max stack size of the Itemprotected ItemsetMaxDamage(int damage)Sets the maximum durability of the current Item.ItemsetRecipeRemainder(Item recipeRemainder)Sets the item's recipe remainderprotected ItemsetStatusEffectString(String statusEffectString)Sets the status effect string for the current item.ItemsetTranslationKey(String translationKey)Sets the current item's translation key.protected ItemsetUnbreakable(boolean unbreakable)Sets the current item as unbreakable.static voidsetup()This is the main method in the Item class.booleanshouldRotate()booleanshouldSyncTagToClient()booleanuse(ItemStack itemStack, PlayerEntity player, World world, BlockPos pos, Direction direction, float facingX, float facingY, float facingZ)
-
Field Details
-
REGISTRY
The Registry where all items get registered to.- Mappings:
Namespace Name Mixin selector official eLzw;e:Lcx;intermediary field_8633Lnet/minecraft/class_2054;field_8633:Lnet/minecraft/class_1393;named REGISTRYLnet/minecraft/item/Item;REGISTRY:Lnet/minecraft/util/registry/SimpleRegistry;
-
BLOCK_ITEMS
A map containing all BlockItems, with their corresponding Block and Item variants- Mappings:
Namespace Name Mixin selector official aLzw;a:Ljava/util/Map;intermediary field_8629Lnet/minecraft/class_2054;field_8629:Ljava/util/Map;named BLOCK_ITEMSLnet/minecraft/item/Item;BLOCK_ITEMS:Ljava/util/Map;
-
ATTACK_DAMAGE_MODIFIER_UUID
- Mappings:
Namespace Name Mixin selector official fLzw;f:Ljava/util/UUID;intermediary field_8634Lnet/minecraft/class_2054;field_8634:Ljava/util/UUID;named ATTACK_DAMAGE_MODIFIER_UUIDLnet/minecraft/item/Item;ATTACK_DAMAGE_MODIFIER_UUID:Ljava/util/UUID;
-
RANDOM
- Mappings:
Namespace Name Mixin selector official gLzw;g:Ljava/util/Random;intermediary field_8635Lnet/minecraft/class_2054;field_8635:Ljava/util/Random;named RANDOMLnet/minecraft/item/Item;RANDOM:Ljava/util/Random;
-
group
The Item's ItemGroup- Mappings:
Namespace Name Mixin selector official bLzw;b:Lyz;intermediary field_8630Lnet/minecraft/class_2054;field_8630:Lnet/minecraft/class_2029;named groupLnet/minecraft/item/Item;group:Lnet/minecraft/item/ItemGroup;
-
maxCount
protected int maxCountThe maximum stack size of an item- Mappings:
Namespace Name Mixin selector official hLzw;h:Iintermediary field_8636Lnet/minecraft/class_2054;field_8636:Inamed maxCountLnet/minecraft/item/Item;maxCount:I
-
maxDamage
private int maxDamageThe maximum durability of an Item- Mappings:
Namespace Name Mixin selector official cLzw;c:Iintermediary field_8631Lnet/minecraft/class_2054;field_8631:Inamed maxDamageLnet/minecraft/item/Item;maxDamage:I
-
handheld
protected boolean handheldSets whether the item is handheld- Mappings:
Namespace Name Mixin selector official iLzw;i:Zintermediary field_8637Lnet/minecraft/class_2054;field_8637:Znamed handheldLnet/minecraft/item/Item;handheld:Z
-
damageable
protected boolean damageableSets whether the item has durability- Mappings:
Namespace Name Mixin selector official jLzw;j:Zintermediary field_8638Lnet/minecraft/class_2054;field_8638:Znamed damageableLnet/minecraft/item/Item;damageable:Z
-
recipeRemainder
The item's recipe remainder. Used by Buckets and potions.- See Also:
PotionItem,BucketItem- Mappings:
Namespace Name Mixin selector official dLzw;d:Lzw;intermediary field_8632Lnet/minecraft/class_2054;field_8632:Lnet/minecraft/class_2054;named recipeRemainderLnet/minecraft/item/Item;recipeRemainder:Lnet/minecraft/item/Item;
-
statusEffectString
A description of the brewing recipe for their ingredients- Mappings:
Namespace Name Mixin selector official kLzw;k:Ljava/lang/String;intermediary field_8639Lnet/minecraft/class_2054;field_8639:Ljava/lang/String;named statusEffectStringLnet/minecraft/item/Item;statusEffectString:Ljava/lang/String;
-
translationKey
The Item's translation key.- Mappings:
Namespace Name Mixin selector official lLzw;l:Ljava/lang/String;intermediary field_8640Lnet/minecraft/class_2054;field_8640:Ljava/lang/String;named translationKeyLnet/minecraft/item/Item;translationKey:Ljava/lang/String;
-
-
Constructor Details
-
Item
public Item()Sets the max stack size of an Item to 64- Mappings:
Namespace Name Mixin selector official <init>Lzw;<init>()Vintermediary <init>Lnet/minecraft/class_2054;<init>()Vnamed <init>Lnet/minecraft/item/Item;<init>()V
-
-
Method Details
-
getRawId
Returns a numeric id for an Item- Returns:
- Numeric Id
- Mappings:
Namespace Name Mixin selector official bLzw;b(Lzw;)Iintermediary method_8272Lnet/minecraft/class_2054;method_8272(Lnet/minecraft/class_2054;)Inamed getRawIdLnet/minecraft/item/Item;getRawId(Lnet/minecraft/item/Item;)I
-
byRawId
Returns an Item for its numeric Id- Returns:
- Item
- Mappings:
Namespace Name Mixin selector official bLzw;b(I)Lzw;intermediary method_8270Lnet/minecraft/class_2054;method_8270(I)Lnet/minecraft/class_2054;named byRawIdLnet/minecraft/item/Item;byRawId(I)Lnet/minecraft/item/Item;
-
fromBlock
Returns a BlockItem from a block- Returns:
- Block
- Mappings:
Namespace Name Mixin selector official aLzw;a(Lafh;)Lzw;intermediary method_8251Lnet/minecraft/class_2054;method_8251(Lnet/minecraft/class_160;)Lnet/minecraft/class_2054;named fromBlockLnet/minecraft/item/Item;fromBlock(Lnet/minecraft/block/Block;)Lnet/minecraft/item/Item;
-
getFromId
Returns an Item from its name or its numeric Id as a String- Returns:
- Item
- Mappings:
Namespace Name Mixin selector official dLzw;d(Ljava/lang/String;)Lzw;intermediary method_8280Lnet/minecraft/class_2054;method_8280(Ljava/lang/String;)Lnet/minecraft/class_2054;named getFromIdLnet/minecraft/item/Item;getFromId(Ljava/lang/String;)Lnet/minecraft/item/Item;
-
postProcessTag
- Mappings:
Namespace Name Mixin selector official aLzw;a(Ldn;)Zintermediary method_8253Lnet/minecraft/class_2054;method_8253(Lnet/minecraft/class_1405;)Znamed postProcessTagLnet/minecraft/item/Item;postProcessTag(Lnet/minecraft/nbt/CompoundTag;)Z
-
setMaxCount
Sets the max stack size of the Item- Parameters:
count- Maximum stack size- Returns:
- The current Item
- Mappings:
Namespace Name Mixin selector official cLzw;c(I)Lzw;intermediary method_8275Lnet/minecraft/class_2054;method_8275(I)Lnet/minecraft/class_2054;named setMaxCountLnet/minecraft/item/Item;setMaxCount(I)Lnet/minecraft/item/Item;
-
use
public boolean use(ItemStack itemStack, PlayerEntity player, World world, BlockPos pos, Direction direction, float facingX, float facingY, float facingZ)- Mappings:
Namespace Name Mixin selector official aLzw;a(Lzx;Lwn;Ladm;Lcj;Lcq;FFF)Zintermediary method_8264Lnet/minecraft/class_2054;method_8264(Lnet/minecraft/class_2056;Lnet/minecraft/class_1963;Lnet/minecraft/class_99;Lnet/minecraft/class_1372;Lnet/minecraft/class_1383;FFF)Znamed useLnet/minecraft/item/Item;use(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;FFF)Z
-
getMiningSpeedMultiplier
- Mappings:
Namespace Name Mixin selector official aLzw;a(Lzx;Lafh;)Fintermediary method_8262Lnet/minecraft/class_2054;method_8262(Lnet/minecraft/class_2056;Lnet/minecraft/class_160;)Fnamed getMiningSpeedMultiplierLnet/minecraft/item/Item;getMiningSpeedMultiplier(Lnet/minecraft/item/ItemStack;Lnet/minecraft/block/Block;)F
-
onStartUse
- Mappings:
Namespace Name Mixin selector official aLzw;a(Lzx;Ladm;Lwn;)Lzx;intermediary method_8260Lnet/minecraft/class_2054;method_8260(Lnet/minecraft/class_2056;Lnet/minecraft/class_99;Lnet/minecraft/class_1963;)Lnet/minecraft/class_2056;named onStartUseLnet/minecraft/item/Item;onStartUse(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/item/ItemStack;
-
onFinishUse
- Mappings:
Namespace Name Mixin selector official bLzw;b(Lzx;Ladm;Lwn;)Lzx;intermediary method_8273Lnet/minecraft/class_2054;method_8273(Lnet/minecraft/class_2056;Lnet/minecraft/class_99;Lnet/minecraft/class_1963;)Lnet/minecraft/class_2056;named onFinishUseLnet/minecraft/item/Item;onFinishUse(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/item/ItemStack;
-
getMaxCount
public int getMaxCount()Returns the max stack size of an Item- Returns:
- Max stack Size
- Mappings:
Namespace Name Mixin selector official jLzw;j()Iintermediary method_8292Lnet/minecraft/class_2054;method_8292()Inamed getMaxCountLnet/minecraft/item/Item;getMaxCount()I
-
getMeta
public int getMeta(int i)- Mappings:
Namespace Name Mixin selector official aLzw;a(I)Iintermediary method_8247Lnet/minecraft/class_2054;method_8247(I)Inamed getMetaLnet/minecraft/item/Item;getMeta(I)I
-
isUnbreakable
public boolean isUnbreakable()Returns whether the item is unbreakable- Returns:
- Whether the item is unbreakable
- Mappings:
Namespace Name Mixin selector official kLzw;k()Zintermediary method_8294Lnet/minecraft/class_2054;method_8294()Znamed isUnbreakableLnet/minecraft/item/Item;isUnbreakable()Z
-
setUnbreakable
Sets the current item as unbreakable.- Parameters:
unbreakable- Unbreakable- Returns:
- The current Item
- Mappings:
Namespace Name Mixin selector official aLzw;a(Z)Lzw;intermediary method_8268Lnet/minecraft/class_2054;method_8268(Z)Lnet/minecraft/class_2054;named setUnbreakableLnet/minecraft/item/Item;setUnbreakable(Z)Lnet/minecraft/item/Item;
-
getMaxDamage
public int getMaxDamage()Returns the maximum durability of the current Item.- Returns:
- Max Durability
- Mappings:
Namespace Name Mixin selector official lLzw;l()Iintermediary method_8296Lnet/minecraft/class_2054;method_8296()Inamed getMaxDamageLnet/minecraft/item/Item;getMaxDamage()I
-
setMaxDamage
Sets the maximum durability of the current Item.- Parameters:
damage- Maximum durability- Returns:
- The current Item
- Mappings:
Namespace Name Mixin selector official dLzw;d(I)Lzw;intermediary method_8279Lnet/minecraft/class_2054;method_8279(I)Lnet/minecraft/class_2054;named setMaxDamageLnet/minecraft/item/Item;setMaxDamage(I)Lnet/minecraft/item/Item;
-
isDamageable
public boolean isDamageable()Returns whether the current item is damageable. Used by tools, armor, bows, etc. -
onEntityHit
- Mappings:
Namespace Name Mixin selector official aLzw;a(Lzx;Lpr;Lpr;)Zintermediary method_8263Lnet/minecraft/class_2054;method_8263(Lnet/minecraft/class_2056;Lnet/minecraft/class_1752;Lnet/minecraft/class_1752;)Znamed onEntityHitLnet/minecraft/item/Item;onEntityHit(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/LivingEntity;)Z
-
onBlockBroken
public boolean onBlockBroken(ItemStack stack, World world, Block block, BlockPos pos, LivingEntity entity)- Mappings:
Namespace Name Mixin selector official aLzw;a(Lzx;Ladm;Lafh;Lcj;Lpr;)Zintermediary method_8258Lnet/minecraft/class_2054;method_8258(Lnet/minecraft/class_2056;Lnet/minecraft/class_99;Lnet/minecraft/class_160;Lnet/minecraft/class_1372;Lnet/minecraft/class_1752;)Znamed onBlockBrokenLnet/minecraft/item/Item;onBlockBroken(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/block/Block;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/LivingEntity;)Z
-
isEffectiveOn
- Mappings:
Namespace Name Mixin selector official bLzw;b(Lafh;)Zintermediary method_8271Lnet/minecraft/class_2054;method_8271(Lnet/minecraft/class_160;)Znamed isEffectiveOnLnet/minecraft/item/Item;isEffectiveOn(Lnet/minecraft/block/Block;)Z
-
canUseOnEntity
- Mappings:
Namespace Name Mixin selector official aLzw;a(Lzx;Lwn;Lpr;)Zintermediary method_8266Lnet/minecraft/class_2054;method_8266(Lnet/minecraft/class_2056;Lnet/minecraft/class_1963;Lnet/minecraft/class_1752;)Znamed canUseOnEntityLnet/minecraft/item/Item;canUseOnEntity(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/entity/LivingEntity;)Z
-
setHandheld
Sets the item to look as handheld.- Returns:
- The current Item
- Mappings:
Namespace Name Mixin selector official nLzw;n()Lzw;intermediary method_8299Lnet/minecraft/class_2054;method_8299()Lnet/minecraft/class_2054;named setHandheldLnet/minecraft/item/Item;setHandheld()Lnet/minecraft/item/Item;
-
isHandheld
Returns whether the item is supposed to look as handheld.- Mappings:
Namespace Name Mixin selector official w_Lzw;w_()Zintermediary method_8305Lnet/minecraft/class_2054;method_8305()Znamed isHandheldLnet/minecraft/item/Item;isHandheld()Z
-
shouldRotate
- Mappings:
Namespace Name Mixin selector official eLzw;e()Zintermediary method_8283Lnet/minecraft/class_2054;method_8283()Znamed shouldRotateLnet/minecraft/item/Item;shouldRotate()Z
-
setTranslationKey
Sets the current item's translation key.- Parameters:
translationKey- Translation key- Returns:
- The current Item
- Mappings:
Namespace Name Mixin selector official cLzw;c(Ljava/lang/String;)Lzw;intermediary method_8277Lnet/minecraft/class_2054;method_8277(Ljava/lang/String;)Lnet/minecraft/class_2054;named setTranslationKeyLnet/minecraft/item/Item;setTranslationKey(Ljava/lang/String;)Lnet/minecraft/item/Item;
-
getItemstackTranslatedName
Returns the translated name of an ItemStack- Parameters:
stack- The ItemStack- Returns:
- Translated name
- See Also:
CommonI18n- Mappings:
Namespace Name Mixin selector official kLzw;k(Lzx;)Ljava/lang/String;intermediary method_8295Lnet/minecraft/class_2054;method_8295(Lnet/minecraft/class_2056;)Ljava/lang/String;named getItemstackTranslatedNameLnet/minecraft/item/Item;getItemstackTranslatedName(Lnet/minecraft/item/ItemStack;)Ljava/lang/String;
-
getTranslationKey
Returns the translation key of the current Item- Returns:
- Translation key
- Mappings:
Namespace Name Mixin selector official aLzw;a()Ljava/lang/String;intermediary method_8246Lnet/minecraft/class_2054;method_8246()Ljava/lang/String;named getTranslationKeyLnet/minecraft/item/Item;getTranslationKey()Ljava/lang/String;
-
getTranslationKey
- Mappings:
Namespace Name Mixin selector official e_Lzw;e_(Lzx;)Ljava/lang/String;intermediary method_8286Lnet/minecraft/class_2054;method_8286(Lnet/minecraft/class_2056;)Ljava/lang/String;named getTranslationKeyLnet/minecraft/item/Item;getTranslationKey(Lnet/minecraft/item/ItemStack;)Ljava/lang/String;
-
setRecipeRemainder
Sets the item's recipe remainder- Returns:
- The current Item
- Mappings:
Namespace Name Mixin selector official cLzw;c(Lzw;)Lzw;intermediary method_8278Lnet/minecraft/class_2054;method_8278(Lnet/minecraft/class_2054;)Lnet/minecraft/class_2054;named setRecipeRemainderLnet/minecraft/item/Item;setRecipeRemainder(Lnet/minecraft/item/Item;)Lnet/minecraft/item/Item;
-
shouldSyncTagToClient
public boolean shouldSyncTagToClient()- Mappings:
Namespace Name Mixin selector official pLzw;p()Zintermediary method_8300Lnet/minecraft/class_2054;method_8300()Znamed shouldSyncTagToClientLnet/minecraft/item/Item;shouldSyncTagToClient()Z
-
getRecipeRemainder
Returns the current Item's recipe remainder- Returns:
- recipeRemainder
- Mappings:
Namespace Name Mixin selector official qLzw;q()Lzw;intermediary method_8301Lnet/minecraft/class_2054;method_8301()Lnet/minecraft/class_2054;named getRecipeRemainderLnet/minecraft/item/Item;getRecipeRemainder()Lnet/minecraft/item/Item;
-
isFood
public boolean isFood()- Mappings:
Namespace Name Mixin selector official rLzw;r()Zintermediary method_8302Lnet/minecraft/class_2054;method_8302()Znamed isFoodLnet/minecraft/item/Item;isFood()Z
-
getDisplayColor
- Mappings:
Namespace Name Mixin selector official aLzw;a(Lzx;I)Iintermediary method_8257Lnet/minecraft/class_2054;method_8257(Lnet/minecraft/class_2056;I)Inamed getDisplayColorLnet/minecraft/item/Item;getDisplayColor(Lnet/minecraft/item/ItemStack;I)I
-
inventoryTick
Runs every tick when the item is in an inventory.- Parameters:
stack- The item in an ItemStack formworld- The world where the item is tickingentity- The entity whose inventory contains the itemslot- The slot in which the item is placedselected- Whether the item is currently selected by the entity- Mappings:
Namespace Name Mixin selector official aLzw;a(Lzx;Ladm;Lpk;IZ)Vintermediary method_8259Lnet/minecraft/class_2054;method_8259(Lnet/minecraft/class_2056;Lnet/minecraft/class_99;Lnet/minecraft/class_1745;IZ)Vnamed inventoryTickLnet/minecraft/item/Item;inventoryTick(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;IZ)V
-
onCraft
Runs when the item is crafted- Parameters:
stack- The item in an ItemStack formworld- The world where the crafting happenedplayer- The player who crafted the item- Mappings:
Namespace Name Mixin selector official dLzw;d(Lzx;Ladm;Lwn;)Vintermediary method_8282Lnet/minecraft/class_2054;method_8282(Lnet/minecraft/class_2056;Lnet/minecraft/class_99;Lnet/minecraft/class_1963;)Vnamed onCraftLnet/minecraft/item/Item;onCraft(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;)V
-
isNetworkSynced
public boolean isNetworkSynced()- Mappings:
Namespace Name Mixin selector official fLzw;f()Zintermediary method_8287Lnet/minecraft/class_2054;method_8287()Znamed isNetworkSyncedLnet/minecraft/item/Item;isNetworkSynced()Z
-
getUseAction
Returns the UseAction for an item when the item is used. Used by food, potions, bows, etc.- Parameters:
stack- The ItemStack that was used- See Also:
BowItem,PotionItem- Mappings:
Namespace Name Mixin selector official eLzw;e(Lzx;)Laba;intermediary method_8285Lnet/minecraft/class_2054;method_8285(Lnet/minecraft/class_2056;)Lnet/minecraft/class_30;named getUseActionLnet/minecraft/item/Item;getUseAction(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/util/UseAction;
-
getMaxUseTime
- Mappings:
Namespace Name Mixin selector official dLzw;d(Lzx;)Iintermediary method_8281Lnet/minecraft/class_2054;method_8281(Lnet/minecraft/class_2056;)Inamed getMaxUseTimeLnet/minecraft/item/Item;getMaxUseTime(Lnet/minecraft/item/ItemStack;)I
-
onUseStopped
- Mappings:
Namespace Name Mixin selector official aLzw;a(Lzx;Ladm;Lwn;I)Vintermediary method_8261Lnet/minecraft/class_2054;method_8261(Lnet/minecraft/class_2056;Lnet/minecraft/class_99;Lnet/minecraft/class_1963;I)Vnamed onUseStoppedLnet/minecraft/item/Item;onUseStopped(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;I)V
-
setStatusEffectString
Sets the status effect string for the current item. Used by glowstone, spider eye, sugar, etc.- Parameters:
statusEffectString- The status effect string- Returns:
- The current Item
- Mappings:
Namespace Name Mixin selector official eLzw;e(Ljava/lang/String;)Lzw;intermediary method_8284Lnet/minecraft/class_2054;method_8284(Ljava/lang/String;)Lnet/minecraft/class_2054;named setStatusEffectStringLnet/minecraft/item/Item;setStatusEffectString(Ljava/lang/String;)Lnet/minecraft/item/Item;
-
getStatusEffectString
Returns the status effect string for the current item.- Returns:
- The status effect string
- Mappings:
Namespace Name Mixin selector official jLzw;j(Lzx;)Ljava/lang/String;intermediary method_8293Lnet/minecraft/class_2054;method_8293(Lnet/minecraft/class_2056;)Ljava/lang/String;named getStatusEffectStringLnet/minecraft/item/Item;getStatusEffectString(Lnet/minecraft/item/ItemStack;)Ljava/lang/String;
-
hasStatusEffectString
Returns whether the current item has a status effect string- Returns:
- Whether the current item has a status effect string
- Mappings:
Namespace Name Mixin selector official lLzw;l(Lzx;)Zintermediary method_8297Lnet/minecraft/class_2054;method_8297(Lnet/minecraft/class_2056;)Znamed hasStatusEffectStringLnet/minecraft/item/Item;hasStatusEffectString(Lnet/minecraft/item/ItemStack;)Z
-
appendTooltip
@Environment(CLIENT) public void appendTooltip(ItemStack stack, PlayerEntity player, List<String> lines, boolean advanced)- Mappings:
Namespace Name Mixin selector official aLzw;a(Lzx;Lwn;Ljava/util/List;Z)Vintermediary method_8265Lnet/minecraft/class_2054;method_8265(Lnet/minecraft/class_2056;Lnet/minecraft/class_1963;Ljava/util/List;Z)Vnamed appendTooltipLnet/minecraft/item/Item;appendTooltip(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;Ljava/util/List;Z)V
-
getDisplayName
- Mappings:
Namespace Name Mixin selector official aLzw;a(Lzx;)Ljava/lang/String;intermediary method_8256Lnet/minecraft/class_2054;method_8256(Lnet/minecraft/class_2056;)Ljava/lang/String;named getDisplayNameLnet/minecraft/item/Item;getDisplayName(Lnet/minecraft/item/ItemStack;)Ljava/lang/String;
-
hasEnchantmentGlint
Returns whether the current item has an enchantment glint. Used by enchanted golden apples and enchanted items.- See Also:
net.minecraft.item.GoldenAppleItem- Mappings:
Namespace Name Mixin selector official fLzw;f(Lzx;)Zintermediary method_8288Lnet/minecraft/class_2054;method_8288(Lnet/minecraft/class_2056;)Znamed hasEnchantmentGlintLnet/minecraft/item/Item;hasEnchantmentGlint(Lnet/minecraft/item/ItemStack;)Z
-
getRarity
Returns the rarity of the current Item. Used by golden apples, enchanted items and potions.- Parameters:
stack- The item in an ItemStack form- Returns:
- The rarity of the ItemStack
- See Also:
net.minecraft.item.GoldenAppleItem,PotionItem- Mappings:
Namespace Name Mixin selector official gLzw;g(Lzx;)Laaj;intermediary method_8290Lnet/minecraft/class_2054;method_8290(Lnet/minecraft/class_2056;)Lnet/minecraft/class_12;named getRarityLnet/minecraft/item/Item;getRarity(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/util/Rarity;
-
isEnchantable
Returns whether the current item can have enchantments. It does this by verifying that the item's maximum stack size is 1 and the item can break.- Mappings:
Namespace Name Mixin selector official f_Lzw;f_(Lzx;)Zintermediary method_8289Lnet/minecraft/class_2054;method_8289(Lnet/minecraft/class_2056;)Znamed isEnchantableLnet/minecraft/item/Item;isEnchantable(Lnet/minecraft/item/ItemStack;)Z
-
onHit
Returns the HitResult for an item when the player's arm is swung while holding the item.- Parameters:
world- The world that the item is inplayer- The player holding the item- Returns:
- HitResult
- Mappings:
Namespace Name Mixin selector official aLzw;a(Ladm;Lwn;Z)Lauh;intermediary method_8250Lnet/minecraft/class_2054;method_8250(Lnet/minecraft/class_99;Lnet/minecraft/class_1963;Z)Lnet/minecraft/class_647;named onHitLnet/minecraft/item/Item;onHit(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Z)Lnet/minecraft/util/hit/HitResult;
-
getEnchantability
public int getEnchantability()Returns the enchantability of an Item. Used by tools and armor -
appendItemStacks
@Environment(CLIENT) public void appendItemStacks(Item item, ItemGroup group, List<ItemStack> list)Registers an item's sub items- Parameters:
item- The Item instancegroup- The ItemGrouplist- The list of sub items- Mappings:
Namespace Name Mixin selector official aLzw;a(Lzw;Lyz;Ljava/util/List;)Vintermediary method_8255Lnet/minecraft/class_2054;method_8255(Lnet/minecraft/class_2054;Lnet/minecraft/class_2029;Ljava/util/List;)Vnamed appendItemStacksLnet/minecraft/item/Item;appendItemStacks(Lnet/minecraft/item/Item;Lnet/minecraft/item/ItemGroup;Ljava/util/List;)V
-
getItemGroup
Returns the itemgroup that the item is in- Mappings:
Namespace Name Mixin selector official cLzw;c()Lyz;intermediary method_8274Lnet/minecraft/class_2054;method_8274()Lnet/minecraft/class_2029;named getItemGroupLnet/minecraft/item/Item;getItemGroup()Lnet/minecraft/item/ItemGroup;
-
setItemGroup
Sets the itemgroup that the current item should be in- Parameters:
group- The ItemGroup- Returns:
- The current Item
- Mappings:
Namespace Name Mixin selector official aLzw;a(Lyz;)Lzw;intermediary method_8254Lnet/minecraft/class_2054;method_8254(Lnet/minecraft/class_2029;)Lnet/minecraft/class_2054;named setItemGroupLnet/minecraft/item/Item;setItemGroup(Lnet/minecraft/item/ItemGroup;)Lnet/minecraft/item/Item;
-
hasSubTypes
public boolean hasSubTypes()- Mappings:
Namespace Name Mixin selector official sLzw;s()Zintermediary method_8303Lnet/minecraft/class_2054;method_8303()Znamed hasSubTypesLnet/minecraft/item/Item;hasSubTypes()Z
-
canRepair
Returns whether the item can be repaired via an anvil or crafting table.- Mappings:
Namespace Name Mixin selector official aLzw;a(Lzx;Lzx;)Zintermediary method_8267Lnet/minecraft/class_2054;method_8267(Lnet/minecraft/class_2056;Lnet/minecraft/class_2056;)Znamed canRepairLnet/minecraft/item/Item;canRepair(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)Z
-
getAttributeModifierMap
Returns a map containing entity attributes that are modified by the item- Mappings:
Namespace Name Mixin selector official iLzw;i()Lcom/google/common/collect/Multimap;intermediary method_8291Lnet/minecraft/class_2054;method_8291()Lcom/google/common/collect/Multimap;named getAttributeModifierMapLnet/minecraft/item/Item;getAttributeModifierMap()Lcom/google/common/collect/Multimap;
-
setup
public static void setup()This is the main method in the Item class. Both Items and BlockItems get registered here. The Item Ids starts from 256. The fields in the class Items can not be accessed before this method is called.- See Also:
net.minecarft.item.Items- Mappings:
Namespace Name Mixin selector official tLzw;t()Vintermediary method_8304Lnet/minecraft/class_2054;method_8304()Vnamed setupLnet/minecraft/item/Item;setup()V
-
registerBlockItem
Overloaded method that registers a BlockItem to the registry- Parameters:
block- The block- Mappings:
Namespace Name Mixin selector official cLzw;c(Lafh;)Vintermediary method_8276Lnet/minecraft/class_2054;method_8276(Lnet/minecraft/class_160;)Vnamed registerBlockItemLnet/minecraft/item/Item;registerBlockItem(Lnet/minecraft/block/Block;)V
-
registerBlockItem
Registers a BlockItem to the registry- Parameters:
block- The BlockblockItem- The BlockItem- Mappings:
Namespace Name Mixin selector official aLzw;a(Lafh;Lzw;)Vintermediary method_8252Lnet/minecraft/class_2054;method_8252(Lnet/minecraft/class_160;Lnet/minecraft/class_2054;)Vnamed registerBlockItemLnet/minecraft/item/Item;registerBlockItem(Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)V
-
register
Overloaded method that registers an Item to the registry- Parameters:
id- The Item Idname- The Item's nameitem- The item to be registered- Mappings:
Namespace Name Mixin selector official aLzw;a(ILjava/lang/String;Lzw;)Vintermediary method_8248Lnet/minecraft/class_2054;method_8248(ILjava/lang/String;Lnet/minecraft/class_2054;)Vnamed registerLnet/minecraft/item/Item;register(ILjava/lang/String;Lnet/minecraft/item/Item;)V
-
register
Registers an item to the registry- Parameters:
id- The Item Idname- The Item's identifieritem- The Item to be registered- Mappings:
Namespace Name Mixin selector official aLzw;a(ILjy;Lzw;)Vintermediary method_8249Lnet/minecraft/class_2054;method_8249(ILnet/minecraft/class_1605;Lnet/minecraft/class_2054;)Vnamed registerLnet/minecraft/item/Item;register(ILnet/minecraft/util/Identifier;Lnet/minecraft/item/Item;)V
-