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:
Fenn 2014-01-17 21:05:38 +00:00
parent 8601e9faff
commit e3644f2d2b
304 changed files with 3941 additions and 5108 deletions

View file

@ -4,16 +4,13 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
* Equipped head slot items that extend this class will be able to perform most functions that
* goggles of revealing can apart from view nodes which is handled by IRevealer.
*
* <p/>
* Equipped head slot items that extend this class will be able to perform most functions that
* goggles of revealing can apart from view nodes which is handled by IRevealer.
*/
public interface IGoggles
{
public interface IGoggles {
/*
* If this method returns true things like block essentia contents will be shown.
*/

View file

@ -2,9 +2,8 @@ package thaumcraft.api;
/**
* @author Azanor
* Items, armor and tools with this interface can receive the Repair enchantment.
* Repairs 1 point of durability every 10 seconds (2 for repair II)
* Items, armor and tools with this interface can receive the Repair enchantment.
* Repairs 1 point of durability every 10 seconds (2 for repair II)
*/
public interface IRepairable
{
public interface IRepairable {
}

View file

@ -5,10 +5,9 @@ import net.minecraft.item.ItemStack;
/**
* @author Azanor
* Items, armor and tools with this interface can receive the Repair enchantment.
* Repairs 1 point of durability every 10 seconds (2 for repair II)
* Items, armor and tools with this interface can receive the Repair enchantment.
* Repairs 1 point of durability every 10 seconds (2 for repair II)
*/
public interface IRepairableExtended extends IRepairable
{
public interface IRepairableExtended extends IRepairable {
public boolean doRepair(ItemStack stack, EntityPlayer player, int enchantlevel);
}

View file

@ -2,11 +2,10 @@ package thaumcraft.api;
/**
* @author Azanor
* ItemArmor with this interface will grant a discount to the vis cost of actions the wearer performs with casting wands.
* The amount returned is the percentage by which the cost is discounted. There is a built-int max discount of 50%, but
* individual items really shouldn't have a discount more than 5%
* ItemArmor with this interface will grant a discount to the vis cost of actions the wearer performs with casting wands.
* The amount returned is the percentage by which the cost is discounted. There is a built-int max discount of 50%, but
* individual items really shouldn't have a discount more than 5%
*/
public interface IVisDiscounter
{
public interface IVisDiscounter {
int getVisDiscount();
}

View file

@ -1,20 +1,18 @@
package thaumcraft.api;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.FMLLog;
/**
* @author Azanor
*
* This is used to gain access to the items in my mod.
* I only give some examples and it will probably still
* require a bit of work for you to get hold of everything you need.
*
* <p/>
* This is used to gain access to the items in my mod.
* I only give some examples and it will probably still
* require a bit of work for you to get hold of everything you need.
*/
public class ItemApi
{
public class ItemApi {
public static ItemStack getItem(String itemString, int meta)
{
ItemStack item = null;
@ -27,13 +25,11 @@ public class ItemApi
if (obj instanceof Item)
{
item = new ItemStack((Item) obj, 1, meta);
}
else if (obj instanceof ItemStack)
} else if (obj instanceof ItemStack)
{
item = (ItemStack) obj;
}
}
catch (Exception ex)
} catch (Exception ex)
{
FMLLog.warning("[Thaumcraft] Could not retrieve item identified by: " + itemString);
}
@ -53,13 +49,11 @@ public class ItemApi
if (obj instanceof Block)
{
item = new ItemStack((Block) obj, 1, meta);
}
else if (obj instanceof ItemStack)
} else if (obj instanceof ItemStack)
{
item = (ItemStack) obj;
}
}
catch (Exception ex)
} catch (Exception ex)
{
FMLLog.warning("[Thaumcraft] Could not retrieve block identified by: " + itemString);
}

View file

@ -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));
}

View file

