MCItemStack
Importing the class
If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.
Implements
MCItemStack
implements the following interfaces:
NeoForgeItemStack
,IItemStack
,IIngredient
,IIngredientWithAmount
,CommandStringDisplayable
Operators
Parameters:
Return Type:
bool
Parameters:
o: Object
Type: Object
Return Type:
bool
Parameters:
amount: int
Type: int
Return Type:
IIngredientWithAmount
Parameters:
other: IIngredient
Type: IIngredient
Return Type:
IIngredientList
Parameters:
percentage: double
Type: double
Return Type:
Percentaged<IItemStack>
Parameters:
amount: int
Type: int
- new amount
Return Type:
IItemStack
Members
Attributes added with this method appear on all ItemStacks that match this IIngredient, regardless of how or when the ItemStack was made, if you want to have the attribute on a single specific ItemStack (such as a specific Diamond Sword made in a recipe), then you should use IItemStack#withAttributeModifier
Parameters:
name: string
Type: string
- The name of the modifier. value: double
Type: double
- The value of the modifier. The UUID can be used to override an existing attribute on an ItemStack with this new modifier. You can use
/ct hand attributes
to get the UUID of the attributes on an ItemStack.Attributes added with this method appear on all ItemStacks that match this IIngredient, regardless of how or when the ItemStack was made, if you want to have the attribute on a single specific ItemStack (such as a specific Diamond Sword made in a recipe), then you should use IItemStack#withAttributeModifier
Parameters:
uuid: string
Type: string
- The unique identifier of the modifier to replace. name: string
Type: string
- The name of the modifier. value: double
Type: double
- The value of the modifier. The UUID can be used to override an existing attribute on an ItemStack with this new modifier. You can use
/ct hand attributes
to get the UUID of the attributes on an ItemStack.Attributes added with this method appear on all ItemStacks that match this IIngredient, regardless of how or when the ItemStack was made, if you want to have the attribute on a single specific ItemStack (such as a specific Diamond Sword made in a recipe), then you should use IItemStack#withAttributeModifier
Parameters:
uuid: UUID
Type: UUID
- The unique identifier of the modifier to replace. name: string
Type: string
- The name of the modifier. value: double
Type: double
- The value of the modifier.
Return Type:
int
Return Type:
int
Return Type:
IngredientConditioned<IIngredient>
Return Type:
IIngredientWithAmount
Return Type:
IIngredientWithAmount
Return Type:
IIngredientWithAmount
Return Type:
IIngredientWithAmount
Return Type:
MapData
Return Type:
Ingredient
Return Type:
Percentaged<IItemStack>
Return Type:
UUID
Return Type:
UUID
Return Type:
int
Return Type:
int
Parameters:
time: int
Type: int
- the new burn time Parameters:
time: int
Type: int
- the new burn time Parameters:
leaveName: bool
(optional) Type: bool
Default Value: false
Return Type:
string
Return Type:
string
Return Type:
string
Parameters:
Return Type:
bool
Return Type:
string
Return Type:
int
Return Type:
bool
Return Type:
bool
Return Type:
ItemDefinition
Return Type:
ItemDefinition
Return Type:
ItemDefinition
Return Type:
string
Return Type:
Component
Return Type:
bool
Returns: true if empty, false otherwise
Return Type:
bool
Return Type:
Integer[Enchantment]
Parameters:
Return Type:
Integer[Enchantment]
Returns: This itemStack if it is mutable, a new one with the enchantments otherwise
Parameters:
Return Type:
IItemStack
Return Type:
bool
If true, the item will not burn when thrown into fire or lava.
Parameters:
fireResistant: bool
Type: bool
- Should the item be immune to fire. Returns: True if this IItemStack is immune to fire. False otherwise.
Return Type:
bool
If true, the item will not burn when thrown into fire or lava.
Parameters:
fireResistant: bool
Type: bool
- Should the item be immune to fire.
Return Type:
FoodProperties
Parameters:
food: FoodProperties
Type: FoodProperties
Return Type:
FoodProperties
Parameters:
food: FoodProperties
Type: FoodProperties
Returns: A Map of Attribute to a List of AttributeModifier for the given EquipmentSlot.
Parameters:
Return Type:
List<AttributeModifier>[Attribute]
Parameters:
manager: IRecipeManager<Recipe>
Type: IRecipeManager<Recipe>
Return Type:
int
Parameters:
enchantment: Enchantment
Type: Enchantment
Return Type:
int
Return Type:
ItemStack
Returns: MapData of the ItemStack NBT Tag, empty tag if it doesn't exist.
Return Type:
IData
Parameters:
Return Type:
IItemStack
Returns: This IItemStack if mutable, a new one with the new amount otherwise.
Parameters:
amount: int
(optional) Type: int
- The amount to grow by.
Default Value: 1
Return Type:
IItemStack
Return Type:
bool
Foil is the glint / effect that is added to enchanted ItemStacks (and other items).
Return Type:
bool
Return Type:
bool
This will give the raw name without the formatting that 'displayName' applies.
Return Type:
Component
This will give the raw name without the formatting that 'displayName' applies.
Returns: The hover name of the ItemStack.
Return Type:
Component
Return Type:
IIngredient
Return Type:
bool
Return Type:
bool
Return Type:
bool
Return Type:
bool
Return Type:
bool
Return Type:
bool
Parameters:
Return Type:
bool
Parameters:
ignoreDamage: bool
Type: bool
- Should damage be checked?
Return Type:
bool
Return Type:
int
Setting the damage to
0
will make the item unbreakable.Parameters:
newMaxDamage: int
Type: int
- The new max damage of the ItemStack
Return Type:
int
Parameters:
newMaxStackSize: int
Type: int
- The new max stack size of the Item. Returns: Max stack size of the Item.
Return Type:
int
Parameters:
newMaxStackSize: int
Type: int
- The new max stack size of the Item. Parameters:
shiftedFunction: ITooltipFunction
Type: ITooltipFunction
Parameters:
function: ITooltipFunction
Type: ITooltipFunction
Parameters:
amount: int
Type: int
Return Type:
IIngredientWithAmount
Parameters:
condition: IIngredientCondition<IIngredient>
Type: IIngredientCondition<IIngredient>
Return Type:
IngredientConditioned<IIngredient>
Return Type:
IngredientConditioned<IIngredient>
Parameters:
minDamage: int
Type: int
Return Type:
IngredientConditioned<IIngredient>
Parameters:
maxDamage: int
Type: int
Return Type:
IngredientConditioned<IIngredient>
Parameters:
uid: string
Type: string
function: function(t as IItemStack) as bool
(optional) Type: function(t as IItemStack) as bool
Default Value: null
Return Type:
IngredientConditioned<IIngredient>
Return Type:
string
Parameters:
percentage: double
Type: double
Return Type:
Percentaged<IItemStack>
Return Type:
Rarity
Return Type:
ResourceLocation
Returns: This itemStack if it is mutable, a new one with the enchantment removed otherwise
Parameters:
Return Type:
IItemStack
Attributes removed with this method are removed from ItemStacks that match this IIngredient, regardless of how or when the ItemStack was made, if you want to remove the attribute on a single specific ItemStack (such as a specific Diamond Sword made in a recipe), then you should use IItemStack#withoutAttribute.
This method can only remove default Attributes from an ItemStack, it is still possible that an ItemStack can override it.
Parameters:
Parameters:
uuid: string
Type: string
- The unique id of the AttributeModifier to remove. Parameters:
uuid: UUID
Type: UUID
- The unique id of the AttributeModifier to remove. Parameters:
regex: string
Type: string
Return Type:
IIngredientTransformed<IIngredient>
Parameters:
time: int
Type: int
- the new burn time manager: IRecipeManager<Recipe>
Type: IRecipeManager<Recipe>
Returns: This IItemStack if mutable, a new one with the new amount otherwise.
Parameters:
amount: int
(optional) Type: int
- The amount to shrink by.
Default Value: 1
Return Type:
IItemStack
Return Type:
bool
Return Type:
IData
Parameters:
transformer: IIngredientTransformer<IIngredient>
Type: IIngredientTransformer<IIngredient>
Return Type:
IIngredientTransformed<IIngredient>
Parameters:
uid: string
Type: string
function: function(r as IItemStack) as IItemStack
(optional) Type: function(r as IItemStack) as IItemStack
Default Value: null
Return Type:
IIngredientTransformed<IIngredient>
Parameters:
amount: int
(optional) Type: int
Default Value: 1
Return Type:
IIngredientTransformed<IIngredient>
Parameters:
replaceWith: IItemStack
Type: IItemStack
Return Type:
IIngredientTransformed<IIngredient>
Return Type:
int
Return Type:
bool
The UUID can be used to override an existing attribute on an ItemStack with this new modifier. You can use
/ct hand attributes
to get the UUID of the attributes on an ItemStack.Attributes added with this method will only appear on this specific IItemStack.
By defaults, adding a modifier will remove the default Attribute Modifiers on the Item, like the Diamond Chestplate's Armor and Toughness values. When
preserveDefaults
is set to true (by default it is false.), the default Attribute Modifiers will be preserved when adding this modifier. This means that if you were adding the forge:nametag_distance
attribute to an Item, it would keep its default attributes (like Armor and Toughness values). Parameters:
uuid: string
Type: string
- The unique identifier of the modifier to replace. name: string
Type: string
- The name of the modifier. value: double
Type: double
- The value of the modifier. preserveDefaults: bool
(optional) Type: bool
- Should the default Item Attribute Modifiers be preserved when adding this modifier.
Default Value: false
Return Type:
IItemStack
The UUID can be used to override an existing attribute on an ItemStack with this new modifier. You can use
/ct hand attributes
to get the UUID of the attributes on an ItemStack.Attributes added with this method will only appear on this specific IItemStack.
By defaults, adding a modifier will remove the default Attribute Modifiers on the Item, like the Diamond Chestplate's Armor and Toughness values. When
preserveDefaults
is set to true (by default it is false.), the default Attribute Modifiers will be preserved when adding this modifier. This means that if you were adding the forge:nametag_distance
attribute to an Item, it would keep its default attributes (like Armor and Toughness values). Parameters:
uuid: UUID
Type: UUID
- The unique identifier of the modifier to replace. name: string
Type: string
- The name of the modifier. value: double
Type: double
- The value of the modifier. preserveDefaults: bool
(optional) Type: bool
- Should the default Item Attribute Modifiers be preserved when adding this modifier.
Default Value: false
Return Type:
IItemStack
The UUID can be used to override an existing attribute on an ItemStack with this new modifier. You can use
/ct hand attributes
to get the UUID of the attributes on an ItemStack.Attributes added with this method will only appear on this specific IItemStack.
By defaults, adding a modifier will remove the default Attribute Modifiers on the Item, like the Diamond Chestplate's Armor and Toughness values. When
preserveDefaults
is set to true (by default it is false.), the default Attribute Modifiers will be preserved when adding this modifier. This means that if you were adding the forge:nametag_distance
attribute to an Item, it would keep its default attributes (like Armor and Toughness values). Parameters:
name: string
Type: string
- The name of the modifier. value: double
Type: double
- The value of the modifier. preserveDefaults: bool
(optional) Type: bool
- Should the default Item Attribute Modifiers be preserved when adding this modifier.
Default Value: false
Return Type:
IItemStack
Parameters:
damage: int
Type: int
- the new damage value
Return Type:
IItemStack
Return Type:
IItemStack
Returns: This itemStack if it is mutable, a new one with the enchantment added otherwise
Parameters:
level: int
(optional) Type: int
- The level of the enchantment
Default Value: 1
Return Type:
IItemStack
Return Type:
IItemStack
Returns: This itemStack if it is mutable, a new one with the changed property otherwise
Return Type:
IItemStack
Returns: This itemStack if it is mutable, a new one with the changed property otherwise
Return Type:
IItemStack