IItemUtils
The ItemUtils interface provides various item utils.
It can be accessed using the itemUtils
keyword.
Creating Potions
The createPotions function allows you to create custom potions.
Returns the potion as IItemStack.
As the Parameter for this function is a vararg, you can either provide one Object[][] or many Object[].
In both cases each Object[] needs to contain
- An IPotion
- An int describing the effect amplifier/strength
- An int describing the effect duration.
If an Object[] is not of this length or not in this order, it will be ignored.
Get Items by name
These two functions both return an IItemStack[] containing all matching items.
The first checks against the items’ registry names, the 2nd uses the unlocalized names.
Imitate the Item Bracket Handler
This method does the same as the Item Bracket Handler. This allows you to use string variables in the item name by concatenating it in.
Unlike the bracket handler though, you need to provide the meta as optional parameter.
If you want to use the wildcard meta, use 32767
.
Create Spawn Egg
The createSpawnEgg function allows you to create custom mod spawn eggs.
The customNBT is OPTIONAL and can override the entity tag.
Returns the spawn egg as IItemStack.