@ -1,8 +1,6 @@
package thaumcraft.api;
import java.lang.reflect.Method;
import java.util.HashMap;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
@ -12,15 +10,16 @@ import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.aspects.IEssentiaTransport;
import cpw.mods.fml.common.FMLLog;
public class ThaumcraftApiHelper
{
import java.lang.reflect.Method;
import java.util.HashMap;
public class ThaumcraftApiHelper {
public static AspectList cullTags(AspectList temp)
{
AspectList temp2 = new AspectList();
for (Aspect tag: temp.getAspects())
for (Aspect tag : temp.getAspects())
{
if (tag != null)
{
@ -33,7 +32,7 @@ public class ThaumcraftApiHelper
Aspect lowest = null;
int low = Integer.MAX_VALUE;
for (Aspect tag: temp2.getAspects())
for (Aspect tag : temp2.getAspects())
{
if (tag == null)
{
@ -58,8 +57,7 @@ public class ThaumcraftApiHelper
if (s1.isItemStackDamageable() && s2.isItemStackDamageable())
{
return s1.itemID == s2.itemID;
}
else
} else
{
return s1.itemID == s2.itemID && s1.getItemDamage() == s2.getItemDamage();
}
@ -69,6 +67,7 @@ public class ThaumcraftApiHelper
static Method getObjectTags;
static Method getBonusTags;
static Method generateTags;
public static boolean isResearchComplete(String username, String researchkey)
{
boolean ot = false;
@ -82,8 +81,7 @@ public class ThaumcraftApiHelper
}
ot = (Boolean) isResearchComplete.invoke(null, username, researchkey);
}
catch (Exception ex)
} catch (Exception ex)
{
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.research.ResearchManager method isResearchComplete");
}
@ -100,8 +98,7 @@ public class ThaumcraftApiHelper
Class fake = Class.forName("thaumcraft.common.tiles.TileMagicWorkbench");
Method getStackInRowAndColumn = fake.getMethod("getStackInRowAndColumn", int.class, int.class);
ot = (ItemStack) getStackInRowAndColumn.invoke(instance, row, column);
}
catch (Exception ex)
} catch (Exception ex)
{
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.tiles.TileMagicWorkbench method getStackInRowAndColumn");
}
@ -122,8 +119,7 @@ public class ThaumcraftApiHelper
}
ot = (AspectList) getObjectTags.invoke(null, is);
}
catch (Exception ex)
} catch (Exception ex)
{
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.ThaumcraftCraftingManager method getObjectTags");
}
@ -142,8 +138,7 @@ public class ThaumcraftApiHelper
}
ot = (AspectList) getBonusTags.invoke(null, is, ot);
}
catch (Exception ex)
} catch (Exception ex)
{
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.ThaumcraftCraftingManager method getBonusTags");
}
@ -162,8 +157,7 @@ public class ThaumcraftApiHelper
}
return (AspectList) generateTags.invoke(null, id, meta);
}
catch (Exception ex)
} catch (Exception ex)
{
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.ThaumcraftCraftingManager method generateTags");
}
@ -201,11 +195,10 @@ public class ThaumcraftApiHelper
{
TileEntity te = world.getBlockTileEntity(x + face.offsetX, y + face.offsetY, z + face.offsetZ);
if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite()))
if (te instanceof IEssentiaTransport && ((IEssentiaTransport) te).isConnectable(face.getOpposite()))
{
return te;
}
else
} else
{
return null;
}
@ -215,18 +208,17 @@ public class ThaumcraftApiHelper
{
TileEntity te = world.getBlockTileEntity(x + face.offsetX, y + face.offsetY, z + face.offsetZ);
if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite()))
if (te instanceof IEssentiaTransport && ((IEssentiaTransport) te).isConnectable(face.getOpposite()))
{
return te;
}
else
} else
{
return null;
}
}
private static HashMap<Integer, AspectList> allAspects = new HashMap<Integer, AspectList>();
private static HashMap<Integer, AspectList> allCompoundAspects = new HashMap<Integer, AspectList>();
private static HashMap<Integer,AspectList> allAspects = new HashMap<Integer,AspectList>();
private static HashMap<Integer,AspectList> allCompoundAspects = new HashMap<Integer,AspectList>();
public static AspectList getAllAspects(int amount)
{
@ -234,7 +226,7 @@ public class ThaumcraftApiHelper
{
AspectList al = new AspectList();
for (Aspect aspect: Aspect.aspects.values())
for (Aspect aspect : Aspect.aspects.values())
{
al.add(aspect, amount);
}
@ -251,7 +243,7 @@ public class ThaumcraftApiHelper
{
AspectList al = new AspectList();
for (Aspect aspect: Aspect.getCompoundAspects())
for (Aspect aspect : Aspect.getCompoundAspects())
{
al.add(aspect, amount);
}

View file

@ -1,16 +1,14 @@
package thaumcraft.api.aspects;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.apache.commons.lang3.text.WordUtils;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.apache.commons.lang3.text.WordUtils;
public class Aspect
{
public class Aspect {
String tag;
Aspect[] components;
int color;
@ -20,11 +18,12 @@ public class Aspect
/**
* Use this constructor to register your own aspects.
* @param tag the key that will be used to reference this aspect, as well as its latin display name
* @param color color to display the tag in
*
* @param tag the key that will be used to reference this aspect, as well as its latin display name
* @param color color to display the tag in
* @param components the aspects this one is formed from
* @param image ResourceLocation pointing to a 32x32 icon of the aspect
* @param blend GL11 blendmode (1 or 771). Used for rendering nodes. Default is 1
* @param image ResourceLocation pointing to a 32x32 icon of the aspect
* @param blend GL11 blendmode (1 or 771). Used for rendering nodes. Default is 1
*/
public Aspect(String tag, int color, Aspect[] components, ResourceLocation image, int blend)
{
@ -63,7 +62,7 @@ public class Aspect
*/
public Aspect(String tag, int color, String chatcolor, int blend)
{
this(tag, color, (Aspect[])null, blend);
this(tag, color, (Aspect[]) null, blend);
this.setChatcolor(chatcolor);
}
@ -133,7 +132,7 @@ public class Aspect
ArrayList<Aspect> primals = new ArrayList<Aspect>();
Collection<Aspect> pa = aspects.values();
for (Aspect aspect: pa)
for (Aspect aspect : pa)
{
if (aspect.isPrimal())
{
@ -149,7 +148,7 @@ public class Aspect
ArrayList<Aspect> compounds = new ArrayList<Aspect>();
Collection<Aspect> pa = aspects.values();
for (Aspect aspect: pa)
for (Aspect aspect : pa)
{
if (!aspect.isPrimal())
{
@ -171,7 +170,7 @@ public class Aspect
}
///////////////////////////////
public static LinkedHashMap<String, Aspect> aspects = new LinkedHashMap<String, Aspect>();
public static LinkedHashMap<String,Aspect> aspects = new LinkedHashMap<String,Aspect>();
//PRIMAL
public static final Aspect AIR = new Aspect("aer", 0xffff7e, "e", 1);
@ -182,59 +181,59 @@ public class Aspect
public static final Aspect ENTROPY = new Aspect("perditio", 0x404040, "8", 771);
//SECONDARY TODO
public static final Aspect VOID = new Aspect("vacuos", 0x888888, new Aspect[] {AIR, ENTROPY}, 771);
public static final Aspect LIGHT = new Aspect("lux", 0xfff663, new Aspect[] {AIR, FIRE});
public static final Aspect ENERGY = new Aspect("potentia", 0xc0ffff, new Aspect[] {ORDER, FIRE});
public static final Aspect MOTION = new Aspect("motus", 0xcdccf4, new Aspect[] {AIR, ORDER});
public static final Aspect STONE = new Aspect("saxum", 0x808080, new Aspect[] {EARTH, EARTH});
public static final Aspect LIFE = new Aspect("victus", 0xde0005, new Aspect[] {WATER, EARTH});
public static final Aspect WEATHER = new Aspect("tempestas", 0xFFFFFF, new Aspect[] {AIR, WATER});
public static final Aspect ICE = new Aspect("gelum", 0xe1ffff, new Aspect[] {WATER, ORDER});
public static final Aspect CRYSTAL = new Aspect("vitreus", 0x80ffff, new Aspect[] {STONE, WATER});
public static final Aspect VOID = new Aspect("vacuos", 0x888888, new Aspect[]{AIR, ENTROPY}, 771);
public static final Aspect LIGHT = new Aspect("lux", 0xfff663, new Aspect[]{AIR, FIRE});
public static final Aspect ENERGY = new Aspect("potentia", 0xc0ffff, new Aspect[]{ORDER, FIRE});
public static final Aspect MOTION = new Aspect("motus", 0xcdccf4, new Aspect[]{AIR, ORDER});
public static final Aspect STONE = new Aspect("saxum", 0x808080, new Aspect[]{EARTH, EARTH});
public static final Aspect LIFE = new Aspect("victus", 0xde0005, new Aspect[]{WATER, EARTH});
public static final Aspect WEATHER = new Aspect("tempestas", 0xFFFFFF, new Aspect[]{AIR, WATER});
public static final Aspect ICE = new Aspect("gelum", 0xe1ffff, new Aspect[]{WATER, ORDER});
public static final Aspect CRYSTAL = new Aspect("vitreus", 0x80ffff, new Aspect[]{STONE, WATER});
//TERTIARY TODO
public static final Aspect DEATH = new Aspect("mortuus", 0x887788, new Aspect[] {LIFE, ENTROPY});
public static final Aspect FLIGHT = new Aspect("volatus", 0xe7e7d7, new Aspect[] {AIR, MOTION});
public static final Aspect DARKNESS = new Aspect("tenebrae", 0x222222, new Aspect[] {VOID, LIGHT});
public static final Aspect SOUL = new Aspect("spiritus", 0xebebfb, new Aspect[] {LIFE, DEATH});
public static final Aspect HEAL = new Aspect("sano", 0xff2f34, new Aspect[] {LIFE, LIFE});
public static final Aspect DEATH = new Aspect("mortuus", 0x887788, new Aspect[]{LIFE, ENTROPY});
public static final Aspect FLIGHT = new Aspect("volatus", 0xe7e7d7, new Aspect[]{AIR, MOTION});
public static final Aspect DARKNESS = new Aspect("tenebrae", 0x222222, new Aspect[]{VOID, LIGHT});
public static final Aspect SOUL = new Aspect("spiritus", 0xebebfb, new Aspect[]{LIFE, DEATH});
public static final Aspect HEAL = new Aspect("sano", 0xff2f34, new Aspect[]{LIFE, LIFE});
public static final Aspect TRAVEL = new Aspect("iter", 0xe0585b, new Aspect[] {MOTION, EARTH});
public static final Aspect POISON = new Aspect("venenum", 0x89f000, new Aspect[] {WATER, DEATH});
public static final Aspect TRAVEL = new Aspect("iter", 0xe0585b, new Aspect[]{MOTION, EARTH});
public static final Aspect POISON = new Aspect("venenum", 0x89f000, new Aspect[]{WATER, DEATH});
public static final Aspect ELDRITCH = new Aspect("alienis", 0x805080, new Aspect[] {VOID, DARKNESS});
public static final Aspect MAGIC = new Aspect("praecantatio", 0x9700c0, new Aspect[] {VOID, ENERGY});
public static final Aspect AURA = new Aspect("auram", 0xffc0ff, new Aspect[] {MAGIC, AIR});
public static final Aspect TAINT = new Aspect("vitium", 0x800080, new Aspect[] {MAGIC, ENTROPY});
public static final Aspect ELDRITCH = new Aspect("alienis", 0x805080, new Aspect[]{VOID, DARKNESS});
public static final Aspect MAGIC = new Aspect("praecantatio", 0x9700c0, new Aspect[]{VOID, ENERGY});
public static final Aspect AURA = new Aspect("auram", 0xffc0ff, new Aspect[]{MAGIC, AIR});
public static final Aspect TAINT = new Aspect("vitium", 0x800080, new Aspect[]{MAGIC, ENTROPY});
public static final Aspect SEED = new Aspect("granum", 0xeea16e, new Aspect[] {LIFE, EARTH});
public static final Aspect SLIME = new Aspect("limus", 0x01f800, new Aspect[] {LIFE, WATER});
public static final Aspect PLANT = new Aspect("herba", 0x01ac00, new Aspect[] {SEED, EARTH});
public static final Aspect TREE = new Aspect("arbor", 0x876531, new Aspect[] {EARTH, PLANT});
public static final Aspect SEED = new Aspect("granum", 0xeea16e, new Aspect[]{LIFE, EARTH});
public static final Aspect SLIME = new Aspect("limus", 0x01f800, new Aspect[]{LIFE, WATER});
public static final Aspect PLANT = new Aspect("herba", 0x01ac00, new Aspect[]{SEED, EARTH});
public static final Aspect TREE = new Aspect("arbor", 0x876531, new Aspect[]{EARTH, PLANT});
public static final Aspect BEAST = new Aspect("bestia", 0x9f6409, new Aspect[] {MOTION, LIFE});
public static final Aspect FLESH = new Aspect("corpus", 0xee478d, new Aspect[] {DEATH, BEAST});
public static final Aspect UNDEAD = new Aspect("exanimis", 0x3a4000, new Aspect[] {MOTION, DEATH});
public static final Aspect MIND = new Aspect("cognitio", 0xffc2b3, new Aspect[] {EARTH, SOUL});
public static final Aspect SENSES = new Aspect("sensus", 0x0fd9ff, new Aspect[] {AIR, SOUL});
public static final Aspect BEAST = new Aspect("bestia", 0x9f6409, new Aspect[]{MOTION, LIFE});
public static final Aspect FLESH = new Aspect("corpus", 0xee478d, new Aspect[]{DEATH, BEAST});
public static final Aspect UNDEAD = new Aspect("exanimis", 0x3a4000, new Aspect[]{MOTION, DEATH});
public static final Aspect MIND = new Aspect("cognitio", 0xffc2b3, new Aspect[]{EARTH, SOUL});
public static final Aspect SENSES = new Aspect("sensus", 0x0fd9ff, new Aspect[]{AIR, SOUL});
public static final Aspect MAN = new Aspect("humanus", 0xffd7c0, new Aspect[] {BEAST, MIND});
public static final Aspect CROP = new Aspect("messis", 0xe1b371, new Aspect[] {SEED, MAN});
public static final Aspect HARVEST = new Aspect("meto", 0xeead82, new Aspect[] {CROP, MAN});
public static final Aspect METAL = new Aspect("metallum", 0xb5b5cd, new Aspect[] {STONE, ORDER});
public static final Aspect MINE = new Aspect("perfodio", 0xdcd2d8, new Aspect[] {MAN, STONE});
public static final Aspect TOOL = new Aspect("instrumentum", 0x4040ee, new Aspect[] {MAN, METAL});
public static final Aspect WEAPON = new Aspect("telum", 0xc05050, new Aspect[] {TOOL, ENTROPY});
public static final Aspect ARMOR = new Aspect("tutamen", 0x00c0c0, new Aspect[] {TOOL, EARTH});
public static final Aspect HUNGER = new Aspect("fames", 0x9a0305, new Aspect[] {LIFE, VOID});
public static final Aspect GREED = new Aspect("lucrum", 0xe6be44, new Aspect[] {MAN, HUNGER});
public static final Aspect CRAFT = new Aspect("fabrico", 0x809d80, new Aspect[] {MAN, TOOL});
public static final Aspect MAN = new Aspect("humanus", 0xffd7c0, new Aspect[]{BEAST, MIND});
public static final Aspect CROP = new Aspect("messis", 0xe1b371, new Aspect[]{SEED, MAN});
public static final Aspect HARVEST = new Aspect("meto", 0xeead82, new Aspect[]{CROP, MAN});
public static final Aspect METAL = new Aspect("metallum", 0xb5b5cd, new Aspect[]{STONE, ORDER});
public static final Aspect MINE = new Aspect("perfodio", 0xdcd2d8, new Aspect[]{MAN, STONE});
public static final Aspect TOOL = new Aspect("instrumentum", 0x4040ee, new Aspect[]{MAN, METAL});
public static final Aspect WEAPON = new Aspect("telum", 0xc05050, new Aspect[]{TOOL, ENTROPY});
public static final Aspect ARMOR = new Aspect("tutamen", 0x00c0c0, new Aspect[]{TOOL, EARTH});
public static final Aspect HUNGER = new Aspect("fames", 0x9a0305, new Aspect[]{LIFE, VOID});
public static final Aspect GREED = new Aspect("lucrum", 0xe6be44, new Aspect[]{MAN, HUNGER});
public static final Aspect CRAFT = new Aspect("fabrico", 0x809d80, new Aspect[]{MAN, TOOL});
public static final Aspect CLOTH = new Aspect("pannus", 0xeaeac2, new Aspect[] {TOOL, BEAST});
public static final Aspect MECHANISM = new Aspect("machina", 0x8080a0, new Aspect[] {MOTION, TOOL});
public static final Aspect TRAP = new Aspect("vinculum", 0x9a8080, new Aspect[] {MOTION, ENTROPY});
public static final Aspect EXCHANGE = new Aspect("permutatio", 0x578357, new Aspect[] {MOTION, WATER});
public static final Aspect CLOTH = new Aspect("pannus", 0xeaeac2, new Aspect[]{TOOL, BEAST});
public static final Aspect MECHANISM = new Aspect("machina", 0x8080a0, new Aspect[]{MOTION, TOOL});
public static final Aspect TRAP = new Aspect("vinculum", 0x9a8080, new Aspect[]{MOTION, ENTROPY});
public static final Aspect EXCHANGE = new Aspect("permutatio", 0x578357, new Aspect[]{MOTION, WATER});
// public static final Aspect LAVA = new Aspect("lava",0xe85729, new Aspect[] {EARTH, FIRE});
// public static final Aspect STEAM = new Aspect("steam",0xFFFFFF, new Aspect[] {WATER, FIRE});

View file

@ -1,20 +1,20 @@
package thaumcraft.api.aspects;
import java.io.Serializable;
import java.util.LinkedHashMap;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import thaumcraft.api.ThaumcraftApiHelper;
public class AspectList implements Serializable
{
public LinkedHashMap<Aspect, Integer> aspects = new LinkedHashMap<Aspect, Integer>(); //aspects associated with this object
import java.io.Serializable;
import java.util.LinkedHashMap;
public class AspectList implements Serializable {
public LinkedHashMap<Aspect,Integer> aspects = new LinkedHashMap<Aspect,Integer>(); //aspects associated with this object
/**
* this creates a new aspect list with preloaded values based off the aspects of the given item.
* @param id the item/block id of an existing item
*
* @param id the item/block id of an existing item
* @param meta the damage value of an existing item
*/
public AspectList(int id, int meta)
@ -24,12 +24,13 @@ public class AspectList implements Serializable
AspectList temp = ThaumcraftApiHelper.getObjectAspects(new ItemStack(id, 1, meta));
if (temp != null)
for (Aspect tag: temp.getAspects())
for (Aspect tag : temp.getAspects())
{
add(tag, temp.getAmount(tag));
}
} catch (Exception e)
{
}
catch (Exception e) {}
}
public AspectList()
@ -40,7 +41,7 @@ public class AspectList implements Serializable
{
AspectList out = new AspectList();
for (Aspect a: this.getAspects())
for (Aspect a : this.getAspects())
{
out.add(a, this.getAmount(a));
}
@ -63,7 +64,7 @@ public class AspectList implements Serializable
{
int q = 0;
for (Aspect as: aspects.keySet())
for (Aspect as : aspects.keySet())
{
q += this.getAmount(as);
}
@ -87,7 +88,7 @@ public class AspectList implements Serializable
{
AspectList t = new AspectList();
for (Aspect as: aspects.keySet())
for (Aspect as : aspects.keySet())
{
if (as.isPrimal())
{
@ -169,11 +170,12 @@ public class AspectList implements Serializable
*/
public int getAmount(Aspect key)
{
return aspects.get(key) == null ? 0 : aspects.get(key);
return aspects.get(key) == null ? 0 : aspects.get(key);
}
/**
* Reduces the amount of an aspect in this collection by the given amount.
*
* @param key
* @param amount
* @return
@ -193,6 +195,7 @@ public class AspectList implements Serializable
/**
* Reduces the amount of an aspect in this collection by the given amount.
* If reduced to 0 or less the aspect will be removed completely.
*
* @param key
* @param amount
* @return
@ -204,8 +207,7 @@ public class AspectList implements Serializable
if (am <= 0)
{
aspects.remove(key);
}
else
} else
{
this.aspects.put(key, am);
}
@ -215,6 +217,7 @@ public class AspectList implements Serializable
/**
* Simply removes the aspect from the list
*
* @param key
* @param amount
* @return
@ -228,6 +231,7 @@ public class AspectList implements Serializable
/**
* Adds this aspect and amount to the collection.
* If the aspect exists then its value will be increased by the given amount.
*
* @param aspect
* @param amount
* @return
@ -247,6 +251,7 @@ public class AspectList implements Serializable
/**
* Adds this aspect and amount to the collection.
* If the aspect exists then only the highest of the old or new amount will be used.
*
* @param aspect
* @param amount
* @return
@ -269,6 +274,7 @@ public class AspectList implements Serializable
/**
* Reads the list of aspects from nbt
*
* @param nbttagcompound
* @return
*/
@ -284,13 +290,14 @@ public class AspectList implements Serializable
if (rs.hasKey("key"))
{
add(Aspect.getAspect(rs.getString("key")),
rs.getInteger("amount"));
rs.getInteger("amount"));
}
}
}
/**
* Writes the list of aspects to nbt
*
* @param nbttagcompound
* @return
*/

View file

@ -1,20 +1,19 @@
package thaumcraft.api.aspects;
/**
*
* @author azanor
*
* Used by blocks like the crucible and alembic to hold their aspects.
* Tiles extending this interface will have their aspects show up when viewed by goggles of revealing
*
* <p/>
* Used by blocks like the crucible and alembic to hold their aspects.
* Tiles extending this interface will have their aspects show up when viewed by goggles of revealing
*/
public interface IAspectContainer
{
public interface IAspectContainer {
public AspectList getAspects();
public void setAspects(AspectList aspects);
/**
* This method is used to determine of a specific aspect can be added to this container.
*
* @param tag
* @return true or false
*/
@ -22,6 +21,7 @@ public interface IAspectContainer
/**
* This method is used to add a certain amount of an aspect to the tile entity.
*
* @param tag
* @param amount
* @return the amount of aspect left over that could not be added.
@ -30,6 +30,7 @@ public interface IAspectContainer
/**
* Removes a certain amount of a specific aspect from the tile entity
*
* @param tag
* @param amount
* @return true if that amount of aspect was available and was removed
@ -38,6 +39,7 @@ public interface IAspectContainer
/**
* removes a bunch of different aspects and amounts from the tile entity.
*
* @param ot the ObjectTags object that contains the aspects and their amounts.
* @return true if all the aspects and their amounts were available and successfully removed
*/
@ -45,6 +47,7 @@ public interface IAspectContainer
/**
* Checks if the tile entity contains the listed amount (or more) of the aspect
*
* @param tag
* @param amount
* @return
@ -53,6 +56,7 @@ public interface IAspectContainer
/**
* Checks if the tile entity contains all the listed aspects and their amounts
*
* @param ot the ObjectTags object that contains the aspects and their amounts.
* @return
*/
@ -60,6 +64,7 @@ public interface IAspectContainer
/**
* Returns how much of the aspect this tile entity contains
*
* @param tag
* @return the amount of that aspect found
*/

View file

@ -2,11 +2,9 @@ package thaumcraft.api.aspects;
/**
* @author Azanor
*
* This interface is implemented by tile entites (or possibly anything else) like jars
* so that they can act as an essentia source for blocks like the infusion altar.
*
* <p/>
* This interface is implemented by tile entites (or possibly anything else) like jars
* so that they can act as an essentia source for blocks like the infusion altar.
*/
public interface IAspectSource extends IAspectContainer
{
public interface IAspectSource extends IAspectContainer {
}

View file

@ -1,26 +1,23 @@
package thaumcraft.api.aspects;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
/**
*
* @author azanor
*
* Used by wispy essences and essentia phials to hold their aspects.
* Useful for similar item containers that store their aspect information in nbt form so TC
* automatically picks up the aspects they contain
*
* <p/>
* Used by wispy essences and essentia phials to hold their aspects.
* Useful for similar item containers that store their aspect information in nbt form so TC
* automatically picks up the aspects they contain
*/
public interface IEssentiaContainerItem
{
public interface IEssentiaContainerItem {
public AspectList getAspects(ItemStack itemstack);
public void setAspects(ItemStack itemstack, AspectList aspects);
}
//Example implementation
/*
@Override
@Override
public AspectList getAspects(ItemStack itemstack) {
if (itemstack.hasTagCompound()) {
AspectList aspects = new AspectList();

View file

@ -4,13 +4,13 @@ import net.minecraftforge.common.ForgeDirection;
/**
* @author Azanor
* This interface is used by tiles that use or transport vis.
* Only tiles that implement this interface will be able to connect to vis conduits or other thaumic devices
* This interface is used by tiles that use or transport vis.
* Only tiles that implement this interface will be able to connect to vis conduits or other thaumic devices
*/
public interface IEssentiaTransport
{
public interface IEssentiaTransport {
/**
* Is this tile able to connect to other vis users/sources on the specified side?
*
* @param face
* @return
*/
@ -18,6 +18,7 @@ public interface IEssentiaTransport
/**
* Is this side used to input essentia?
*
* @param face
* @return
*/
@ -25,6 +26,7 @@ public interface IEssentiaTransport
/**
* Is this side used to output essentia?
*
* @param face
* @return
*/
@ -44,26 +46,29 @@ public interface IEssentiaTransport
/**
* Sets the amount of suction this block will apply
*
* @param suction
*/
public void setSuction(AspectList suction);
/**
* Sets the amount of suction this block will apply
*
* @param suction
*/
public void setSuction(Aspect aspect, int amount);
/**
* Returns the amount of suction this block is applying.
* @param loc
* the location from where the suction is being checked
*
* @param loc the location from where the suction is being checked
* @return
*/
public AspectList getSuction(ForgeDirection face);
/**
* remove the specified amount of vis from this transport tile
*
* @param suction
* @return how much was actually taken
*/
@ -73,6 +78,7 @@ public interface IEssentiaTransport
/**
* Essentia will not be drawn from this container unless the suction exceeds this amount.
*
* @return the amount
*/
public int getMinimumSuction();
@ -80,6 +86,7 @@ public interface IEssentiaTransport
/**
* Return true if you want the conduit to extend a little further into the block.
* Used by jars and alembics that have smaller than normal hitboxes
*
* @return
*/
boolean renderExtendedTube();

View file

@ -1,15 +1,14 @@
package thaumcraft.api.crafting;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
public class CrucibleRecipe
{
import java.util.ArrayList;
public class CrucibleRecipe {
public ItemStack recipeOutput;
public Object catalyst;
public AspectList aspects;
@ -34,10 +33,10 @@ public class CrucibleRecipe
!ThaumcraftApiHelper.itemMatches((ItemStack) catalyst, cat, false))
{
return false;
}
else if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size() > 0)
} else if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>) catalyst).size() > 0)
{
if (!ThaumcraftApiHelper.containsMatch(true, ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[] {}), cat)) return false;
if (!ThaumcraftApiHelper.containsMatch(true, ((ArrayList<ItemStack>) catalyst).toArray(new ItemStack[]{}), cat))
return false;
}
if (itags == null)
@ -45,7 +44,7 @@ public class CrucibleRecipe
return false;
}
for (Aspect tag: aspects.getAspects())
for (Aspect tag : aspects.getAspects())
{
if (itags.getAmount(tag) < aspects.getAmount(tag))
{
@ -61,7 +60,7 @@ public class CrucibleRecipe
AspectList temptags = new AspectList();
temptags.aspects.putAll(itags.aspects);
for (Aspect tag: aspects.getAspects())
for (Aspect tag : aspects.getAspects())
{
temptags.remove(tag, aspects.getAmount(tag));
// if (!temptags.remove(tag, aspects.getAmount(tag))) return null;

View file

@ -6,10 +6,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import thaumcraft.api.aspects.AspectList;
public interface IArcaneRecipe
{
public interface IArcaneRecipe {
/**
* Used to check if a recipe matches current crafting inventory
*
* @param player
*/
boolean matches(IInventory var1, World world, EntityPlayer player);
@ -25,6 +25,8 @@ public interface IArcaneRecipe
int getRecipeSize();
ItemStack getRecipeOutput();
AspectList getAspects();
String getResearch();
}

View file

@ -1,9 +1,5 @@
package thaumcraft.api.crafting;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
@ -13,8 +9,11 @@ import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.AspectList;
public class InfusionEnchantmentRecipe
{
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
public class InfusionEnchantmentRecipe {
public AspectList aspects;
public String research;
public ItemStack[] components;
@ -35,6 +34,7 @@ public class InfusionEnchantmentRecipe
/**
* Used to check if a recipe matches current crafting inventory
*
* @param player
*/
public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player)
@ -54,7 +54,7 @@ public class InfusionEnchantmentRecipe
while (iterator.hasNext())
{
int j1 = ((Integer)iterator.next()).intValue();
int j1 = ((Integer) iterator.next()).intValue();
Enchantment ench = Enchantment.enchantmentsList[j1];
if (j1 == enchantment.effectId &&
@ -65,7 +65,7 @@ public class InfusionEnchantmentRecipe
if (enchantment.effectId != ench.effectId &&
(!enchantment.canApplyTogether(ench) ||
!ench.canApplyTogether(enchantment)))
!ench.canApplyTogether(enchantment)))
{
return false;
}
@ -74,12 +74,12 @@ public class InfusionEnchantmentRecipe
ItemStack i2 = null;
ArrayList<ItemStack> ii = new ArrayList<ItemStack>();
for (ItemStack is: input)
for (ItemStack is : input)
{
ii.add(is.copy());
}
for (ItemStack comp: components)
for (ItemStack comp : components)
{
boolean b = false;
@ -136,13 +136,12 @@ public class InfusionEnchantmentRecipe
if (od != -1)
{
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[] {});
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[] {stack1}, ores))
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
return true;
}
}
else
} else
{
t1 = ItemStack.areItemStackTagsEqual(stack0, stack1);
}
@ -173,7 +172,7 @@ public class InfusionEnchantmentRecipe
while (iterator.hasNext())
{
int j1 = ((Integer)iterator.next()).intValue();
int j1 = ((Integer) iterator.next()).intValue();
i += EnchantmentHelper.getEnchantmentLevel(j1, recipeInput);
}
@ -193,7 +192,7 @@ public class InfusionEnchantmentRecipe
while (iterator.hasNext())
{
int j1 = ((Integer)iterator.next()).intValue();
int j1 = ((Integer) iterator.next()).intValue();
if (j1 != enchantment.effectId)
{

View file

@ -1,7 +1,5 @@
package thaumcraft.api.crafting;
import java.util.ArrayList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@ -9,8 +7,9 @@ import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.AspectList;
public class InfusionRecipe
{
import java.util.ArrayList;
public class InfusionRecipe {
public AspectList aspects;
public String research;
public ItemStack[] components;
@ -31,6 +30,7 @@ public class InfusionRecipe
/**
* Used to check if a recipe matches current crafting inventory
*
* @param player
*/
public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player)
@ -54,12 +54,12 @@ public class InfusionRecipe
ArrayList<ItemStack> ii = new ArrayList<ItemStack>();
for (ItemStack is: input)
for (ItemStack is : input)
{
ii.add(is.copy());
}
for (ItemStack comp: components)
for (ItemStack comp : components)
{
boolean b = false;
@ -116,13 +116,12 @@ public class InfusionRecipe
if (od != -1)
{
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[] {});
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[] {stack1}, ores))
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
return true;
}
}
else
} else
{
t1 = ItemStack.areItemStackTagsEqual(stack0, stack1);
}

View file

@ -1,12 +1,8 @@
package thaumcraft.api.crafting;
import java.util.ArrayList;
import java.util.HashMap;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@ -14,28 +10,32 @@ import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.AspectList;
public class ShapedArcaneRecipe implements IArcaneRecipe
{
import java.util.ArrayList;
import java.util.HashMap;
public class ShapedArcaneRecipe implements IArcaneRecipe {
//Added in for future ease of change, but hard coded for now.
private static final int MAX_CRAFT_GRID_WIDTH = 3;
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
public ItemStack output = null;
public Object[] input = null;
public Object[] input = null;
public AspectList aspects = null;
public String research;
public int width = 0;
public int height = 0;
private boolean mirrored = true;
public ShapedArcaneRecipe(String research, Block result, AspectList aspects, Object... recipe)
public ShapedArcaneRecipe(String research, Block result, AspectList aspects, Object... recipe)
{
this(research, new ItemStack(result), aspects, recipe);
}
public ShapedArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe)
public ShapedArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe)
{
this(research, new ItemStack(result), aspects, recipe);
}
public ShapedArcaneRecipe(String research, ItemStack result, AspectList aspects, Object... recipe)
{
output = result.copy();
@ -46,13 +46,12 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
if (recipe[idx] instanceof Boolean)
{
mirrored = (Boolean)recipe[idx];
mirrored = (Boolean) recipe[idx];
if (recipe[idx + 1] instanceof Object[])
{
recipe = (Object[])recipe[idx + 1];
}
else
recipe = (Object[]) recipe[idx + 1];
} else
{
idx = 1;
}
@ -60,7 +59,7 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
if (recipe[idx] instanceof String[])
{
String[] parts = ((String[])recipe[idx++]);
String[] parts = ((String[]) recipe[idx++]);
for (String s : parts)
{
@ -69,12 +68,11 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
}
height = parts.length;
}
else
} else
{
while (recipe[idx] instanceof String)
{
String s = (String)recipe[idx++];
String s = (String) recipe[idx++];
shape += s;
width = s.length();
height++;
@ -85,7 +83,7 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
{
String ret = "Invalid shaped ore recipe: ";
for (Object tmp : recipe)
for (Object tmp : recipe)
{
ret += tmp + ", ";
}
@ -94,34 +92,30 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
throw new RuntimeException(ret);
}
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
HashMap<Character,Object> itemMap = new HashMap<Character,Object>();
for (; idx < recipe.length; idx += 2)
{
Character chr = (Character)recipe[idx];
Character chr = (Character) recipe[idx];
Object in = recipe[idx + 1];
if (in instanceof ItemStack)
{
itemMap.put(chr, ((ItemStack)in).copy());
}
else if (in instanceof Item)
itemMap.put(chr, ((ItemStack) in).copy());
} else if (in instanceof Item)
{
itemMap.put(chr, new ItemStack((Item)in));
}
else if (in instanceof Block)
itemMap.put(chr, new ItemStack((Item) in));
} else if (in instanceof Block)
{
itemMap.put(chr, new ItemStack((Block)in, 1, OreDictionary.WILDCARD_VALUE));
}
else if (in instanceof String)
itemMap.put(chr, new ItemStack((Block) in, 1, OreDictionary.WILDCARD_VALUE));
} else if (in instanceof String)
{
itemMap.put(chr, OreDictionary.getOres((String)in));
}
else
itemMap.put(chr, OreDictionary.getOres((String) in));
} else
{
String ret = "Invalid shaped ore recipe: ";
for (Object tmp : recipe)
for (Object tmp : recipe)
{
ret += tmp + ", ";
}
@ -200,8 +194,7 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
if (mirror)
{
target = input[width - subX - 1 + subY * width];
}
else
} else
{
target = input[subX + subY * width];
}
@ -211,16 +204,15 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
if (target instanceof ItemStack)
{
if (!checkItemEquals((ItemStack)target, slot))
if (!checkItemEquals((ItemStack) target, slot))
{
return false;
}
}
else if (target instanceof ArrayList)
} else if (target instanceof ArrayList)
{
boolean matched = false;
for (ItemStack item : (ArrayList<ItemStack>)target)
for (ItemStack item : (ArrayList<ItemStack>) target)
{
matched = matched || checkItemEquals(item, slot);
}
@ -229,8 +221,7 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
{
return false;
}
}
else if (target == null && slot != null)
} else if (target == null && slot != null)
{
return false;
}
@ -261,6 +252,7 @@ public class ShapedArcaneRecipe implements IArcaneRecipe
/**
* Returns the input for this recipe, any mod accessing this value should never
* manipulate the values in this array as it will effect the recipe itself.
*
* @return The recipes input vales.
*/
public Object[] getInput()

View file

@ -1,8 +1,5 @@
package thaumcraft.api.crafting;
import java.util.ArrayList;
import java.util.Iterator;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
@ -13,8 +10,10 @@ import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.AspectList;
public class ShapelessArcaneRecipe implements IArcaneRecipe
{
import java.util.ArrayList;
import java.util.Iterator;
public class ShapelessArcaneRecipe implements IArcaneRecipe {
private ItemStack output = null;
private ArrayList input = new ArrayList();
@ -25,7 +24,8 @@ public class ShapelessArcaneRecipe implements IArcaneRecipe
{
this(research, new ItemStack(result), aspects, recipe);
}
public ShapelessArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe)
public ShapelessArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe)
{
this(research, new ItemStack(result), aspects, recipe);
}
@ -40,25 +40,21 @@ public class ShapelessArcaneRecipe implements IArcaneRecipe
{
if (in instanceof ItemStack)
{
input.add(((ItemStack)in).copy());
}
else if (in instanceof Item)
input.add(((ItemStack) in).copy());
} else if (in instanceof Item)
{
input.add(new ItemStack((Item)in));
}
else if (in instanceof Block)
input.add(new ItemStack((Item) in));
} else if (in instanceof Block)
{
input.add(new ItemStack((Block)in));
}
else if (in instanceof String)
input.add(new ItemStack((Block) in));
} else if (in instanceof String)
{
input.add(OreDictionary.getOres((String)in));
}
else
input.add(OreDictionary.getOres((String) in));
} else
{
String ret = "Invalid shapeless ore recipe: ";
for (Object tmp : recipe)
for (Object tmp : recipe)
{
ret += tmp + ", ";
}
@ -113,11 +109,10 @@ public class ShapelessArcaneRecipe implements IArcaneRecipe
if (next instanceof ItemStack)
{
match = checkItemEquals((ItemStack)next, slot);
}
else if (next instanceof ArrayList)
match = checkItemEquals((ItemStack) next, slot);
} else if (next instanceof ArrayList)
{
for (ItemStack item : (ArrayList<ItemStack>)next)
for (ItemStack item : (ArrayList<ItemStack>) next)
{
match = match || checkItemEquals(item, slot);
}
@ -151,6 +146,7 @@ public class ShapelessArcaneRecipe implements IArcaneRecipe
/**
* Returns the input for this recipe, any mod accessing this value should never
* manipulate the values in this array as it will effect the recipe itself.
*
* @return The recipes input vales.
*/
public ArrayList getInput()

View file

@ -2,46 +2,52 @@ package thaumcraft.api.nodes;
import thaumcraft.api.aspects.IAspectContainer;
public interface INode extends IAspectContainer
{
public interface INode extends IAspectContainer {
/**
* Unique identifier to distinguish nodes. Normal node id's are based on world id and coordinates
*
* @return
*/
public String getId();
/**
* Return the type of node
*
* @return
*/
public NodeType getNodeType();
/**
* Set the type of node
*
* @return
*/
public void setNodeType(NodeType nodeType);
/**
* Return the node modifier
*
* @return
*/
public void setNodeModifier(NodeModifier nodeModifier);
/**
* Set the node modifier
*
* @return
*/
public NodeModifier getNodeModifier();
/**
* Return the maximum capacity of each aspect the node can hold
*
* @return
*/
public int getNodeVisBase();
/**
* Set the maximum capacity of each aspect the node can hold
*
* @return
*/
public void setNodeVisBase(short nodeVisBase);

View file

@ -4,15 +4,12 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
* Equipped head slot items that extend this class will make nodes visible in world.
*
* <p/>
* Equipped head slot items that extend this class will make nodes visible in world.
*/
public interface IRevealer
{
public interface IRevealer {
/*
* If this method returns true the nodes will be visible.
*/

View file

@ -1,6 +1,5 @@
package thaumcraft.api.nodes;
public enum NodeModifier
{
public enum NodeModifier {
BRIGHT, PALE, FADING
}

View file

@ -1,6 +1,5 @@
package thaumcraft.api.nodes;
public enum NodeType
{
public enum NodeType {
NORMAL, UNSTABLE, DARK, TAINTED, HUNGRY, PURE
}

View file

@ -4,7 +4,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface IScanEventHandler
{
public interface IScanEventHandler {
ScanResult scanPhenomena(ItemStack stack, World world, EntityPlayer player);
}

View file

@ -1,15 +1,14 @@
package thaumcraft.api.research;
import java.util.Collection;
import java.util.LinkedHashMap;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
public class ResearchCategories
{
import java.util.Collection;
import java.util.LinkedHashMap;
public class ResearchCategories {
//Research
public static LinkedHashMap <String, ResearchCategoryList> researchCategories = new LinkedHashMap <String, ResearchCategoryList>();
public static LinkedHashMap<String,ResearchCategoryList> researchCategories = new LinkedHashMap<String,ResearchCategoryList>();
/**
* @param key
@ -38,15 +37,15 @@ public class ResearchCategories
{
Collection rc = researchCategories.values();
for (Object cat: rc)
for (Object cat : rc)
{
Collection rl = ((ResearchCategoryList)cat).research.values();
Collection rl = ((ResearchCategoryList) cat).research.values();
for (Object ri: rl)
for (Object ri : rl)
{
if ((((ResearchItem)ri).key).equals(key))
if ((((ResearchItem) ri).key).equals(key))
{
return (ResearchItem)ri;
return (ResearchItem) ri;
}
}
}
@ -55,8 +54,8 @@ public class ResearchCategories
}
/**
* @param key the key used for this category
* @param icon the icon to be used for the research category tab
* @param key the key used for this category
* @param icon the icon to be used for the research category tab
* @param background the resource location of the background image to use for this category
* @return the name of the research linked to this key
*/

View file

@ -1,25 +1,34 @@
package thaumcraft.api.research;
import net.minecraft.util.ResourceLocation;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.util.ResourceLocation;
public class ResearchCategoryList
{
/** Is the smallest column used on the GUI. */
public class ResearchCategoryList {
/**
* Is the smallest column used on the GUI.
*/
public int minDisplayColumn;
/** Is the smallest row used on the GUI. */
/**
* Is the smallest row used on the GUI.
*/
public int minDisplayRow;
/** Is the biggest column used on the GUI. */
/**
* Is the biggest column used on the GUI.
*/
public int maxDisplayColumn;
/** Is the biggest row used on the GUI. */
/**
* Is the biggest row used on the GUI.
*/
public int maxDisplayRow;
/** display variables **/
/**
* display variables *
*/
public ResourceLocation icon;
public ResourceLocation background;
@ -30,5 +39,5 @@ public class ResearchCategoryList
}
//Research
public Map<String, ResearchItem> research = new HashMap<String, ResearchItem>();
public Map<String,ResearchItem> research = new HashMap<String,ResearchItem>();
}

View file

@ -1,15 +1,14 @@
package thaumcraft.api.research;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ResearchItem
{
public class ResearchItem {
/**
* A short string used as a key for this research. Must be unique
*/
@ -322,13 +321,13 @@ public class ResearchItem
int highest = 0;
if (tags != null)
for (Aspect tag: tags.getAspects())
for (Aspect tag : tags.getAspects())
{
if (tags.getAmount(tag) > highest)
{
aspect = tag;
highest = tags.getAmount(tag);
};
} ;
}
return aspect;

View file

@ -1,7 +1,5 @@
package thaumcraft.api.research;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
@ -12,10 +10,10 @@ import thaumcraft.api.crafting.IArcaneRecipe;
import thaumcraft.api.crafting.InfusionEnchantmentRecipe;
import thaumcraft.api.crafting.InfusionRecipe;
public class ResearchPage
{
public static enum PageType
{
import java.util.List;
public class ResearchPage {
public static enum PageType {
TEXT,
TEXT_CONCEALED,
IMAGE,
@ -48,7 +46,7 @@ public class ResearchPage
/**
* @param research this page will only be displayed if the player has discovered this research
* @param text this can (but does not have to) be a reference to a localization variable, not the actual text.
* @param text this can (but does not have to) be a reference to a localization variable, not the actual text.
*/
public ResearchPage(String research, String text)
{
@ -134,8 +132,7 @@ public class ResearchPage
if (recipe.recipeOutput instanceof ItemStack)
{
this.recipeOutput = (ItemStack) recipe.recipeOutput;
}
else
} else
{
this.recipeOutput = recipe.recipeInput;
}
@ -177,6 +174,7 @@ public class ResearchPage
/**
* returns a localized text of the text field (if one exists). Returns the text field itself otherwise.
*
* @return
*/
public String getTranslatedText()

View file

@ -2,8 +2,7 @@ package thaumcraft.api.research;
import net.minecraft.entity.Entity;
public class ScanResult
{
public class ScanResult {
public byte type = 0; //1=blocks,2=entities,3=phenomena
public int blockId;
public int blockMeta;

View file

@ -7,10 +7,8 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import thaumcraft.api.aspects.AspectList;
public interface IWandFocus
{
public enum WandFocusAnimation
{
public interface IWandFocus {
public enum WandFocusAnimation {
WAVE, CHARGE;
}
@ -46,6 +44,7 @@ public interface IWandFocus
/**
* Helper method to determine in what order foci should be iterated through when
* the user presses the 'change focus' keybinding.
*
* @return a string of characters that foci will be sorted against.
* For example AA00 will be placed before FG12
* <br>As a guide build the sort string from two alphanumeric characters followed by

View file

@ -4,14 +4,11 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
*
* @author azanor
*
* Implemented by a class that you wish to be called whenever a wand with this rod performs its
* update tick.
*
* <p/>
* Implemented by a class that you wish to be called whenever a wand with this rod performs its
* update tick.
*/
public interface IWandRodOnUpdate
{
public interface IWandRodOnUpdate {
void onUpdate(ItemStack itemstack, EntityPlayer player);
}

View file

@ -4,8 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface IWandTriggerManager
{
public interface IWandTriggerManager {
public boolean performTrigger(World world, ItemStack wand, EntityPlayer player,
int x, int y, int z, int side, int event);
}

View file

@ -5,15 +5,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
*
* @author azanor
*
* Add this to a tile entity that you wish wands to interact with in some way.
*
* <p/>
* Add this to a tile entity that you wish wands to interact with in some way.
*/
public interface IWandable
{
public interface IWandable {
public int onWandRightClick(World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side, int md);
public ItemStack onWandRightClick(World world, ItemStack wandstack, EntityPlayer player);

View file

@ -1,9 +1,7 @@
package thaumcraft.api.wands;
import java.text.DecimalFormat;
import java.util.List;
import java.util.Map;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
@ -16,11 +14,12 @@ import net.minecraft.world.World;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemFocusBasic extends Item implements IWandFocus
{
import java.text.DecimalFormat;
import java.util.List;
import java.util.Map;
public class ItemFocusBasic extends Item implements IWandFocus {
public ItemFocusBasic(int i)
{
super(i);
@ -59,7 +58,7 @@ public class ItemFocusBasic extends Item implements IWandFocus
{
list.add(StatCollector.translateToLocal(isVisCostPerTick() ? "item.Focus.cost2" : "item.Focus.cost1"));
for (Aspect aspect: al.getAspectsSorted())
for (Aspect aspect : al.getAspectsSorted())
{
DecimalFormat myFormatter = new DecimalFormat("#####.##");
String amount = myFormatter.format(al.getAmount(aspect) / 100f);
@ -122,10 +121,10 @@ public class ItemFocusBasic extends Item implements IWandFocus
@Override
public String getSortingHelper(ItemStack itemstack)
{
Map<Integer, Integer> ench = EnchantmentHelper.getEnchantments(itemstack);
Map<Integer,Integer> ench = EnchantmentHelper.getEnchantments(itemstack);
String out = "";
for (Integer lvl: ench.values())
for (Integer lvl : ench.values())
{
out = out + lvl + "";
}

View file

@ -1,20 +1,19 @@
package thaumcraft.api.wands;
import java.util.LinkedHashMap;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import thaumcraft.api.aspects.Aspect;
import java.util.LinkedHashMap;
import java.util.List;
/**
* This class is used to keep the material information for the various caps.
* It is also used to generate the wand recipes ingame.
* @author Azanor
*
* @author Azanor
*/
public class WandCap
{
public class WandCap {
private String tag;
/**
@ -47,7 +46,7 @@ public class WandCap
*/
ItemStack item;
public static LinkedHashMap<String, WandCap> caps = new LinkedHashMap<String, WandCap>();
public static LinkedHashMap<String,WandCap> caps = new LinkedHashMap<String,WandCap>();
public WandCap(String tag, float discount, ItemStack item, int craftCost)
{

View file

@ -1,20 +1,17 @@
package thaumcraft.api.wands;
import java.util.LinkedHashMap;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import java.util.LinkedHashMap;
/**
*
* @author Azanor
*
* This class is used to keep the material information for the various rods.
* It is also used to generate the wand recipes ingame.
*
* <p/>
* This class is used to keep the material information for the various rods.
* It is also used to generate the wand recipes ingame.
*/
public class WandRod
{
public class WandRod {
private String tag;
/**
@ -48,7 +45,7 @@ public class WandRod
*/
boolean glow;
public static LinkedHashMap<String, WandRod> rods = new LinkedHashMap<String, WandRod>();
public static LinkedHashMap<String,WandRod> rods = new LinkedHashMap<String,WandRod>();
public WandRod(String tag, int capacity, ItemStack item, int craftCost, ResourceLocation texture)
{

View file

@ -1,13 +1,13 @@
package thaumcraft.api.wands;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
/**
* This class serves a similar function to IWandable in that it allows wands to interact
* with object in the world. In this case it is most useful for adding interaction with non-mod
@ -16,25 +16,24 @@ import net.minecraft.world.World;
* crucible from a cauldron
*
* @author azanor
*
*/
public class WandTriggerRegistry
{
public class WandTriggerRegistry {
/**
* Registers an action to perform when a casting wand right clicks on a specific block.
* A manager class needs to be created that implements IWandTriggerManager.
*
* @param manager
* @param event a logical number that you can use to differentiate different events or actions
* @param event a logical number that you can use to differentiate different events or actions
* @param blockid
* @param meta send -1 as a wildcard value for all possible meta values
* @param meta send -1 as a wildcard value for all possible meta values
*/
public static void registerWandBlockTrigger(IWandTriggerManager manager, int event, int blockid, int meta)
{
triggers.put(Arrays.asList(blockid, meta),
Arrays.asList(manager, event));
Arrays.asList(manager, event));
}
private static HashMap<List<Integer>, List> triggers = new HashMap<List<Integer>, List>();
private static HashMap<List<Integer>,List> triggers = new HashMap<List<Integer>,List>();
public static boolean hasTrigger(int blockid, int meta)
{
@ -50,6 +49,7 @@ public class WandTriggerRegistry
/**
* This is called by the onItemUseFirst function in wands.
* Parameters and return value functions like you would expect for that function.
*
* @param world
* @param wand
* @param player