NeoForgeItemStack
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.
import crafttweaker.api.item.NeoForgeItemStack;
Implements
NeoForgeItemStack
implements the following interfaces:
IItemStack
,IIngredient
,IIngredientWithAmount
,CommandStringDisplayable
Operators
myIIngredient in myNeoForgeItemStack
Parameters:
Return Type:
bool
// (NeoForgeItemStack * (amount as int)) as IIngredientWithAmountmyNeoForgeItemStack * myInt
Parameters:
amount: int
Type: int
Return Type:
IIngredientWithAmount
myNeoForgeItemStack | myIIngredient
Parameters:
other: IIngredient
Type: IIngredient
Return Type:
IIngredientList
myNeoForgeItemStack % myDouble
Parameters:
percentage: double
Type: double
Return Type:
Percentaged<IItemStack>
// (NeoForgeItemStack * (amount as int)) as IItemStackmyNeoForgeItemStack * myInt
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
// NeoForgeItemStack.addGlobalAttributeModifier(attribute as Attribute, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[]);myNeoForgeItemStack.addGlobalAttributeModifier(<attribute:minecraft:generic.attack_damage>, "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>]);
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
// NeoForgeItemStack.addGlobalAttributeModifier(attribute as Attribute, uuid as string, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[]);myNeoForgeItemStack.addGlobalAttributeModifier(<attribute:minecraft:generic.attack_damage>, "8c1b5535-9f79-448b-87ae-52d81480aaa3", "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>]);
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
// NeoForgeItemStack.addGlobalAttributeModifier(attribute as Attribute, uuid as UUID, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[]);myNeoForgeItemStack.addGlobalAttributeModifier(<attribute:minecraft:generic.attack_damage>, IItemStack.BASE_ATTACK_DAMAGE_UUID, "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>]);
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. // NeoForgeItemStack.amount as intmyNeoForgeItemStack.amount
Return Type:
int
// NeoForgeItemStack.amount as intmyNeoForgeItemStack.amount
Return Type:
int
myNeoForgeItemStack.asIIngredientWithAmount();
Return Type:
IIngredientWithAmount
// NeoForgeItemStack as IIngredientWithAmountmyNeoForgeItemStack as IIngredientWithAmount
Return Type:
IIngredientWithAmount
// NeoForgeItemStack as IIngredientWithAmountmyNeoForgeItemStack as IIngredientWithAmount
Return Type:
IIngredientWithAmount
myNeoForgeItemStack.asVanillaIngredient();
Return Type:
Ingredient
// NeoForgeItemStack as IngredientmyNeoForgeItemStack as Ingredient
Return Type:
Ingredient
myNeoForgeItemStack as Percentaged<IItemStack>
Return Type:
Percentaged<IItemStack>
// NeoForgeItemStack.BASE_ATTACK_DAMAGE_UUID as UUIDNeoForgeItemStack.BASE_ATTACK_DAMAGE_UUID
Return Type:
UUID
// NeoForgeItemStack.BASE_ATTACK_SPEED_UUID as UUIDNeoForgeItemStack.BASE_ATTACK_SPEED_UUID
Return Type:
UUID
// NeoForgeItemStack.baseRepairCost as intmyNeoForgeItemStack.baseRepairCost
Return Type:
int
// NeoForgeItemStack.burnTime = (time as int);myNeoForgeItemStack.burnTime = myInt;
Parameters:
time: int
Type: int
- the new burn time // NeoForgeItemStack.burnTime(time as int);myNeoForgeItemStack.burnTime(500);
Parameters:
time: int
Type: int
- the new burn time // NeoForgeItemStack.clearTooltip(leaveName as bool = false);myNeoForgeItemStack.clearTooltip(myBool);
Parameters:
leaveName: bool
(optional) Type: bool
Default Value: false
// NeoForgeItemStack.commandString as stringmyNeoForgeItemStack.commandString
Return Type:
string
// NeoForgeItemStack.commandString as stringmyNeoForgeItemStack.commandString
Return Type:
string
// NeoForgeItemStack.commandString() as string;myNeoForgeItemStack.commandString();
Return Type:
string
myNeoForgeItemStack.contains((<item:minecraft:iron_ingot> | <item:minecraft:gold_ingot>));
Parameters:
Return Type:
bool
// NeoForgeItemStack.CRAFTTWEAKER_DATA_KEY as stringNeoForgeItemStack.CRAFTTWEAKER_DATA_KEY
Return Type:
string
// NeoForgeItemStack.damage as intmyNeoForgeItemStack.damage
Return Type:
int
// NeoForgeItemStack.damageableItem as boolmyNeoForgeItemStack.damageableItem
Return Type:
bool
// NeoForgeItemStack.damaged as boolmyNeoForgeItemStack.damaged
Return Type:
bool
// NeoForgeItemStack.definition as ItemDefinitionmyNeoForgeItemStack.definition
Return Type:
ItemDefinition
// NeoForgeItemStack as ItemDefinitionmyNeoForgeItemStack as Item
Return Type:
ItemDefinition
// NeoForgeItemStack.descriptionId as stringmyNeoForgeItemStack.descriptionId
Return Type:
string
// NeoForgeItemStack.empty as boolmyNeoForgeItemStack.empty
Return Type:
bool
Returns: true if empty, false otherwise
// NeoForgeItemStack.empty() as bool;myNeoForgeItemStack.empty();
Return Type:
bool
myNeoForgeItemStack.enchantments
Return Type:
Integer[Enchantment]
myNeoForgeItemStack.enchantments = myMap;
Parameters:
Returns: This itemStack if it is mutable, a new one with the enchantments otherwise
myNeoForgeItemStack.enchantments(myMap);
Parameters:
Return Type:
IItemStack
// NeoForgeItemStack.fireResistant as boolmyNeoForgeItemStack.fireResistant
Return Type:
bool
If true, the item will not burn when thrown into fire or lava.
// NeoForgeItemStack.fireResistant = (fireResistant as bool);myNeoForgeItemStack.fireResistant = myBool;
Parameters:
fireResistant: bool
Type: bool
- Should the item be immune to fire. Returns: True if this IItemStack is immune to fire. False otherwise.
// NeoForgeItemStack.fireResistant() as bool;myNeoForgeItemStack.fireResistant();
Return Type:
bool
If true, the item will not burn when thrown into fire or lava.
// NeoForgeItemStack.fireResistant(fireResistant as bool);myNeoForgeItemStack.fireResistant(myBool);
Parameters:
fireResistant: bool
Type: bool
- Should the item be immune to fire. // NeoForgeItemStack.food as FoodPropertiesmyNeoForgeItemStack.food
Return Type:
FoodProperties
myNeoForgeItemStack.food = myFoodProperties;
Parameters:
food: FoodProperties
Type: FoodProperties
myNeoForgeItemStack.food(myFoodProperties);
Parameters:
food: FoodProperties
Type: FoodProperties
Returns: A Map of Attribute to a List of AttributeModifier for the given EquipmentSlot.
// NeoForgeItemStack.getAttributes(slotType as EquipmentSlot) as List<AttributeModifier>[Attribute];myNeoForgeItemStack.getAttributes(<constant:minecraft:equipmentslot:chest>);
Parameters:
Return Type:
List<AttributeModifier>[Attribute]
myNeoForgeItemStack.getBurnTime(myIRecipeManager);
Parameters:
manager: IRecipeManager<Recipe>
Type: IRecipeManager<Recipe>
Return Type:
int
myNeoForgeItemStack.getEnchantmentLevel(myEnchantment);
Parameters:
enchantment: Enchantment
Type: Enchantment
Return Type:
int
Returns: This IItemStack if mutable, a new one with the new amount otherwise.
myNeoForgeItemStack.grow(2);
Parameters:
amount: int
(optional) Type: int
- The amount to grow by.
Default Value: 1
Return Type:
IItemStack
// NeoForgeItemStack.hasCustomHoverName as boolmyNeoForgeItemStack.hasCustomHoverName
Return Type:
bool
Foil is the glint / effect that is added to enchanted ItemStacks (and other items).
// NeoForgeItemStack.hasFoil as boolmyNeoForgeItemStack.hasFoil
Return Type:
bool
// NeoForgeItemStack.hasTag as boolmyNeoForgeItemStack.hasTag
Return Type:
bool
// NeoForgeItemStack.ingredient as IIngredientmyNeoForgeItemStack.ingredient
Return Type:
IIngredient
// NeoForgeItemStack.isEdible as boolmyNeoForgeItemStack.isEdible
Return Type:
bool
// NeoForgeItemStack.isEdible() as bool;myNeoForgeItemStack.isEdible();
Return Type:
bool
// NeoForgeItemStack.isEnchantable as boolmyNeoForgeItemStack.isEnchantable
Return Type:
bool
// NeoForgeItemStack.isEnchanted as boolmyNeoForgeItemStack.isEnchanted
Return Type:
bool
// NeoForgeItemStack.isImmutable as boolmyNeoForgeItemStack.isImmutable
Return Type:
bool
// NeoForgeItemStack.isImmutable() as bool;myNeoForgeItemStack.isImmutable();
Return Type:
bool
// NeoForgeItemStack.isMutable as boolmyNeoForgeItemStack.isMutable
Return Type:
bool
// NeoForgeItemStack.isMutable() as bool;myNeoForgeItemStack.isMutable();
Return Type:
bool
myNeoForgeItemStack.items
Return Type:
IItemStack[]
myNeoForgeItemStack.matches(<item:minecraft:iron_ingot>);
Parameters:
Return Type:
bool
myNeoForgeItemStack.matches(<item:minecraft:iron_ingot>, myBool);
Parameters:
ignoreDamage: bool
Type: bool
- Should damage be checked?
Return Type:
bool
// NeoForgeItemStack.maxDamage as intmyNeoForgeItemStack.maxDamage
Return Type:
int
Setting the damage to
0
will make the item unbreakable.// NeoForgeItemStack.maxDamage = (newMaxDamage as int);myNeoForgeItemStack.maxDamage = myInt;
Parameters:
newMaxDamage: int
Type: int
- The new max damage of the ItemStack // NeoForgeItemStack.maxStackSize as intmyNeoForgeItemStack.maxStackSize
Return Type:
int
// NeoForgeItemStack.maxStackSize = (newMaxStackSize as int);myNeoForgeItemStack.maxStackSize = myInt;
Parameters:
newMaxStackSize: int
Type: int
- The new max stack size of the Item. Returns: Max stack size of the Item.
// NeoForgeItemStack.maxStackSize() as int;myNeoForgeItemStack.maxStackSize();
Return Type:
int
// NeoForgeItemStack.maxStackSize(newMaxStackSize as int);myNeoForgeItemStack.maxStackSize(16);
Parameters:
newMaxStackSize: int
Type: int
- The new max stack size of the Item. // NeoForgeItemStack.modifyShiftTooltip(shiftedFunction as ITooltipFunction, unshiftedFunction as ITooltipFunction = null);myNeoForgeItemStack.modifyShiftTooltip(myITooltipFunction, myITooltipFunction);
Parameters:
shiftedFunction: ITooltipFunction
Type: ITooltipFunction
myNeoForgeItemStack.modifyTooltip(myITooltipFunction);
Parameters:
function: ITooltipFunction
Type: ITooltipFunction
myNeoForgeItemStack.mul(myInt);
Parameters:
amount: int
Type: int
Return Type:
IIngredientWithAmount
// NeoForgeItemStack.only(condition as IIngredientCondition<IIngredient>) as IngredientConditioned<IIngredient>;myNeoForgeItemStack.only(myIIngredientCondition);
Parameters:
condition: IIngredientCondition<IIngredient>
Type: IIngredientCondition<IIngredient>
Return Type:
IngredientConditioned<IIngredient>
myNeoForgeItemStack.onlyDamagedAtLeast(myInt);
Parameters:
minDamage: int
Type: int
Return Type:
IngredientConditioned<IIngredient>
myNeoForgeItemStack.onlyDamagedAtMost(myInt);
Parameters:
maxDamage: int
Type: int
Return Type:
IngredientConditioned<IIngredient>
// NeoForgeItemStack.onlyIf(uid as string, function as function(t as IItemStack) as bool = null) as IngredientConditioned<IIngredient>;myNeoForgeItemStack.onlyIf(myString, myPredicate);
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>
// NeoForgeItemStack.owner as stringmyNeoForgeItemStack.owner
Return Type:
string
myNeoForgeItemStack.percent(myDouble);
Parameters:
percentage: double
Type: double
Return Type:
Percentaged<IItemStack>
// NeoForgeItemStack.registryName as ResourceLocationmyNeoForgeItemStack.registryName
Return Type:
ResourceLocation
Returns: This itemStack if it is mutable, a new one with the enchantment removed otherwise
myNeoForgeItemStack.removeEnchantment(<enchantment:minecraft:riptide>);
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.
myNeoForgeItemStack.removeGlobalAttribute(<attribute:minecraft:generic.attack_damage>, [<constant:minecraft:equipmentslot:chest>]);
Parameters:
myNeoForgeItemStack.removeGlobalAttributeModifier("8c1b5535-9f79-448b-87ae-52d81480aaa3", [<constant:minecraft:equipmentslot:chest>]);
Parameters:
uuid: string
Type: string
- The unique id of the AttributeModifier to remove. myNeoForgeItemStack.removeGlobalAttributeModifier(IItemStack.BASE_ATTACK_DAMAGE_UUID, [<constant:minecraft:equipmentslot:chest>]);
Parameters:
uuid: UUID
Type: UUID
- The unique id of the AttributeModifier to remove. // NeoForgeItemStack.removeTooltip(regex as string);myNeoForgeItemStack.removeTooltip(myString);
Parameters:
regex: string
Type: string
// NeoForgeItemStack.resetHoverName();myNeoForgeItemStack.resetHoverName();
myNeoForgeItemStack.setBurnTime(500, myIRecipeManager);
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.
myNeoForgeItemStack.shrink(2);
Parameters:
amount: int
(optional) Type: int
- The amount to shrink by.
Default Value: 1
Return Type:
IItemStack
// NeoForgeItemStack.stackable as boolmyNeoForgeItemStack.stackable
Return Type:
bool
// NeoForgeItemStack.transform(transformer as IIngredientTransformer<IIngredient>) as IIngredientTransformed<IIngredient>;myNeoForgeItemStack.transform(myIIngredientTransformer);
Parameters:
transformer: IIngredientTransformer<IIngredient>
Type: IIngredientTransformer<IIngredient>
Return Type:
IIngredientTransformed<IIngredient>
// NeoForgeItemStack.transformCustom(uid as string, function as function(r as IItemStack) as IItemStack = null) as IIngredientTransformed<IIngredient>;myNeoForgeItemStack.transformCustom(myString, myFunction);
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>
myNeoForgeItemStack.transformDamage(myInt);
Parameters:
amount: int
(optional) Type: int
Default Value: 1
Return Type:
IIngredientTransformed<IIngredient>
// NeoForgeItemStack.transformReplace(replaceWith as IItemStack) as IIngredientTransformed<IIngredient>;myNeoForgeItemStack.transformReplace(myIItemStack);
Parameters:
replaceWith: IItemStack
Type: IItemStack
Return Type:
IIngredientTransformed<IIngredient>
// NeoForgeItemStack.useDuration as intmyNeoForgeItemStack.useDuration
Return Type:
int
// NeoForgeItemStack.useOnRelease as boolmyNeoForgeItemStack.useOnRelease
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).// NeoForgeItemStack.withAttributeModifier(attribute as Attribute, uuid as string, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[], preserveDefaults as bool = false) as IItemStack;myNeoForgeItemStack.withAttributeModifier(<attribute:minecraft:generic.attack_damage>, "8c1b5535-9f79-448b-87ae-52d81480aaa3", "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>], true);
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).// NeoForgeItemStack.withAttributeModifier(attribute as Attribute, uuid as UUID, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[], preserveDefaults as bool = false) as IItemStack;myNeoForgeItemStack.withAttributeModifier(<attribute:minecraft:generic.attack_damage>, "8c1b5535-9f79-448b-87ae-52d81480aaa3", "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>], true);
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).// NeoForgeItemStack.withAttributeModifier(attribute as Attribute, name as string, value as double, operation as AttributeOperation, slotTypes as EquipmentSlot[], preserveDefaults as bool = false) as IItemStack;myNeoForgeItemStack.withAttributeModifier(<attribute:minecraft:generic.attack_damage>, "Extra Power", 10, AttributeOperation.ADDITION, [<constant:minecraft:equipmentslot:chest>], true);
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
myNeoForgeItemStack.withDamage(10);
Parameters:
damage: int
Type: int
- the new damage value
Return Type:
IItemStack
myNeoForgeItemStack.withDisplayName("totally not dirt");
Return Type:
IItemStack
Returns: This itemStack if it is mutable, a new one with the enchantment added otherwise
myNeoForgeItemStack.withEnchantment(<enchantment:minecraft:riptide>, 2);
Parameters:
level: int
(optional) Type: int
- The level of the enchantment
Default Value: 1
Return Type:
IItemStack
myNeoForgeItemStack.withLore(new crafttweaker.api.text.TextComponent("I am the lore I speak for the trees"););
Return Type:
IItemStack
Returns: This itemStack if it is mutable, a new one with the changed property otherwise
myNeoForgeItemStack.withoutTag();
Return Type:
IItemStack
Returns: This itemStack if it is mutable, a new one with the changed property otherwise
myNeoForgeItemStack.withTag({Display: {lore: ["Hello"]}});
Return Type:
IItemStack