Package net.minecraft.item
Class Item
- java.lang.Object
-
- net.minecraftforge.registries.ForgeRegistryEntry<Item>
-
- net.minecraft.item.Item
-
- All Implemented Interfaces:
IItemProvider
,IForgeItem
,IForgeRegistryEntry<Item>
- Direct Known Subclasses:
AbstractMapItem
,AirItem
,ArmorItem
,ArmorStandItem
,ArrowItem
,BannerPatternItem
,BlockItem
,BoatItem
,BoneMealItem
,BookItem
,BucketItem
,ChorusFruitItem
,CompassItem
,CustomElytraTest.CustomElytra
,DebugStickItem
,DyeItem
,EggItem
,ElytraItem
,EnchantedBookItem
,EnchantedGoldenAppleItem
,EnderCrystalItem
,EnderEyeItem
,EnderPearlItem
,ExperienceBottleItem
,FireChargeItem
,FireworkRocketItem
,FireworkStarItem
,FishingRodItem
,FlintAndSteelItem
,GlassBottleItem
,GravityAttributeTest.ItemGravityStick
,HangingEntityItem
,HoneyBottleItem
,HorseArmorItem
,ItemFluidContainer
,KnowledgeBookItem
,LeadItem
,MilkBucketItem
,MinecartItem
,MusicDiscItem
,NameTagItem
,OnAStickItem
,PotionItem
,SaddleItem
,ShearsItem
,ShieldItem
,ShootableItem
,SimpleFoiledItem
,SnowballItem
,SoupItem
,SpawnEggItem
,SuspiciousStewItem
,TieredItem
,TridentItem
,WritableBookItem
,WrittenBookItem
public class Item extends ForgeRegistryEntry<Item> implements IItemProvider, IForgeItem
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Item.Properties
-
Nested classes/interfaces inherited from class net.minecraftforge.registries.ForgeRegistryEntry
ForgeRegistryEntry.UncheckedRegistryEntry<V extends IForgeRegistryEntry<V>>
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.UUID
BASE_ATTACK_DAMAGE_UUID
protected static java.util.UUID
BASE_ATTACK_SPEED_UUID
static java.util.Map<Block,Item>
BY_BLOCK
protected boolean
canRepair
protected ItemGroup
category
private Item
craftingRemainingItem
private java.lang.String
descriptionId
private Food
foodProperties
private boolean
isFireResistant
private java.util.function.Supplier<ItemStackTileEntityRenderer>
ister
private int
maxDamage
private int
maxStackSize
protected static java.util.Random
random
private Rarity
rarity
private ReverseTagWrapper<Item>
reverseTags
private java.util.Map<ToolType,java.lang.Integer>
toolClasses
-
Fields inherited from class net.minecraftforge.registries.ForgeRegistryEntry
delegate
-
-
Constructor Summary
Constructors Constructor Description Item(Item.Properties p_i48487_1_)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected boolean
allowdedIn(ItemGroup p_194125_1_)
void
appendHoverText(ItemStack p_77624_1_, World p_77624_2_, java.util.List<ITextComponent> p_77624_3_, ITooltipFlag p_77624_4_)
Item
asItem()
static Item
byBlock(Block p_150898_0_)
Deprecated.static Item
byId(int p_150899_0_)
boolean
canAttackBlock(BlockState p_195938_1_, World p_195938_2_, BlockPos p_195938_3_, PlayerEntity p_195938_4_)
boolean
canBeDepleted()
boolean
canBeHurtBy(DamageSource p_234685_1_)
void
fillItemCategory(ItemGroup p_150895_1_, NonNullList<ItemStack> p_150895_2_)
ItemStack
finishUsingItem(ItemStack p_77654_1_, World p_77654_2_, LivingEntity p_77654_3_)
Item
getCraftingRemainingItem()
Deprecated.com.google.common.collect.Multimap<Attribute,AttributeModifier>
getDefaultAttributeModifiers(EquipmentSlotType p_111205_1_)
Deprecated.ItemStack
getDefaultInstance()
ITextComponent
getDescription()
java.lang.String
getDescriptionId()
java.lang.String
getDescriptionId(ItemStack p_77667_1_)
float
getDestroySpeed(ItemStack p_150893_1_, BlockState p_150893_2_)
SoundEvent
getDrinkingSound()
SoundEvent
getEatingSound()
int
getEnchantmentValue()
Food
getFoodProperties()
int
getHarvestLevel(ItemStack stack, ToolType tool, PlayerEntity player, BlockState blockState)
Queries the harvest level of this item stack for the specified tool class, Returns -1 if this tool is not of the specified typestatic int
getId(Item p_150891_0_)
ItemGroup
getItemCategory()
ItemStackTileEntityRenderer
getItemStackTileEntityRenderer()
int
getMaxDamage()
Deprecated.int
getMaxStackSize()
Deprecated.ITextComponent
getName(ItemStack p_200295_1_)
protected java.lang.String
getOrCreateDescriptionId()
protected static BlockRayTraceResult
getPlayerPOVHitResult(World p_219968_0_, PlayerEntity p_219968_1_, RayTraceContext.FluidMode p_219968_2_)
Rarity
getRarity(ItemStack p_77613_1_)
java.util.Set<ResourceLocation>
getTags()
Retrieves a list of tags names this is known to be associated with.java.util.Set<ToolType>
getToolTypes(ItemStack stack)
UseAction
getUseAnimation(ItemStack p_77661_1_)
int
getUseDuration(ItemStack p_77626_1_)
boolean
hasCraftingRemainingItem()
Deprecated.boolean
hurtEnemy(ItemStack p_77644_1_, LivingEntity p_77644_2_, LivingEntity p_77644_3_)
ActionResultType
interactLivingEntity(ItemStack p_111207_1_, PlayerEntity p_111207_2_, LivingEntity p_111207_3_, Hand p_111207_4_)
void
inventoryTick(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_)
boolean
is(ITag<Item> p_206844_1_)
boolean
isComplex()
boolean
isCorrectToolForDrops(BlockState p_150897_1_)
boolean
isEdible()
boolean
isEnchantable(ItemStack p_77616_1_)
boolean
isFireResistant()
boolean
isFoil(ItemStack p_77636_1_)
boolean
isRepairable(ItemStack stack)
Called by CraftingManager to determine if an item is reparable.boolean
isValidRepairItem(ItemStack p_82789_1_, ItemStack p_82789_2_)
boolean
mineBlock(ItemStack p_179218_1_, World p_179218_2_, BlockState p_179218_3_, BlockPos p_179218_4_, LivingEntity p_179218_5_)
void
onCraftedBy(ItemStack p_77622_1_, World p_77622_2_, PlayerEntity p_77622_3_)
void
onUseTick(World p_219972_1_, LivingEntity p_219972_2_, ItemStack p_219972_3_, int p_219972_4_)
void
releaseUsing(ItemStack p_77615_1_, World p_77615_2_, LivingEntity p_77615_3_, int p_77615_4_)
boolean
shouldOverrideMultiplayerNbt()
java.lang.String
toString()
ActionResult<ItemStack>
use(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_)
ActionResultType
useOn(ItemUseContext p_195939_1_)
boolean
useOnRelease(ItemStack p_219970_1_)
boolean
verifyTagAfterLoad(CompoundNBT p_179215_1_)
-
Methods inherited from class net.minecraftforge.registries.ForgeRegistryEntry
getRegistryName, getRegistryType, setRegistryName, setRegistryName, setRegistryName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.minecraftforge.common.extensions.IForgeItem
canApplyAtEnchantingTable, canContinueUsing, canDisableShield, canElytraFly, canEquip, canHarvestBlock, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getArmorModel, getArmorTexture, getAttributeModifiers, getBurnTime, getBurnTime, getContainerItem, getCreativeTabs, getCreatorModId, getDamage, getDurabilityForDisplay, getEntityLifespan, getEquipmentSlot, getFontRenderer, getHighlightTip, getItem, getItemEnchantability, getItemStackLimit, getMaxDamage, getRGBDurabilityForDisplay, getShareTag, getSmeltingExperience, getXpRepairRatio, hasContainerItem, hasCustomEntity, initCapabilities, isBookEnchantable, isDamageable, isDamaged, isEnderMask, isPiglinCurrency, isShield, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onItemUseFirst, onLeftClickEntity, onUsingTick, readShareTag, renderHelmetOverlay, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation, showDurabilityBar
-
-
-
-
Field Detail
-
BASE_ATTACK_DAMAGE_UUID
protected static final java.util.UUID BASE_ATTACK_DAMAGE_UUID
-
BASE_ATTACK_SPEED_UUID
protected static final java.util.UUID BASE_ATTACK_SPEED_UUID
-
random
protected static final java.util.Random random
-
category
protected final ItemGroup category
-
rarity
private final Rarity rarity
-
maxStackSize
private final int maxStackSize
-
maxDamage
private final int maxDamage
-
isFireResistant
private final boolean isFireResistant
-
craftingRemainingItem
private final Item craftingRemainingItem
-
descriptionId
@Nullable private java.lang.String descriptionId
-
foodProperties
@Nullable private final Food foodProperties
-
ister
@Nullable private final java.util.function.Supplier<ItemStackTileEntityRenderer> ister
-
toolClasses
private final java.util.Map<ToolType,java.lang.Integer> toolClasses
-
reverseTags
private final ReverseTagWrapper<Item> reverseTags
-
canRepair
protected final boolean canRepair
-
-
Constructor Detail
-
Item
public Item(Item.Properties p_i48487_1_)
-
-
Method Detail
-
getId
public static int getId(Item p_150891_0_)
-
byId
public static Item byId(int p_150899_0_)
-
onUseTick
public void onUseTick(World p_219972_1_, LivingEntity p_219972_2_, ItemStack p_219972_3_, int p_219972_4_)
-
verifyTagAfterLoad
public boolean verifyTagAfterLoad(CompoundNBT p_179215_1_)
-
canAttackBlock
public boolean canAttackBlock(BlockState p_195938_1_, World p_195938_2_, BlockPos p_195938_3_, PlayerEntity p_195938_4_)
-
asItem
public Item asItem()
- Specified by:
asItem
in interfaceIItemProvider
-
useOn
public ActionResultType useOn(ItemUseContext p_195939_1_)
-
getDestroySpeed
public float getDestroySpeed(ItemStack p_150893_1_, BlockState p_150893_2_)
-
use
public ActionResult<ItemStack> use(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_)
-
finishUsingItem
public ItemStack finishUsingItem(ItemStack p_77654_1_, World p_77654_2_, LivingEntity p_77654_3_)
-
getMaxStackSize
@Deprecated public final int getMaxStackSize()
Deprecated.
-
getMaxDamage
@Deprecated public final int getMaxDamage()
Deprecated.
-
canBeDepleted
public boolean canBeDepleted()
-
hurtEnemy
public boolean hurtEnemy(ItemStack p_77644_1_, LivingEntity p_77644_2_, LivingEntity p_77644_3_)
-
mineBlock
public boolean mineBlock(ItemStack p_179218_1_, World p_179218_2_, BlockState p_179218_3_, BlockPos p_179218_4_, LivingEntity p_179218_5_)
-
isCorrectToolForDrops
public boolean isCorrectToolForDrops(BlockState p_150897_1_)
-
interactLivingEntity
public ActionResultType interactLivingEntity(ItemStack p_111207_1_, PlayerEntity p_111207_2_, LivingEntity p_111207_3_, Hand p_111207_4_)
-
getDescription
public ITextComponent getDescription()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getOrCreateDescriptionId
protected java.lang.String getOrCreateDescriptionId()
-
getDescriptionId
public java.lang.String getDescriptionId()
-
getDescriptionId
public java.lang.String getDescriptionId(ItemStack p_77667_1_)
-
shouldOverrideMultiplayerNbt
public boolean shouldOverrideMultiplayerNbt()
-
getCraftingRemainingItem
@Nullable @Deprecated public final Item getCraftingRemainingItem()
Deprecated.
-
hasCraftingRemainingItem
@Deprecated public boolean hasCraftingRemainingItem()
Deprecated.
-
inventoryTick
public void inventoryTick(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_)
-
onCraftedBy
public void onCraftedBy(ItemStack p_77622_1_, World p_77622_2_, PlayerEntity p_77622_3_)
-
isComplex
public boolean isComplex()
-
getUseDuration
public int getUseDuration(ItemStack p_77626_1_)
-
releaseUsing
public void releaseUsing(ItemStack p_77615_1_, World p_77615_2_, LivingEntity p_77615_3_, int p_77615_4_)
-
appendHoverText
public void appendHoverText(ItemStack p_77624_1_, @Nullable World p_77624_2_, java.util.List<ITextComponent> p_77624_3_, ITooltipFlag p_77624_4_)
-
getName
public ITextComponent getName(ItemStack p_200295_1_)
-
isFoil
public boolean isFoil(ItemStack p_77636_1_)
-
isEnchantable
public boolean isEnchantable(ItemStack p_77616_1_)
-
getPlayerPOVHitResult
protected static BlockRayTraceResult getPlayerPOVHitResult(World p_219968_0_, PlayerEntity p_219968_1_, RayTraceContext.FluidMode p_219968_2_)
-
getEnchantmentValue
public int getEnchantmentValue()
-
fillItemCategory
public void fillItemCategory(ItemGroup p_150895_1_, NonNullList<ItemStack> p_150895_2_)
-
allowdedIn
protected boolean allowdedIn(ItemGroup p_194125_1_)
-
getItemCategory
@Nullable public final ItemGroup getItemCategory()
-
getDefaultAttributeModifiers
@Deprecated public com.google.common.collect.Multimap<Attribute,AttributeModifier> getDefaultAttributeModifiers(EquipmentSlotType p_111205_1_)
Deprecated.
-
isRepairable
public boolean isRepairable(ItemStack stack)
Description copied from interface:IForgeItem
Called by CraftingManager to determine if an item is reparable.- Specified by:
isRepairable
in interfaceIForgeItem
- Returns:
- True if reparable
-
getToolTypes
public java.util.Set<ToolType> getToolTypes(ItemStack stack)
- Specified by:
getToolTypes
in interfaceIForgeItem
-
getHarvestLevel
public int getHarvestLevel(ItemStack stack, ToolType tool, @Nullable PlayerEntity player, @Nullable BlockState blockState)
Description copied from interface:IForgeItem
Queries the harvest level of this item stack for the specified tool class, Returns -1 if this tool is not of the specified type- Specified by:
getHarvestLevel
in interfaceIForgeItem
- Parameters:
stack
- This item stack instanceplayer
- The player trying to harvest the given blockstateblockState
- The block to harvest- Returns:
- Harvest level, or -1 if not the specified tool type.
-
getItemStackTileEntityRenderer
public final ItemStackTileEntityRenderer getItemStackTileEntityRenderer()
- Specified by:
getItemStackTileEntityRenderer
in interfaceIForgeItem
- Returns:
- This Item's renderer, or the default instance if it does not have one.
-
getTags
public java.util.Set<ResourceLocation> getTags()
Description copied from interface:IForgeItem
Retrieves a list of tags names this is known to be associated with. This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes.- Specified by:
getTags
in interfaceIForgeItem
-
useOnRelease
public boolean useOnRelease(ItemStack p_219970_1_)
-
getDefaultInstance
public ItemStack getDefaultInstance()
-
isEdible
public boolean isEdible()
-
getFoodProperties
@Nullable public Food getFoodProperties()
-
getDrinkingSound
public SoundEvent getDrinkingSound()
-
getEatingSound
public SoundEvent getEatingSound()
-
isFireResistant
public boolean isFireResistant()
-
canBeHurtBy
public boolean canBeHurtBy(DamageSource p_234685_1_)
-
-