public class Item extends ForgeRegistryEntry<Item> implements IItemProvider, IForgeItem
修飾子とタイプ | クラスと説明 |
---|---|
static class |
Item.Properties |
修飾子とタイプ | フィールドと説明 |
---|---|
protected static java.util.UUID |
ATTACK_DAMAGE_MODIFIER |
protected static java.util.UUID |
ATTACK_SPEED_MODIFIER |
static java.util.Map<Block,Item> |
BLOCK_TO_ITEM |
protected boolean |
canRepair |
protected ItemGroup |
group |
java.util.Map<ResourceLocation,IItemPropertyGetter> |
properties |
protected static java.util.Random |
random |
delegate
コンストラクタと説明 |
---|
Item(Item.Properties properties) |
修飾子とタイプ | メソッドと説明 |
---|---|
void |
addInformation(ItemStack stack,
World worldIn,
java.util.List<ITextComponent> tooltip,
ITooltipFlag flagIn)
allows items to add custom lines of information to the mouseover description
|
void |
addPropertyOverride(ResourceLocation key,
IItemPropertyGetter getter)
Creates a new override param for item models.
|
Item |
asItem() |
boolean |
canHarvestBlock(BlockState blockIn)
Check whether this Item can harvest the given Block
|
boolean |
canPlayerBreakBlockWhileHolding(BlockState state,
World worldIn,
BlockPos pos,
PlayerEntity player) |
void |
fillItemGroup(ItemGroup group,
NonNullList<ItemStack> items)
returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
void |
func_219972_a(World worldIn,
LivingEntity livingEntityIn,
ItemStack stack,
int count) |
SoundEvent |
func_225519_S__() |
SoundEvent |
func_225520_U__() |
com.google.common.collect.Multimap<java.lang.String,AttributeModifier> |
getAttributeModifiers(EquipmentSlotType equipmentSlot)
非推奨です。
|
Item |
getContainerItem()
非推奨です。
|
ItemStack |
getDefaultInstance() |
protected java.lang.String |
getDefaultTranslationKey() |
float |
getDestroySpeed(ItemStack stack,
BlockState state) |
ITextComponent |
getDisplayName(ItemStack stack) |
Food |
getFood() |
ItemGroup |
getGroup()
gets the CreativeTab this item is displayed on
|
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 type
|
static int |
getIdFromItem(Item itemIn) |
boolean |
getIsRepairable(ItemStack toRepair,
ItemStack repair)
Return whether this item is repairable in an anvil.
|
static Item |
getItemById(int id) |
int |
getItemEnchantability()
Return the enchantability factor of the item, most of the time is based on material.
|
static Item |
getItemFromBlock(Block blockIn)
非推奨です。
|
ItemStackTileEntityRenderer |
getItemStackTileEntityRenderer() |
int |
getMaxDamage()
非推奨です。
|
int |
getMaxStackSize()
非推奨です。
|
ITextComponent |
getName() |
IItemPropertyGetter |
getPropertyGetter(ResourceLocation key) |
Rarity |
getRarity(ItemStack stack)
Return an item rarity from EnumRarity
|
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) |
java.lang.String |
getTranslationKey()
Returns the unlocalized name of this item.
|
java.lang.String |
getTranslationKey(ItemStack stack)
Returns the unlocalized name of this item.
|
UseAction |
getUseAction(ItemStack stack)
returns the action that specifies what animation to play when the items is being used
|
int |
getUseDuration(ItemStack stack)
How long it takes to use or consume an item
|
boolean |
hasContainerItem()
非推奨です。
|
boolean |
hasCustomProperties() |
boolean |
hasEffect(ItemStack stack)
Returns true if this item has an enchantment glint.
|
boolean |
hitEntity(ItemStack stack,
LivingEntity target,
LivingEntity attacker)
Current implementations of this method in child classes do not use the entry argument beside ev.
|
void |
inventoryTick(ItemStack stack,
World worldIn,
Entity entityIn,
int itemSlot,
boolean isSelected)
Called each tick as long the item is on a player inventory.
|
boolean |
isComplex()
Returns
true if this is a complex item. |
boolean |
isCrossbow(ItemStack stack)
If this itemstack's item is a crossbow
|
boolean |
isDamageable() |
boolean |
isEnchantable(ItemStack stack)
Checks isDamagable and if it cannot be stacked
|
boolean |
isFood() |
boolean |
isIn(Tag<Item> tagIn) |
protected boolean |
isInGroup(ItemGroup group) |
boolean |
isRepairable(ItemStack stack)
Called by CraftingManager to determine if an item is reparable.
|
boolean |
itemInteractionForEntity(ItemStack stack,
PlayerEntity playerIn,
LivingEntity target,
Hand hand)
Returns true if the item can be used on the given entity, e.g. shears on sheep.
|
boolean |
onBlockDestroyed(ItemStack stack,
World worldIn,
BlockState state,
BlockPos pos,
LivingEntity entityLiving)
Called when a Block is destroyed using this Item.
|
void |
onCreated(ItemStack stack,
World worldIn,
PlayerEntity playerIn)
Called when item is crafted/smelted.
|
ActionResult<ItemStack> |
onItemRightClick(World worldIn,
PlayerEntity playerIn,
Hand handIn)
Called to trigger the item's "innate" right click behavior.
|
ActionResultType |
onItemUse(ItemUseContext context)
Called when this item is used when targetting a Block
|
ItemStack |
onItemUseFinish(ItemStack stack,
World worldIn,
LivingEntity entityLiving)
Called when the player finishes using this Item (E.g. finishes eating.).
|
void |
onPlayerStoppedUsing(ItemStack stack,
World worldIn,
LivingEntity entityLiving,
int timeLeft)
Called when the player stops using an Item (stops holding the right mouse button).
|
protected static RayTraceResult |
rayTrace(World worldIn,
PlayerEntity player,
RayTraceContext.FluidMode fluidMode) |
boolean |
shouldSyncTag()
If this function returns true (or the item is damageable), the ItemStack's NBT tag will be sent to the client.
|
java.lang.String |
toString() |
boolean |
updateItemStackNBT(CompoundNBT nbt)
Called when an ItemStack with NBT data is read to potentially that ItemStack's NBT data
|
getRegistryName, getRegistryType, setRegistryName, setRegistryName, setRegistryName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
canApplyAtEnchantingTable, canContinueUsing, canDisableShield, canEquip, canHarvestBlock, createEntity, damageItem, doesSneakBypassUse, getAnimationParameters, getArmorModel, getArmorTexture, getAttributeModifiers, getBurnTime, getContainerItem, getCreativeTabs, getCreatorModId, getDamage, getDurabilityForDisplay, getEntityLifespan, getEquipmentSlot, getFontRenderer, getHighlightTip, getItem, getItemEnchantability, getItemStackLimit, getMaxDamage, getRGBDurabilityForDisplay, getShareTag, getSmeltingExperience, getXpRepairRatio, hasContainerItem, hasCustomEntity, initCapabilities, isBeaconPayment, isBookEnchantable, isDamaged, isShield, onArmorTick, onBlockStartBreak, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onItemUseFirst, onLeftClickEntity, onUsingTick, readShareTag, renderHelmetOverlay, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation, showDurabilityBar
protected static final java.util.UUID ATTACK_DAMAGE_MODIFIER
protected static final java.util.UUID ATTACK_SPEED_MODIFIER
protected static final java.util.Random random
public final java.util.Map<ResourceLocation,IItemPropertyGetter> properties
protected final ItemGroup group
protected final boolean canRepair
public Item(Item.Properties properties)
public static int getIdFromItem(Item itemIn)
public static Item getItemById(int id)
public void func_219972_a(World worldIn, LivingEntity livingEntityIn, ItemStack stack, int count)
@Nullable public IItemPropertyGetter getPropertyGetter(ResourceLocation key)
public boolean hasCustomProperties()
public boolean updateItemStackNBT(CompoundNBT nbt)
public boolean canPlayerBreakBlockWhileHolding(BlockState state, World worldIn, BlockPos pos, PlayerEntity player)
public Item asItem()
asItem
インタフェース内 IItemProvider
public final void addPropertyOverride(ResourceLocation key, IItemPropertyGetter getter)
public ActionResultType onItemUse(ItemUseContext context)
public float getDestroySpeed(ItemStack stack, BlockState state)
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn)
onItemUse(net.minecraft.item.ItemUseContext)
.public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving)
@Deprecated public final int getMaxStackSize()
@Deprecated public final int getMaxDamage()
public boolean isDamageable()
public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker)
public boolean onBlockDestroyed(ItemStack stack, World worldIn, BlockState state, BlockPos pos, LivingEntity entityLiving)
public boolean canHarvestBlock(BlockState blockIn)
public boolean itemInteractionForEntity(ItemStack stack, PlayerEntity playerIn, LivingEntity target, Hand hand)
public ITextComponent getName()
public java.lang.String toString()
toString
クラス内 java.lang.Object
protected java.lang.String getDefaultTranslationKey()
public java.lang.String getTranslationKey()
public java.lang.String getTranslationKey(ItemStack stack)
public boolean shouldSyncTag()
@Nullable @Deprecated public final Item getContainerItem()
@Deprecated public boolean hasContainerItem()
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
public void onCreated(ItemStack stack, World worldIn, PlayerEntity playerIn)
public boolean isComplex()
true
if this is a complex item.public UseAction getUseAction(ItemStack stack)
public int getUseDuration(ItemStack stack)
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, LivingEntity entityLiving, int timeLeft)
public void addInformation(ItemStack stack, @Nullable World worldIn, java.util.List<ITextComponent> tooltip, ITooltipFlag flagIn)
public ITextComponent getDisplayName(ItemStack stack)
public boolean hasEffect(ItemStack stack)
stack.isItemEnchanted()
,
but other items can override it (for instance, written books always return true).
Note that if you override this method, you generally want to also call the super version (on Item
) to get
the glint for enchanted items. Of course, that is unnecessary if the overwritten version always returns true.public boolean isEnchantable(ItemStack stack)
protected static RayTraceResult rayTrace(World worldIn, PlayerEntity player, RayTraceContext.FluidMode fluidMode)
public int getItemEnchantability()
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items)
protected boolean isInGroup(ItemGroup group)
@Nullable public final ItemGroup getGroup()
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
@Deprecated public com.google.common.collect.Multimap<java.lang.String,AttributeModifier> getAttributeModifiers(EquipmentSlotType equipmentSlot)
public boolean isRepairable(ItemStack stack)
IForgeItem
isRepairable
インタフェース内 IForgeItem
public java.util.Set<ToolType> getToolTypes(ItemStack stack)
getToolTypes
インタフェース内 IForgeItem
public int getHarvestLevel(ItemStack stack, ToolType tool, @Nullable PlayerEntity player, @Nullable BlockState blockState)
IForgeItem
getHarvestLevel
インタフェース内 IForgeItem
stack
- This item stack instanceplayer
- The player trying to harvest the given blockstateblockState
- The block to harvestpublic final ItemStackTileEntityRenderer getItemStackTileEntityRenderer()
getItemStackTileEntityRenderer
インタフェース内 IForgeItem
public java.util.Set<ResourceLocation> getTags()
IForgeItem
getTags
インタフェース内 IForgeItem
public boolean isCrossbow(ItemStack stack)
public ItemStack getDefaultInstance()
public boolean isFood()
@Nullable public Food getFood()
public SoundEvent func_225520_U__()
public SoundEvent func_225519_S__()