ItemApi

Package: thaumcraft.api

Author: Azanor

Helper class for retrieving items and blocks from Thaumcraft’s configuration.

Overview

This utility class provides reflection-based access to items and blocks defined in Thaumcraft’s ConfigItems and ConfigBlocks classes. It allows other mods to obtain Thaumcraft items without hardcoding registry names.

Static Methods

Method Signature Description
getItem String itemString, int meta → ItemStack Retrieves an item by its field name from ConfigItems
getBlock String itemString, int meta → ItemStack Retrieves a block as an ItemStack from ConfigBlocks

Error Handling

If an item or block cannot be found, the method logs a warning and returns null.

Example Items

Casting Wands

Field Name Description
itemWandCasting Basic casting wand

Resources

Field Name Description
itemEssence Magical essence
itemWispEssence Wisp essence
itemResource General resource
itemShard Crystal shard
itemNugget Metal nugget
itemNuggetChicken Chicken nugget
itemNuggetBeef Beef nugget
itemNuggetPork Pork nugget
itemTripleMeatTreat Triple meat treat

Research

Field Name Description
itemResearchNotes Research notes
itemInkwell Inkwell for writing
itemThaumonomicon Thaumonomicon

Usage Example

// Get a casting wand
ItemStack wand = ItemApi.getItem("itemWandCasting", 0);

// Get a crystal shard
ItemStack shard = ItemApi.getItem("itemShard", 0);

// Get a block as itemstack
ItemStack block = ItemApi.getBlock("blockCustomPlant", 0);

Notes

  • The meta parameter allows specifying metadata for the ItemStack
  • Items returned may be actual Item instances or pre-made ItemStack instances from ConfigItems
  • This API uses reflection and may fail silently if Thaumcraft’s internal structure changes

Tags

#api #items #helper #configuration