package thaumcraft.api; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraftforge.common.EnumHelper; import net.minecraftforge.oredict.OreDictionary; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.crafting.*; import thaumcraft.api.research.*; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.concurrent.ConcurrentHashMap; /** * @author Azanor *
* * IMPORTANT: If you are adding your own aspects to items it is a good idea to do it AFTER Thaumcraft adds its aspects, otherwise odd things may happen. */ public class ThaumcraftApi { //Materials public static EnumToolMaterial toolMatThaumium = EnumHelper.addToolMaterial("THAUMIUM", 3, 400, 7F, 2, 22); public static EnumToolMaterial toolMatElemental = EnumHelper.addToolMaterial("THAUMIUM_ELEMENTAL", 3, 1500, 10F, 3, 18); public static EnumArmorMaterial armorMatThaumium = EnumHelper.addArmorMaterial("THAUMIUM", 25, new int[]{2, 6, 5, 2}, 25); public static EnumArmorMaterial armorMatSpecial = EnumHelper.addArmorMaterial("SPECIAL", 25, new int[]{1, 3, 2, 1}, 25); //Enchantment references public static int enchantFrugal; public static int enchantPotency; public static int enchantWandFortune; public static int enchantHaste; public static int enchantRepair; //Miscellaneous /** * Portable Hole Block-id Blacklist. * Simply add the block-id's of blocks you don't want the portable hole to go through. */ public static ArrayList* ThaumcraftApi.registerObjectTag(Block.cobblestone.blockID, -1, (new ObjectTags()).add(EnumTag.ROCK, 1).add(EnumTag.DESTRUCTION, 1)); * * @param id * @param meta pass -1 if all damage values of this item/block should have the same aspects * @param aspects A ObjectTags object of the associated aspects */ public static void registerObjectTag(int id, int meta, AspectList aspects) { if (aspects == null) { aspects = new AspectList(); } objectTags.put(Arrays.asList(id, meta), aspects); } /** * Used to assign apsects to the given item/block. Here is an example of the declaration for cobblestone:
* ThaumcraftApi.registerObjectTag(Block.cobblestone.blockID, new int[]{0,1}, (new ObjectTags()).add(EnumTag.ROCK, 1).add(EnumTag.DESTRUCTION, 1));
*
* @param id
* @param meta A range of meta values if you wish to lump several item meta's together as being the "same" item (i.e. stair orientations)
* @param aspects A ObjectTags object of the associated aspects
*/
public static void registerObjectTag(int id, int[] meta, AspectList aspects)
{
if (aspects == null)
{
aspects = new AspectList();
}
objectTags.put(Arrays.asList(id, meta), aspects);
}
/**
* Used to assign apsects to the given ore dictionary item.
*
* @param oreDict the ore dictionary name
* @param aspects A ObjectTags object of the associated aspects
*/
public static void registerObjectTag(String oreDict, AspectList aspects)
{
if (aspects == null)
{
aspects = new AspectList();
}
ArrayList
* ThaumcraftApi.registerComplexObjectTag(Block.pistonBase.blockID, 0, (new ObjectTags()).add(EnumTag.MECHANISM, 2).add(EnumTag.MOTION, 4));
*
* @param id
* @param meta pass -1 if all damage values of this item/block should have the same aspects
* @param aspects A ObjectTags object of the associated aspects
*/
public static void registerComplexObjectTag(int id, int meta, AspectList aspects)
{
if (!exists(id, meta))
{
AspectList tmp = ThaumcraftApiHelper.generateTags(id, meta);
if (tmp != null && tmp.size() > 0)
{
for (Aspect tag : tmp.getAspects())
{
aspects.add(tag, tmp.getAmount(tag));
}
}
registerObjectTag(id, meta, aspects);
} else
{
AspectList tmp = ThaumcraftApiHelper.getObjectAspects(new ItemStack(id, 1, meta));
for (Aspect tag : aspects.getAspects())
{
tmp.merge(tag, tmp.getAmount(tag));
}
registerObjectTag(id, meta, tmp);
}
}
//CROPS //////////////////////////////////////////////////////////////////////////////////////////
/**
* To define mod crops you need to use FMLInterModComms in your @Mod.Init method.
* There are two 'types' of crops you can add. Standard crops and clickable crops.
*
* Standard crops work like normal vanilla crops - they grow until a certain metadata
* value is reached and you harvest them by destroying the block and collecting the blocks.
* You need to create and ItemStack that tells the golem what block id and metadata represents
* the crop when fully grown.
* Example for vanilla wheat:
* FMLInterModComms.sendMessage("Thaumcraft", "harvestStandardCrop", new ItemStack(Block.crops,1,7));
*
* Clickable crops are crops that you right click to gather their bounty instead of destroying them.
* As for standard crops, you need to create and ItemStack that tells the golem what block id
* and metadata represents the crop when fully grown. The golem will trigger the blocks onBlockActivated method.
* Example (this will technically do nothing since clicking wheat does nothing, but you get the idea):
* FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(Block.crops,1,7));
*/
//NATIVE CLUSTERS //////////////////////////////////////////////////////////////////////////////////
/**
* You can define certain ores that will have a chance to produce native clusters via FMLInterModComms
* in your @Mod.Init method using the "nativeCluster" string message.
* The format should be:
* "[ore item/block id],[ore item/block metadata],[cluster item/block id],[cluster item/block metadata],[chance modifier float]"
*
* NOTE: The chance modifier is a multiplier applied to the default chance for that cluster to be produced (27.5% for a pickaxe of the core)
*
* Example for vanilla iron ore to produce one of my own native iron clusters (assuming default id's) at double the default chance:
* FMLInterModComms.sendMessage("Thaumcraft", "nativeCluster","15,0,25016,16,2.0");
*/
}