An IItemDefinition object is the direct reference to an item.
It is different from an IItemStack as this only refers to the item, it does not include any meta-information or NBT-values!

패키지 임포트하기

Link to 패키지-임포트하기

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.
import crafttweaker.item.IItemDefinition;

The easiest way is from an IItemStack, but you can also get a list of all registered IItemDefinitions in the game and do something with that.

ZenScript
Copy
//IItemStack Zengetter "definition" -> single IItemDefinition
val itemDefinition = <minecraft:stone>.definition;

//IGame zengetter "items" -> LIST!
val itemDefinitionList = game.items;

What to do with it

Link to what-to-do-with-it

ZenGetters and parameterless ZenMethods

Link to zengetters-and-parameterless-zenmethods

ZenGetter역할반환 타입
ZenGetter
id
역할
Returns the item ID
반환 타입
string
ZenGetter
name
역할
Returns the unlocalized item Name
반환 타입
string
ZenGetter
ores
역할
Returns all ore entries containing this item. Can also contain ore entries that refer to a sub-item.
반환 타입
List<IOreDictEntry>
ZenGetter
owner
역할
Returns the mod name that this item belongs to.
반환 타입
string
ZenGetter
defaultInstance
역할
반환 타입
IItemStack
ZenGetter
creativeTab
역할
반환 타입
ICreativeTab
ZenGetter
creativeTabs
역할
반환 타입
ICreativeTab[]
ZenGetter
canItemEditBlocks
역할
반환 타입
bool
ZenGetter
itemEnchantability
역할
반환 타입
int
ZenGetter
subItems
역할
Returns a list of all subitems that are registered to this item. (like how potions have other items). This is not guaranteed to return the correct list for mods on a server.
반환 타입
List<IItemStack>

ZenSetters and other void-Methods

Link to zensetters-and-other-void-methods

ZenSetter/ZenMethodParameter Type
ZenSetter/ZenMethod
creativeTab
Parameter Type
ICreativeTab
ZenSetter/ZenMethod
setNoRepair()
Parameter Type
none
ZenSetter/ZenMethod
setContainerItem(IItemDefinition item)
Parameter Type
IItemDefinition
  • def.makeStack(meta); Creates an IItemStack with the given metadata. Metadata is an int and OPTIONAL.
  • def.setHarvestLevel(String type, int level); Changes the item's harvest level to the corresponding type and level
  • def.getSubItems(creativeTab); Returns a List<IItemStack> with all subitems for the given ICreativeTab. This is not guaranteed to return the correct list for mods on a server.
  • def.getItemBurntime(item); Returns an int representing either -1 (Vanilla logic will apply), 0 (Not smeltable) or the items burntime