Interface IItemStack
- All Superinterfaces:
CommandStringDisplayable,ComponentAccess<IItemStack>,net.minecraft.core.component.DataComponentHolder,IIngredient,IIngredientWithAmount
@ZenRegister
public interface IItemStack
extends IIngredient, IIngredientWithAmount, net.minecraft.core.component.DataComponentHolder, ComponentAccess<IItemStack>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceLocationstatic final com.mojang.serialization.Codec<IItemStack> static final Stringstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, IItemStack> -
Method Summary
Modifier and TypeMethodDescriptiondefault <U> U_get(net.minecraft.core.component.DataComponentType<? extends U> componentType) default <U> boolean_has(net.minecraft.core.component.DataComponentType<U> componentType) default <U> IItemStack_with(net.minecraft.core.component.DataComponentType<U> componentType, U value) default <U> IItemStack_without(net.minecraft.core.component.DataComponentType<U> componentType) default intamount()Gets the amount of Items in the ItemStackdefault IItemStackapplyComponents(net.minecraft.core.component.DataComponentMap map) default IItemStackapplyComponents(net.minecraft.core.component.DataComponentPatch patch) default IItemStackapplyComponentsAndValidate(net.minecraft.core.component.DataComponentPatch patch) default IDataasIData()default IIngredientWithAmountUsed implicitly when a machine can accept more than one item but you only provide one.default net.minecraft.world.level.ItemLikedefault net.minecraft.world.item.crafting.IngredientCreate a Vanilla ingredient matching this one.default Percentaged<IItemStack> default IIngredientcondition(IIngredientCondition condition) Use this if you already have the condition from another ingredientcopy()Creates a copystatic IItemStackempty()default <T> Tget(@NotNull net.minecraft.core.component.DataComponentType<? extends T> type) default Map<net.minecraft.world.entity.ai.attributes.Attribute, List<net.minecraft.world.entity.ai.attributes.AttributeModifier>> getAttributes(net.minecraft.world.entity.EquipmentSlot slotType) Gets the Attributes and the AttributeModifiers on this IItemStack for the given EquipmentSlotdefault intdefault StringReturns the BEP to get this stackdefault @NotNull net.minecraft.core.component.DataComponentMapdefault net.minecraft.core.component.DataComponentPatchdefault net.minecraft.world.item.Itemdefault StringReturns the unlocalized Name of the Item in the ItemStackdefault net.minecraft.network.chat.ComponentGets the display name of the ItemStackdefault net.minecraft.network.chat.ComponentGets the hover name of the ItemStack.default net.minecraft.world.item.ItemStacknet.minecraft.world.item.ItemStackGets the internalItemStackfor this IItemStack.default intReturns the max damage of the ItemStack This is the max durability of the ItemStack.default <T> TgetOrDefault(@NotNull net.minecraft.core.component.DataComponentType<? extends T> type, T value) default StringgetOwner()Gets owning mod for the Item in this IItemStackdefault net.minecraft.world.level.block.entity.DecoratedPotPatterndefault net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.entity.DecoratedPotPattern> default net.minecraft.core.component.DataComponentMapdefault net.minecraft.resources.ResourceLocationGets the registry name for the Item in this IItemStackdefault intgetUseDuration(net.minecraft.world.entity.LivingEntity entity) Gets the use duration of the ItemStack for the given entitydefault IItemStackgrow(int amount) Grows this IItemStack's stack size by the given amount, or 1 if no amount is given.default booleanhas(@NotNull net.minecraft.core.component.DataComponentType<?> type) default booleanhasFoil()Returns true if this ItemStack has a foil effect.default IItemStackThe backing ingredientdefault booleanReturns if the ItemStack is damageable I.E Swords and tools are damageable, sticks are not.default booleanReturns if the ItemStack is damaged I.E a Swords that is no at full durability is damaged.default booleanisEmpty()Returns if the ItemStack is emptydefault booleanCan this ItemStack be enchanted?booleandefault booleandefault booleanReturns if the ItemStack can have an amount greater than 1 I.E Swords and tools are not stackable, sticks are.default booleanmatches(IItemStack stack) Does the given stack match the ingredient?modifyThis(Consumer<IItemStack> modifier) static IItemStackof(net.minecraft.world.item.ItemStack stack) static IItemStackof(net.minecraft.world.item.ItemStack stack, boolean mutable) static IItemStackof(net.minecraft.world.item.ItemStack stack, boolean mutable, IngredientConditions conditions, IngredientTransformers transformers) static IItemStackof(net.minecraft.world.item.ItemStack stack, IngredientConditions conditions, IngredientTransformers transformers) static IItemStackof(net.minecraft.world.level.ItemLike item) static IItemStackofMutable(net.minecraft.world.item.ItemStack stack) static IItemStackofMutable(net.minecraft.world.item.ItemStack stack, IngredientConditions conditions, IngredientTransformers transformers) default Percentaged<IItemStack> percent(double percentage) default <T> IItemStackremove(net.minecraft.core.component.DataComponentType<T> type) default IItemStackshrink(int amount) Shrinks this IItemStack's stack size by the given amount, or 1 if no amount is given.default IIngredienttransform(IIngredientTransformer transformer) default <T> IItemStackupdate(net.minecraft.core.component.DataComponentType<T> type, T defaultValue, UnaryOperator<T> operator) default <T,U> IItemStack update(net.minecraft.core.component.DataComponentType<T> type, T defaultValue, U data, BiFunction<T, U, T> operator) default booleanReturns true if this stack is considered a crossbow itemdefault <T> IItemStackwith(net.minecraft.core.component.DataComponentType<T> type, T value) default IItemStackwithAmount(int amount) Sets the amount of the ItemStackdefault IItemStackwithJsonComponent(net.minecraft.core.component.DataComponentType type, IData value) default IItemStackwithJsonComponents(IData value) default <T> IItemStackwithout(net.minecraft.core.component.DataComponentType<T> type) default IItemStackMethods inherited from interface com.blamejared.crafttweaker.api.component.ComponentAccess
creativeSlotLock, getAttributeModifiers, getBannerPatterns, getBaseColor, getBees, getBlockEntityData, getBlockState, getBucketEntityData, getBundleContents, getCanBreak, getCanPlaceOn, getChargedProjectiles, getContainer, getContainerLoot, getCustomData, getCustomModelData, getCustomName, getDamage, getDebugStickState, getDyedColor, getEnchantmentGlintOverride, getEnchantments, getEntityData, getFireworkExplosion, getFireworks, getFood, getInstrument, getItemName, getLock, getLodestoneTracker, getLore, getMapColor, getMapDecorations, getMapId, getMapPostProcessing, getMaxStackSize, getNoteBlockSound, getOminousBottleAmplifier, getPotDecorations, getPotionContents, getProfile, getRarity, getRecipes, getStoredEnchantments, getSuspiciousStewEffects, getTool, getTrim, getUnbreakable, getWritableBookContent, getWrittenBookContent, hasAttributeModifiers, hasBannerPatterns, hasBaseColor, hasBees, hasBlockEntityData, hasBlockState, hasBucketEntityData, hasBundleContents, hasCanBreak, hasCanPlaceOn, hasChargedProjectiles, hasContainer, hasContainerLoot, hasCustomData, hasCustomModelData, hasCustomName, hasDamage, hasDebugStickState, hasDyedColor, hasEnchantmentGlintOverride, hasEnchantments, hasEntityData, hasFireworkExplosion, hasFireworks, hasFood, hasInstrument, hasItemName, hasLock, hasLodestoneTracker, hasLore, hasMapColor, hasMapDecorations, hasMapId, hasMapPostProcessing, hasMaxDamage, hasMaxStackSize, hasNoteBlockSound, hasOminousBottleAmplifier, hasPotDecorations, hasPotionContents, hasProfile, hasRarity, hasRecipes, hasRepairCost, hasStoredEnchantments, hasSuspiciousStewEffects, hasTool, hasTrim, hasUnbreakable, hasWritableBookContent, hasWrittenBookContent, hideAdditionalTooltip, hideTooltip, isFireResistant, isIntangibleProjectile, repairCost, withAttributeModifiers, withAttributeModifiers, withAttributeModifiers, withBannerPatterns, withBannerPatterns, withBaseColor, withBees, withBlockEntityData, withBlockEntityData, withBlockState, withBucketEntityData, withBucketEntityData, withBundleContents, withBundleContents, withCanBreak, withCanBreak, withCanPlaceOn, withCanPlaceOn, withChargedProjectiles, withChargedProjectiles, withChargedProjectiles, withContainer, withContainer, withContainerLoot, withContainerLoot, withCreativeSlotLock, withCustomData, withCustomData, withCustomModelData, withCustomModelData, withCustomName, withDamage, withDebugStickState, withDyedColor, withDyedColor, withEnchantment, withEnchantmentGlintOverride, withEnchantments, withEntityData, withEntityData, withFireResistant, withFireworkExplosion, withFireworks, withFireworks, withFood, withHideAdditionalTooltip, withHideTooltip, withInstrument, withIntangibleProjectile, withItemName, withLock, withLock, withLodestoneTracker, withLore, withLore, withLore, withMapColor, withMapColor, withMapDecorations, withMapDecorations, withMapId, withMapId, withMapPostProcessing, withMaxDamage, withMaxStackSize, withNoteBlockSound, withOminousBottleAmplifier, withoutAttributeModifiers, withoutBannerPatterns, withoutBaseColor, withoutBees, withoutBlockEntityData, withoutBlockState, withoutBucketEntityData, withoutBundleContents, withoutCanBreak, withoutCanPlaceOn, withoutChargedProjectiles, withoutContainer, withoutContainerLoot, withoutCreativeSlotLock, withoutCustomData, withoutCustomModelData, withoutCustomName, withoutDamage, withoutDebugStickState, withoutDyedColor, withoutEnchantment, withoutEnchantmentGlintOverride, withoutEnchantments, withoutEntityDate, withoutFireResistant, withoutFireworkExplosion, withoutFireworks, withoutFood, withoutHideAdditionalTooltip, withoutHideTooltip, withoutInstrument, withoutIntangibleProjectile, withoutItemName, withoutLock, withoutLodestoneTracker, withoutLore, withoutMapColor, withoutMapDecorations, withoutMapId, withoutMapPostProcessing, withoutMaxDamage, withoutMaxStackSize, withoutNoteBlockSound, withoutOminousBottleAmplifier, withoutPotDecorations, withoutPotionContents, withoutProfile, withoutRarity, withoutRecipes, withoutRepairCost, withoutStoredEnchantments, withoutSuspiciousStewEffects, withoutTool, withoutTrim, withoutUnbreakable, withoutWritableBookContent, withoutWrittenBookContent, withPotDecorations, withPotDecorations, withPotionContents, withPotionContents, withPotionContents, withPotionContents, withProfile, withRarity, withRecipes, withRepairCost, withStoredEnchantments, withSuspiciousStewEffects, withSuspiciousStewEffects, withTool, withTool, withTrim, withUnbreakable, withUnbreakable, withWritableBookContent, withWritableBookContent, withWrittenBookContentMethods inherited from interface com.blamejared.crafttweaker.api.ingredient.IIngredient
addGlobalAttributeModifier, addShiftTooltip, addTooltip, anyDamage, asMapData, clearTooltip, conditions, contains, getItems, getRemainingItem, modifyShiftTooltip, modifyTooltip, mul, onlyDamaged, onlyDamagedAtLeast, onlyDamagedAtMost, onlyIf, or, removeGlobalAttribute, removeGlobalAttributeModifier, removeGlobalAttributeModifier, removeTooltip, reuse, setBurnTime, transformCustom, transformDamage, transformers, transformReplace
-
Field Details
-
INGREDIENT_ID
static final net.minecraft.resources.ResourceLocation INGREDIENT_ID -
CODEC
-
STREAM_CODEC
static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,IItemStack> STREAM_CODEC -
CRAFTTWEAKER_DATA_KEY
- See Also:
-
BASE_ATTACK_DAMAGE_ID
static final net.minecraft.resources.ResourceLocation BASE_ATTACK_DAMAGE_ID -
BASE_ATTACK_SPEED_ID
static final net.minecraft.resources.ResourceLocation BASE_ATTACK_SPEED_ID
-
-
Method Details
-
empty
-
of
-
of
-
of
static IItemStack of(net.minecraft.world.item.ItemStack stack, IngredientConditions conditions, IngredientTransformers transformers) -
of
-
ofMutable
-
ofMutable
static IItemStack ofMutable(net.minecraft.world.item.ItemStack stack, IngredientConditions conditions, IngredientTransformers transformers) -
of
static IItemStack of(net.minecraft.world.item.ItemStack stack, boolean mutable, IngredientConditions conditions, IngredientTransformers transformers) -
copy
IItemStack copy()Creates a copy -
getRegistryName
default net.minecraft.resources.ResourceLocation getRegistryName()Gets the registry name for the Item in this IItemStack- Returns:
- registry name of the Item this IItemStack represents
-
getOwner
Gets owning mod for the Item in this IItemStack- Returns:
- owning mod of the Item this IItemStack represents
-
isEmpty
default boolean isEmpty()Returns if the ItemStack is empty- Specified by:
isEmptyin interfaceIIngredient- Returns:
- true if empty, false if not
-
getPrototype
default net.minecraft.core.component.DataComponentMap getPrototype() -
getComponentsPatch
default net.minecraft.core.component.DataComponentPatch getComponentsPatch() -
with
-
without
-
withoutComponents
-
withJsonComponent
default IItemStack withJsonComponent(net.minecraft.core.component.DataComponentType type, IData value) -
withJsonComponents
-
update
default <T,U> IItemStack update(net.minecraft.core.component.DataComponentType<T> type, T defaultValue, U data, BiFunction<T, U, T> operator) -
update
default <T> IItemStack update(net.minecraft.core.component.DataComponentType<T> type, T defaultValue, UnaryOperator<T> operator) -
remove
-
applyComponents
-
applyComponents
-
applyComponentsAndValidate
default IItemStack applyComponentsAndValidate(net.minecraft.core.component.DataComponentPatch patch) -
getDisplayName
default net.minecraft.network.chat.Component getDisplayName()Gets the display name of the ItemStack- Returns:
- formatted display name of the ItemStack.
-
getHoverName
default net.minecraft.network.chat.Component getHoverName()Gets the hover name of the ItemStack.This will give the raw name without the formatting that 'displayName' applies.
- Returns:
- The hover name of the ItemStack.
-
hasFoil
default boolean hasFoil()Returns true if this ItemStack has a foil effect. Foil is the glint / effect that is added to enchanted ItemStacks (and other items).- Returns:
- true if this ItemStack has a foil effect.
-
isEnchantable
default boolean isEnchantable()Can this ItemStack be enchanted?- Returns:
- true if this ItemStack can be enchanted.
-
amount
default int amount()Gets the amount of Items in the ItemStack- Specified by:
amountin interfaceIIngredientWithAmount- Returns:
- ItemStack's amount
-
withAmount
Sets the amount of the ItemStack- Parameters:
amount- new amount- DocParam:
- amount 3
-
grow
Grows this IItemStack's stack size by the given amount, or 1 if no amount is given.- Parameters:
amount- The amount to grow by.- Returns:
- This IItemStack if mutable, a new one with the new amount otherwise.
- DocParam:
- amount 2
-
shrink
Shrinks this IItemStack's stack size by the given amount, or 1 if no amount is given.- Parameters:
amount- The amount to shrink by.- Returns:
- This IItemStack if mutable, a new one with the new amount otherwise.
- DocParam:
- amount 2
-
isStackable
default boolean isStackable()Returns if the ItemStack can have an amount greater than 1 I.E Swords and tools are not stackable, sticks are.- Returns:
- true if this ItemStack can contain more than one item.
-
getAttributes
default Map<net.minecraft.world.entity.ai.attributes.Attribute,List<net.minecraft.world.entity.ai.attributes.AttributeModifier>> getAttributes(net.minecraft.world.entity.EquipmentSlot slotType) Gets the Attributes and the AttributeModifiers on this IItemStack for the given EquipmentSlot- Parameters:
slotType- The slot to get the Attributes for.- Returns:
- A Map of Attribute to a List of AttributeModifier for the given EquipmentSlot.
- DocParam:
- slotType invalid input: '<'constant:minecraft:equipmentslot:chest>
-
isDamageableItem
default boolean isDamageableItem()Returns if the ItemStack is damageable I.E Swords and tools are damageable, sticks are not.- Returns:
- true if this ItemStack can take damage.
-
isDamaged
default boolean isDamaged()Returns if the ItemStack is damaged I.E a Swords that is no at full durability is damaged.- Returns:
- true if this ItemStack is damaged.
-
getMaxDamage
default int getMaxDamage()Returns the max damage of the ItemStack This is the max durability of the ItemStack.- Specified by:
getMaxDamagein interfaceComponentAccess<IItemStack>- Returns:
- The ItemStack's max durability.
-
getDescriptionId
Returns the unlocalized Name of the Item in the ItemStack- Returns:
- the unlocalized name.
-
matches
Description copied from interface:IIngredientDoes the given stack match the ingredient?- Specified by:
matchesin interfaceIIngredient- Parameters:
stack- The stack to check
-
getCommandString
Description copied from interface:IIngredientReturns the BEP to get this stack- Specified by:
getCommandStringin interfaceCommandStringDisplayable- Specified by:
getCommandStringin interfaceIIngredient
-
getUseDuration
default int getUseDuration(net.minecraft.world.entity.LivingEntity entity) Gets the use duration of the ItemStack for the given entity- Returns:
- use duration
- DocParam:
- entity entity
-
useOnRelease
default boolean useOnRelease()Returns true if this stack is considered a crossbow item- Returns:
- true if stack is a crossbow
-
getBurnTime
default int getBurnTime() -
getPotPatternId
default net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.entity.DecoratedPotPattern> getPotPatternId() -
getPotPattern
default net.minecraft.world.level.block.entity.DecoratedPotPattern getPotPattern() -
percent
-
asWeightedItemStack
-
getDefinition
default net.minecraft.world.item.Item getDefinition() -
asItemLike
default net.minecraft.world.level.ItemLike asItemLike() -
asMutable
IItemStack asMutable() -
asImmutable
IItemStack asImmutable() -
isImmutable
boolean isImmutable() -
isMutable
default boolean isMutable() -
getInternal
net.minecraft.world.item.ItemStack getInternal()Gets the internalItemStackfor this IItemStack.- Returns:
- internal ItemStack
-
asVanillaIngredient
default net.minecraft.world.item.crafting.Ingredient asVanillaIngredient()Description copied from interface:IIngredientCreate a Vanilla ingredient matching this one.- Specified by:
asVanillaIngredientin interfaceIIngredient
-
getImmutableInternal
default net.minecraft.world.item.ItemStack getImmutableInternal() -
asIIngredientWithAmount
Description copied from interface:IIngredientUsed implicitly when a machine can accept more than one item but you only provide one.- Specified by:
asIIngredientWithAmountin interfaceIIngredient
-
ingredient
Description copied from interface:IIngredientWithAmountThe backing ingredient- Specified by:
ingredientin interfaceIIngredientWithAmount
-
asIData
- Specified by:
asIDatain interfaceIIngredient- Specified by:
asIDatain interfaceIIngredientWithAmount
-
transform
- Specified by:
transformin interfaceIIngredient
-
condition
Description copied from interface:IIngredientUse this if you already have the condition from another ingredient- Specified by:
conditionin interfaceIIngredient
-
modify
-
modifyThis
-
getComponents
@NotNull default @NotNull net.minecraft.core.component.DataComponentMap getComponents()- Specified by:
getComponentsin interfacenet.minecraft.core.component.DataComponentHolder
-
get
default <T> T get(@NotNull @NotNull net.minecraft.core.component.DataComponentType<? extends T> type) - Specified by:
getin interfacenet.minecraft.core.component.DataComponentHolder
-
getOrDefault
@NotNull default <T> T getOrDefault(@NotNull @NotNull net.minecraft.core.component.DataComponentType<? extends T> type, @NotNull T value) - Specified by:
getOrDefaultin interfacenet.minecraft.core.component.DataComponentHolder
-
has
default boolean has(@NotNull @NotNull net.minecraft.core.component.DataComponentType<?> type) - Specified by:
hasin interfacenet.minecraft.core.component.DataComponentHolder
-
_without
- Specified by:
_withoutin interfaceComponentAccess<IItemStack>
-
_with
default <U> IItemStack _with(net.minecraft.core.component.DataComponentType<U> componentType, @Nullable U value) - Specified by:
_within interfaceComponentAccess<IItemStack>
-
_get
default <U> U _get(net.minecraft.core.component.DataComponentType<? extends U> componentType) - Specified by:
_getin interfaceComponentAccess<IItemStack>
-
_has
default <U> boolean _has(net.minecraft.core.component.DataComponentType<U> componentType) - Specified by:
_hasin interfaceComponentAccess<IItemStack>
-