IItemStack

This represents an item. It can be retrieved using an Item BEP. Is an crafttweaker.api.item.IIngredient

This class was added by a mod with mod-id crafttweaker. So you need to have this mod installed if you want to use this feature.

Importing the class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import.

crafttweaker.api.item.IItemStack

Implemented Interfaces

IItemStack implements the following interfaces. That means any method available to them can also be used on this class.

Methods

clearCustomName

ItemStackに設定されているカスタムネームを取り除きます。

<item:minecraft:dirt>.clearCustomName();

getRemainingItem

この材料スタックでクラフトが行われると、グリッド上になにが残るか? ただし、スタックが一致するかどうかのチェックは行いません! Craft Tweakerでの使用例,

Returns crafttweaker.api.item.IItemStack

<item:minecraft:dirt>.getRemainingItem(stack as crafttweaker.api.item.IItemStack);
<item:minecraft:dirt>.getRemainingItem(<item:minecraft:iron_ingot>);
ParameterTypeDescription
stackcrafttweaker.api.item.IItemStackThe stack to provide for this ingredient.

matches

Does the given stack match the ingredient?

Returns boolean

<item:minecraft:dirt>.matches(stack as crafttweaker.api.item.IItemStack);
<item:minecraft:dirt>.matches(<item:minecraft:iron_ingot>);
ParameterTypeDescription
stackcrafttweaker.api.item.IItemStackThe stack to check

setDisplayName

ItemStackに表示される名前を設定します。

Returns crafttweaker.api.item.IItemStack

<item:minecraft:dirt>.setDisplayName(name as String);
<item:minecraft:dirt>.setDisplayName("totally not dirt");
ParameterTypeDescription
nameStringstackの新しい名前

withDamage

ItemStackのダメージ(耐久値)を設定します。

Returns crafttweaker.api.item.IItemStack

<item:minecraft:dirt>.withDamage(damage as int);
<item:minecraft:dirt>.withDamage(10);
ParameterTypeDescription
damageint新しいダメージの値

withTag

ItemStackのタグを設定します。

Returns crafttweaker.api.item.IItemStack

<item:minecraft:dirt>.withTag(tag as crafttweaker.api.data.IData);
<item:minecraft:dirt>.withTag({Display: {lore: ["Hello"]}});
ParameterTypeDescription
tagcrafttweaker.api.data.IDataタグを設定

Properties

名称TypeHas GetterHas Setter
amountinttruefalse
burnTimeinttruetrue
commandStringStringtruefalse
damageableboolean型truefalse
damagedboolean型truefalse
displayNameStringtruefalse
emptyboolean型truefalse
foodcrafttweaker.api.food.MCFoodtruetrue
getOrCreatecrafttweaker.api.data.IDatatruefalse
getRepairCostinttruefalse
hasDisplayNameboolean型truefalse
hasEffectboolean型truefalse
hasTagboolean型truefalse
isCrossbowboolean型truefalse
isEnchantableboolean型truefalse
isEnchantedboolean型truefalse
itemscrafttweaker.api.item.IItemStack[]truefalse
maxDamageinttruefalse
maxStackSizeinttruefalse
registryNameStringtruefalse
stackableboolean型truefalse
tagcrafttweaker.api.data.IDatatruefalse
translationKeyStringtruefalse
useDurationinttruefalse

演算子

MUL

ItemStackの数量(スタック数)を設定します。

<item:minecraft:dirt> * amount as int
<item:minecraft:dirt> * 3
ParameterTypeDescription
amountintnew amount

Casters