Massive rework of configs, items and blocks.
I redone where the items/blocsks are stored and how the configs are handled to clean up it and give space. You can change the config line to AWWayofTime if you want to keep the compatibility with old configs. Now you reference the blocks from the ModBlocks and Items from the ModItems.
This commit is contained in:
parent
8601e9faff
commit
e3644f2d2b
304 changed files with 3941 additions and 5108 deletions
|
@ -1,11 +1,5 @@
|
|||
package thaumcraft.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumArmorMaterial;
|
||||
|
@ -16,31 +10,27 @@ import net.minecraftforge.common.EnumHelper;
|
|||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.crafting.CrucibleRecipe;
|
||||
import thaumcraft.api.crafting.InfusionEnchantmentRecipe;
|
||||
import thaumcraft.api.crafting.InfusionRecipe;
|
||||
import thaumcraft.api.crafting.ShapedArcaneRecipe;
|
||||
import thaumcraft.api.crafting.ShapelessArcaneRecipe;
|
||||
import thaumcraft.api.research.IScanEventHandler;
|
||||
import thaumcraft.api.research.ResearchCategories;
|
||||
import thaumcraft.api.research.ResearchCategoryList;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
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.
|
||||
*
|
||||
* <p/>
|
||||
* <p/>
|
||||
* 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
|
||||
{
|
||||
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);
|
||||
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;
|
||||
|
@ -59,14 +49,15 @@ public class ThaumcraftApi
|
|||
//RESEARCH/////////////////////////////////////////
|
||||
public static ArrayList<IScanEventHandler> scanEventhandlers = new ArrayList<IScanEventHandler>();
|
||||
public static ArrayList<EntityTags> scanEntities = new ArrayList<EntityTags>();
|
||||
public static class EntityTags
|
||||
{
|
||||
|
||||
public static class EntityTags {
|
||||
public EntityTags(String entityName, NBTBase[] nbts, AspectList aspects)
|
||||
{
|
||||
this.entityName = entityName;
|
||||
this.nbts = nbts;
|
||||
this.aspects = aspects;
|
||||
}
|
||||
|
||||
public String entityName;
|
||||
public NBTBase[] nbts;
|
||||
public AspectList aspects;
|
||||
|
@ -74,6 +65,7 @@ public class ThaumcraftApi
|
|||
|
||||
/**
|
||||
* not really working atm, so ignore it for now
|
||||
*
|
||||
* @param scanEventHandler
|
||||
*/
|
||||
public static void registerScanEventhandler(IScanEventHandler scanEventHandler)
|
||||
|
@ -84,12 +76,13 @@ public class ThaumcraftApi
|
|||
/**
|
||||
* This is used to add aspects to entities which you can then scan using a thaumometer.
|
||||
* Also used to calculate vis drops from mobs.
|
||||
*
|
||||
* @param entityName
|
||||
* @param aspects
|
||||
* @param nbt you can specify certain nbt keys and their values
|
||||
* to differentiate between mobs. <br>For example the normal and wither skeleton:
|
||||
* <br>ThaumcraftApi.registerEntityTag("Skeleton", (new AspectList()).add(Aspect.DEATH, 5));
|
||||
* <br>ThaumcraftApi.registerEntityTag("Skeleton", (new AspectList()).add(Aspect.DEATH, 8), new NBTTagByte("SkeletonType",(byte) 1));
|
||||
* @param nbt you can specify certain nbt keys and their values
|
||||
* to differentiate between mobs. <br>For example the normal and wither skeleton:
|
||||
* <br>ThaumcraftApi.registerEntityTag("Skeleton", (new AspectList()).add(Aspect.DEATH, 5));
|
||||
* <br>ThaumcraftApi.registerEntityTag("Skeleton", (new AspectList()).add(Aspect.DEATH, 8), new NBTTagByte("SkeletonType",(byte) 1));
|
||||
*/
|
||||
public static void registerEntityTag(String entityName, AspectList aspects, NBTBase... nbt)
|
||||
{
|
||||
|
@ -98,24 +91,26 @@ public class ThaumcraftApi
|
|||
|
||||
//RECIPES/////////////////////////////////////////
|
||||
private static ArrayList craftingRecipes = new ArrayList();
|
||||
private static HashMap<List, ItemStack> smeltingBonus = new HashMap<List, ItemStack>();
|
||||
private static HashMap<List,ItemStack> smeltingBonus = new HashMap<List,ItemStack>();
|
||||
private static ArrayList<List> smeltingBonusExlusion = new ArrayList<List>();
|
||||
|
||||
/**
|
||||
* This method is used to determine what bonus items are generated when the infernal furnace smelts items
|
||||
* @param in The result (not input) of the smelting operation. e.g. new ItemStack(ingotGold)
|
||||
*
|
||||
* @param in The result (not input) of the smelting operation. e.g. new ItemStack(ingotGold)
|
||||
* @param out The bonus item that can be produced from the smelting operation e.g. new ItemStack(nuggetGold,0,0).
|
||||
* Stacksize should be 0 unless you want to guarantee that at least 1 item is always produced.
|
||||
* Stacksize should be 0 unless you want to guarantee that at least 1 item is always produced.
|
||||
*/
|
||||
public static void addSmeltingBonus(ItemStack in, ItemStack out)
|
||||
{
|
||||
smeltingBonus.put(
|
||||
Arrays.asList(in.itemID, in.getItemDamage()),
|
||||
new ItemStack(out.itemID, 0, out.getItemDamage()));
|
||||
Arrays.asList(in.itemID, in.getItemDamage()),
|
||||
new ItemStack(out.itemID, 0, out.getItemDamage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bonus item produced from a smelting operation in the infernal furnace
|
||||
*
|
||||
* @param in The result of the smelting operation. e.g. new ItemStack(ingotGold)
|
||||
* @return the The bonus item that can be produced
|
||||
*/
|
||||
|
@ -127,12 +122,13 @@ public class ThaumcraftApi
|
|||
/**
|
||||
* Excludes specific items from producing bonus items when they are smelted in the infernal furnace, even
|
||||
* if their smelt result would normally produce a bonus item.
|
||||
* @param in The item to be smelted that should never produce a bonus item (e.g. the various macerated dusts form IC2)
|
||||
* Even though they produce gold, iron, etc. ingots, they should NOT produce bonus nuggets as well.
|
||||
*
|
||||
* Smelting exclusions can also be done via the FMLInterModComms in your @Mod.Init method using "smeltBonusExclude"
|
||||
* Example for vanilla iron:
|
||||
* FMLInterModComms.sendMessage("Thaumcraft", "smeltBonusExclude", new ItemStack(Item.ingotIron));
|
||||
* @param in The item to be smelted that should never produce a bonus item (e.g. the various macerated dusts form IC2)
|
||||
* Even though they produce gold, iron, etc. ingots, they should NOT produce bonus nuggets as well.
|
||||
* <p/>
|
||||
* Smelting exclusions can also be done via the FMLInterModComms in your @Mod.Init method using "smeltBonusExclude"
|
||||
* Example for vanilla iron:
|
||||
* FMLInterModComms.sendMessage("Thaumcraft", "smeltBonusExclude", new ItemStack(Item.ingotIron));
|
||||
*/
|
||||
public static void addSmeltingBonusExclusion(ItemStack in)
|
||||
{
|
||||
|
@ -141,6 +137,7 @@ public class ThaumcraftApi
|
|||
|
||||
/**
|
||||
* Sees if an item is allowed to produce bonus items when smelted in the infernal furnace
|
||||
*
|
||||
* @param in The item you wish to check
|
||||
* @return true or false
|
||||
*/
|
||||
|
@ -156,11 +153,11 @@ public class ThaumcraftApi
|
|||
|
||||
/**
|
||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param result the recipe output
|
||||
* @param aspects the vis cost per aspect.
|
||||
* @param recipe The recipe. Format is exactly the same as vanilla recipes. Input itemstacks are NBT sensitive.
|
||||
* @param result the recipe output
|
||||
* @param aspects the vis cost per aspect.
|
||||
* @param recipe The recipe. Format is exactly the same as vanilla recipes. Input itemstacks are NBT sensitive.
|
||||
*/
|
||||
public static ShapedArcaneRecipe addArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe)
|
||||
public static ShapedArcaneRecipe addArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object... recipe)
|
||||
{
|
||||
ShapedArcaneRecipe r = new ShapedArcaneRecipe(research, result, aspects, recipe);
|
||||
craftingRecipes.add(r);
|
||||
|
@ -169,11 +166,11 @@ public class ThaumcraftApi
|
|||
|
||||
/**
|
||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param result the recipe output
|
||||
* @param aspects the vis cost per aspect
|
||||
* @param recipe The recipe. Format is exactly the same as vanilla shapeless recipes. Input itemstacks are NBT sensitive.
|
||||
* @param result the recipe output
|
||||
* @param aspects the vis cost per aspect
|
||||
* @param recipe The recipe. Format is exactly the same as vanilla shapeless recipes. Input itemstacks are NBT sensitive.
|
||||
*/
|
||||
public static ShapelessArcaneRecipe addShapelessArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe)
|
||||
public static ShapelessArcaneRecipe addShapelessArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object... recipe)
|
||||
{
|
||||
ShapelessArcaneRecipe r = new ShapelessArcaneRecipe(research, result, aspects, recipe);
|
||||
craftingRecipes.add(r);
|
||||
|
@ -181,15 +178,14 @@ public class ThaumcraftApi
|
|||
}
|
||||
|
||||
/**
|
||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param result the recipe output. It can either be an itemstack or an nbt compound tag that will be added to the central item
|
||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param result the recipe output. It can either be an itemstack or an nbt compound tag that will be added to the central item
|
||||
* @param instability a number that represents the N in 1000 chance for the infusion altar to spawn an
|
||||
* instability effect each second while the crafting is in progress
|
||||
* @param aspects the essentia cost per aspect.
|
||||
* @param aspects input the central item to be infused
|
||||
* @param recipe An array of items required to craft this. Input itemstacks are NBT sensitive.
|
||||
* Infusion crafting components are automatically "fuzzy" and the oredict will be checked for possible matches.
|
||||
*
|
||||
* instability effect each second while the crafting is in progress
|
||||
* @param aspects the essentia cost per aspect.
|
||||
* @param aspects input the central item to be infused
|
||||
* @param recipe An array of items required to craft this. Input itemstacks are NBT sensitive.
|
||||
* Infusion crafting components are automatically "fuzzy" and the oredict will be checked for possible matches.
|
||||
*/
|
||||
public static InfusionRecipe addInfusionCraftingRecipe(String research, Object result, int instability, AspectList aspects, ItemStack input, ItemStack[] recipe)
|
||||
{
|
||||
|
@ -204,14 +200,13 @@ public class ThaumcraftApi
|
|||
}
|
||||
|
||||
/**
|
||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param research the research key required for this recipe to work. Leave blank if it will work without research
|
||||
* @param enchantment the enchantment that will be applied to the item
|
||||
* @param instability a number that represents the N in 1000 chance for the infusion altar to spawn an
|
||||
* instability effect each second while the crafting is in progress
|
||||
* @param aspects the essentia cost per aspect.
|
||||
* @param recipe An array of items required to craft this. Input itemstacks are NBT sensitive.
|
||||
* Infusion crafting components are automatically "fuzzy" and the oredict will be checked for possible matches.
|
||||
*
|
||||
* instability effect each second while the crafting is in progress
|
||||
* @param aspects the essentia cost per aspect.
|
||||
* @param recipe An array of items required to craft this. Input itemstacks are NBT sensitive.
|
||||
* Infusion crafting components are automatically "fuzzy" and the oredict will be checked for possible matches.
|
||||
*/
|
||||
public static InfusionEnchantmentRecipe addInfusionEnchantmentRecipe(String research, Enchantment enchantment, int instability, AspectList aspects, ItemStack[] recipe)
|
||||
{
|
||||
|
@ -226,15 +221,15 @@ public class ThaumcraftApi
|
|||
*/
|
||||
public static InfusionRecipe getInfusionRecipe(ItemStack res)
|
||||
{
|
||||
for (Object r: getCraftingRecipes())
|
||||
for (Object r : getCraftingRecipes())
|
||||
{
|
||||
if (r instanceof InfusionRecipe)
|
||||
{
|
||||
if (((InfusionRecipe)r).recipeOutput instanceof ItemStack)
|
||||
if (((InfusionRecipe) r).recipeOutput instanceof ItemStack)
|
||||
{
|
||||
if (((ItemStack)((InfusionRecipe)r).recipeOutput).isItemEqual(res))
|
||||
if (((ItemStack) ((InfusionRecipe) r).recipeOutput).isItemEqual(res))
|
||||
{
|
||||
return (InfusionRecipe)r;
|
||||
return (InfusionRecipe) r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -244,10 +239,10 @@ public class ThaumcraftApi
|
|||
}
|
||||
|
||||
/**
|
||||
* @param key the research key required for this recipe to work.
|
||||
* @param key the research key required for this recipe to work.
|
||||
* @param result the output result
|
||||
* @param cost the vis cost
|
||||
* @param tags the aspects required to craft this
|
||||
* @param cost the vis cost
|
||||
* @param tags the aspects required to craft this
|
||||
*/
|
||||
public static CrucibleRecipe addCrucibleRecipe(String key, ItemStack result, Object catalyst, AspectList tags)
|
||||
{
|
||||
|
@ -262,13 +257,13 @@ public class ThaumcraftApi
|
|||
*/
|
||||
public static CrucibleRecipe getCrucibleRecipe(ItemStack stack)
|
||||
{
|
||||
for (Object r: getCraftingRecipes())
|
||||
for (Object r : getCraftingRecipes())
|
||||
{
|
||||
if (r instanceof CrucibleRecipe)
|
||||
{
|
||||
if (((CrucibleRecipe)r).recipeOutput.isItemEqual(stack))
|
||||
if (((CrucibleRecipe) r).recipeOutput.isItemEqual(stack))
|
||||
{
|
||||
return (CrucibleRecipe)r;
|
||||
return (CrucibleRecipe) r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -278,13 +273,15 @@ public class ThaumcraftApi
|
|||
|
||||
/**
|
||||
* Used by the thaumonomicon drilldown feature.
|
||||
*
|
||||
* @param stack the item
|
||||
* @return the thaumcraft recipe key that produces that item.
|
||||
*/
|
||||
private static HashMap<int[], Object[]> keyCache = new HashMap<int[], Object[]>();
|
||||
private static HashMap<int[],Object[]> keyCache = new HashMap<int[],Object[]>();
|
||||
|
||||
public static Object[] getCraftingRecipeKey(EntityPlayer player, ItemStack stack)
|
||||
{
|
||||
int[] key = new int[] {stack.itemID, stack.getItemDamage()};
|
||||
int[] key = new int[]{stack.itemID, stack.getItemDamage()};
|
||||
|
||||
if (keyCache.containsKey(key))
|
||||
{
|
||||
|
@ -293,19 +290,18 @@ public class ThaumcraftApi
|
|||
return null;
|
||||
}
|
||||
|
||||
if (ThaumcraftApiHelper.isResearchComplete(player.username, (String)(keyCache.get(key))[0]))
|
||||
if (ThaumcraftApiHelper.isResearchComplete(player.username, (String) (keyCache.get(key))[0]))
|
||||
{
|
||||
return keyCache.get(key);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
for (ResearchCategoryList rcl: ResearchCategories.researchCategories.values())
|
||||
for (ResearchCategoryList rcl : ResearchCategories.researchCategories.values())
|
||||
{
|
||||
for (ResearchItem ri: rcl.research.values())
|
||||
for (ResearchItem ri : rcl.research.values())
|
||||
{
|
||||
if (ri.getPages() == null)
|
||||
{
|
||||
|
@ -318,10 +314,10 @@ public class ThaumcraftApi
|
|||
|
||||
if (page.recipeOutput != null && stack != null && page.recipeOutput.isItemEqual(stack))
|
||||
{
|
||||
keyCache.put(key, new Object[] {ri.key, a});
|
||||
keyCache.put(key, new Object[]{ri.key, a});
|
||||
|
||||
if (ThaumcraftApiHelper.isResearchComplete(player.username, ri.key))
|
||||
return new Object[] {ri.key, a};
|
||||
return new Object[]{ri.key, a};
|
||||
else
|
||||
{
|
||||
return null;
|
||||
|
@ -337,10 +333,11 @@ public class ThaumcraftApi
|
|||
|
||||
//ASPECTS////////////////////////////////////////
|
||||
|
||||
public static ConcurrentHashMap<List, AspectList> objectTags = new ConcurrentHashMap<List, AspectList>();
|
||||
public static ConcurrentHashMap<List,AspectList> objectTags = new ConcurrentHashMap<List,AspectList>();
|
||||
|
||||
/**
|
||||
* Checks to see if the passed item/block already has aspects associated with it.
|
||||
*
|
||||
* @param id
|
||||
* @param meta
|
||||
* @return
|
||||
|
@ -377,8 +374,9 @@ public class ThaumcraftApi
|
|||
/**
|
||||
* Used to assign apsects to the given item/block. Here is an example of the declaration for cobblestone:<p>
|
||||
* <i>ThaumcraftApi.registerObjectTag(Block.cobblestone.blockID, -1, (new ObjectTags()).add(EnumTag.ROCK, 1).add(EnumTag.DESTRUCTION, 1));</i>
|
||||
*
|
||||
* @param id
|
||||
* @param meta pass -1 if all damage values of this item/block should have the same aspects
|
||||
* @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)
|
||||
|
@ -394,8 +392,9 @@ public class ThaumcraftApi
|
|||
/**
|
||||
* Used to assign apsects to the given item/block. Here is an example of the declaration for cobblestone:<p>
|
||||
* <i>ThaumcraftApi.registerObjectTag(Block.cobblestone.blockID, new int[]{0,1}, (new ObjectTags()).add(EnumTag.ROCK, 1).add(EnumTag.DESTRUCTION, 1));</i>
|
||||
*
|
||||
* @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 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)
|
||||
|
@ -410,6 +409,7 @@ public class ThaumcraftApi
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
@ -424,7 +424,7 @@ public class ThaumcraftApi
|
|||
|
||||
if (ores != null && ores.size() > 0)
|
||||
{
|
||||
for (ItemStack ore: ores)
|
||||
for (ItemStack ore : ores)
|
||||
{
|
||||
int d = ore.getItemDamage();
|
||||
|
||||
|
@ -443,8 +443,9 @@ public class ThaumcraftApi
|
|||
* Attempts to automatically generate aspect tags by checking registered recipes.
|
||||
* Here is an example of the declaration for pistons:<p>
|
||||
* <i>ThaumcraftApi.registerComplexObjectTag(Block.pistonBase.blockID, 0, (new ObjectTags()).add(EnumTag.MECHANISM, 2).add(EnumTag.MOTION, 4));</i>
|
||||
*
|
||||
* @param id
|
||||
* @param meta pass -1 if all damage values of this item/block should have the same aspects
|
||||
* @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)
|
||||
|
@ -455,19 +456,18 @@ public class ThaumcraftApi
|
|||
|
||||
if (tmp != null && tmp.size() > 0)
|
||||
{
|
||||
for (Aspect tag: tmp.getAspects())
|
||||
for (Aspect tag : tmp.getAspects())
|
||||
{
|
||||
aspects.add(tag, tmp.getAmount(tag));
|
||||
}
|
||||
}
|
||||
|
||||
registerObjectTag(id, meta, aspects);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
AspectList tmp = ThaumcraftApiHelper.getObjectAspects(new ItemStack(id, 1, meta));
|
||||
|
||||
for (Aspect tag: aspects.getAspects())
|
||||
for (Aspect tag : aspects.getAspects())
|
||||
{
|
||||
tmp.merge(tag, tmp.getAmount(tag));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue