1.7.10 commit of I-still-can't-do-any-branches

This commit is contained in:
WayofTime 2014-06-27 19:43:09 -04:00
parent 6aec0a87ea
commit cabc296b21
763 changed files with 64290 additions and 0 deletions

View file

@ -0,0 +1,22 @@
package thaumcraft.api;
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.
*
*/
public interface IGoggles {
/*
* If this method returns true things like block essentia contents will be shown.
*/
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player);
}

View file

@ -0,0 +1,13 @@
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)
*/
public interface IRepairable {
}

View file

@ -0,0 +1,17 @@
package thaumcraft.api;
import net.minecraft.entity.player.EntityPlayer;
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)
*/
public interface IRepairableExtended extends IRepairable {
public boolean doRepair(ItemStack stack, EntityPlayer player, int enchantlevel);
}

View file

@ -0,0 +1,23 @@
package thaumcraft.api;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
* Armor or bauble slot items that implement this interface can provide runic shielding.
* Recharging, hardening, etc. is handled internally by thaumcraft.
*
*/
public interface IRunicArmor {
/**
* returns how much charge this item can provide. This is the base shielding value - any hardening is stored and calculated internally.
*/
public int getRunicCharge(ItemStack itemstack);
}

View file

@ -0,0 +1,14 @@
package thaumcraft.api;
/**
*
* @author Azanor
*
* Interface used to identify scribing tool items used in research table
*
*/
public interface IScribeTools {
}

View file

@ -0,0 +1,20 @@
package thaumcraft.api;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import thaumcraft.api.aspects.Aspect;
/**
* @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%
*/
public interface IVisDiscountGear {
int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect);
}

View file

@ -0,0 +1,70 @@
package thaumcraft.api;
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.
*
*/
public class ItemApi {
public static ItemStack getItem(String itemString, int meta) {
ItemStack item = null;
try {
String itemClass = "thaumcraft.common.config.ConfigItems";
Object obj = Class.forName(itemClass).getField(itemString).get(null);
if (obj instanceof Item) {
item = new ItemStack((Item) obj,1,meta);
} else if (obj instanceof ItemStack) {
item = (ItemStack) obj;
}
} catch (Exception ex) {
FMLLog.warning("[Thaumcraft] Could not retrieve item identified by: " + itemString);
}
return item;
}
public static ItemStack getBlock(String itemString, int meta) {
ItemStack item = null;
try {
String itemClass = "thaumcraft.common.config.ConfigBlocks";
Object obj = Class.forName(itemClass).getField(itemString).get(null);
if (obj instanceof Block) {
item = new ItemStack((Block) obj,1,meta);
} else if (obj instanceof ItemStack) {
item = (ItemStack) obj;
}
} catch (Exception ex) {
FMLLog.warning("[Thaumcraft] Could not retrieve block identified by: " + itemString);
}
return item;
}
/**
*
* Some examples
*
* Casting Wands:
* itemWandCasting
*
* Resources:
* itemEssence, itemWispEssence, itemResource, itemShard, itemNugget,
* itemNuggetChicken, itemNuggetBeef, itemNuggetPork, itemTripleMeatTreat
*
* Research:
* itemResearchNotes, itemInkwell, itemThaumonomicon
*
*/
}

View file

@ -0,0 +1,21 @@
package thaumcraft.api;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class ItemRunic extends Item implements IRunicArmor {
int charge;
public ItemRunic (int charge)
{
super();
this.charge = charge;
}
@Override
public int getRunicCharge(ItemStack itemstack) {
return charge;
}
}

View file

@ -0,0 +1,469 @@
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.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.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;
/**
* @author Azanor
*
*
* IMPORTANT: If you are adding your own aspects to items it is a good idea to do it AFTER Thaumcraft adds its aspects, otherwise odd things may happen.
*
*/
public class ThaumcraftApi {
//Materials
public static ToolMaterial toolMatThaumium = EnumHelper.addToolMaterial("THAUMIUM", 3, 400, 7F, 2, 22);
public static ToolMaterial toolMatElemental = EnumHelper.addToolMaterial("THAUMIUM_ELEMENTAL", 3, 1500, 10F, 3, 18);
public static ArmorMaterial armorMatThaumium = EnumHelper.addArmorMaterial("THAUMIUM", 25, new int[] { 2, 6, 5, 2 }, 25);
public static ArmorMaterial armorMatSpecial = EnumHelper.addArmorMaterial("SPECIAL", 25, new int[] { 1, 3, 2, 1 }, 25);
//Enchantment references
public static int enchantFrugal;
public static int enchantPotency;
public static int enchantWandFortune;
public static int enchantHaste;
public static int enchantRepair;
//Miscellaneous
/**
* Portable Hole Block-id Blacklist.
* Simply add the block-id's of blocks you don't want the portable hole to go through.
*/
public static ArrayList<Block> portableHoleBlackList = new ArrayList<Block>();
//RESEARCH/////////////////////////////////////////
public static ArrayList<IScanEventHandler> scanEventhandlers = new ArrayList<IScanEventHandler>();
public static ArrayList<EntityTags> scanEntities = new ArrayList<EntityTags>();
public static class EntityTagsNBT {
public EntityTagsNBT(String name, Object value) {
this.name = name;
this.value = value;
}
public String name;
public Object value;
}
public static class EntityTags {
public EntityTags(String entityName, AspectList aspects, EntityTagsNBT... nbts) {
this.entityName = entityName;
this.nbts = nbts;
this.aspects = aspects;
}
public String entityName;
public EntityTagsNBT[] nbts;
public AspectList aspects;
}
/**
* not really working atm, so ignore it for now
* @param scanEventHandler
*/
public static void registerScanEventhandler(IScanEventHandler scanEventHandler) {
scanEventhandlers.add(scanEventHandler);
}
/**
* 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));
*/
public static void registerEntityTag(String entityName, AspectList aspects, EntityTagsNBT... nbt ) {
scanEntities.add(new EntityTags(entityName,aspects,nbt));
}
//RECIPES/////////////////////////////////////////
private static ArrayList craftingRecipes = new ArrayList();
private static HashMap<Object,ItemStack> smeltingBonus = new HashMap<Object,ItemStack>();
/**
* This method is used to determine what bonus items are generated when the infernal furnace smelts items
* @param in The input of the smelting operation. e.g. new ItemStack(Block.oreGold)
* @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.
*/
public static void addSmeltingBonus(ItemStack in, ItemStack out) {
smeltingBonus.put(
Arrays.asList(Item.getIdFromItem(in.getItem()),in.getItemDamage()),
new ItemStack(out.getItem(),0,out.getItemDamage()));
}
/**
* This method is used to determine what bonus items are generated when the infernal furnace smelts items
* @param in The ore dictionary input of the smelting operation. e.g. "oreGold"
* @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.
*/
public static void addSmeltingBonus(String in, ItemStack out) {
smeltingBonus.put( in, new ItemStack(out.getItem(),0,out.getItemDamage()));
}
/**
* Returns the bonus item produced from a smelting operation in the infernal furnace
* @param in The input of the smelting operation. e.g. new ItemStack(oreGold)
* @return the The bonus item that can be produced
*/
public static ItemStack getSmeltingBonus(ItemStack in) {
ItemStack out = smeltingBonus.get(Arrays.asList(Item.getIdFromItem(in.getItem()),in.getItemDamage()));
if (out==null) {
out = smeltingBonus.get(Arrays.asList(Item.getIdFromItem(in.getItem()),OreDictionary.WILDCARD_VALUE));
}
if (out==null) {
String od = OreDictionary.getOreName( OreDictionary.getOreID(in));
out = smeltingBonus.get(od);
}
return out;
}
public static List getCraftingRecipes() {
return craftingRecipes;
}
/**
* @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.
*/
public static ShapedArcaneRecipe addArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe)
{
ShapedArcaneRecipe r= new ShapedArcaneRecipe(research, result, aspects, recipe);
craftingRecipes.add(r);
return r;
}
/**
* @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.
*/
public static ShapelessArcaneRecipe addShapelessArcaneCraftingRecipe(String research, ItemStack result, AspectList aspects, Object ... recipe)
{
ShapelessArcaneRecipe r = new ShapelessArcaneRecipe(research, result, aspects, recipe);
craftingRecipes.add(r);
return r;
}
/**
* @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.
*
*/
public static InfusionRecipe addInfusionCraftingRecipe(String research, Object result, int instability, AspectList aspects, ItemStack input,ItemStack[] recipe)
{
if (!(result instanceof ItemStack || result instanceof Object[])) return null;
InfusionRecipe r= new InfusionRecipe(research, result, instability, aspects, input, recipe);
craftingRecipes.add(r);
return r;
}
/**
* @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.
*
*/
public static InfusionEnchantmentRecipe addInfusionEnchantmentRecipe(String research, Enchantment enchantment, int instability, AspectList aspects, ItemStack[] recipe)
{
InfusionEnchantmentRecipe r= new InfusionEnchantmentRecipe(research, enchantment, instability, aspects, recipe);
craftingRecipes.add(r);
return r;
}
/**
* @param stack the recipe result
* @return the recipe
*/
public static InfusionRecipe getInfusionRecipe(ItemStack res) {
for (Object r:getCraftingRecipes()) {
if (r instanceof InfusionRecipe) {
if (((InfusionRecipe)r).getRecipeOutput() instanceof ItemStack) {
if (((ItemStack) ((InfusionRecipe)r).getRecipeOutput()).isItemEqual(res))
return (InfusionRecipe)r;
}
}
}
return null;
}
/**
* @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
*/
public static CrucibleRecipe addCrucibleRecipe(String key, ItemStack result, Object catalyst, AspectList tags) {
CrucibleRecipe rc = new CrucibleRecipe(key, result, catalyst, tags);
getCraftingRecipes().add(rc);
return rc;
}
/**
* @param stack the recipe result
* @return the recipe
*/
public static CrucibleRecipe getCrucibleRecipe(ItemStack stack) {
for (Object r:getCraftingRecipes()) {
if (r instanceof CrucibleRecipe) {
if (((CrucibleRecipe)r).getRecipeOutput().isItemEqual(stack))
return (CrucibleRecipe)r;
}
}
return null;
}
/**
* 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[]>();
public static Object[] getCraftingRecipeKey(EntityPlayer player, ItemStack stack) {
int[] key = new int[] {Item.getIdFromItem(stack.getItem()),stack.getItemDamage()};
if (keyCache.containsKey(key)) {
if (keyCache.get(key)==null) return null;
if (ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), (String)(keyCache.get(key))[0]))
return keyCache.get(key);
else
return null;
}
for (ResearchCategoryList rcl:ResearchCategories.researchCategories.values()) {
for (ResearchItem ri:rcl.research.values()) {
if (ri.getPages()==null) continue;
for (int a=0;a<ri.getPages().length;a++) {
ResearchPage page = ri.getPages()[a];
if (page.recipeOutput!=null && stack !=null && page.recipeOutput.isItemEqual(stack)) {
keyCache.put(key,new Object[] {ri.key,a});
if (ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), ri.key))
return new Object[] {ri.key,a};
else
return null;
}
}
}
}
keyCache.put(key,null);
return null;
}
//ASPECTS////////////////////////////////////////
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
*/
public static boolean exists(Item item, int meta) {
AspectList tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,meta));
if (tmp==null) {
tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,OreDictionary.WILDCARD_VALUE));
if (meta==OreDictionary.WILDCARD_VALUE && tmp==null) {
int index=0;
do {
tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,index));
index++;
} while (index<16 && tmp==null);
}
if (tmp==null) return false;
}
return true;
}
/**
* Used to assign apsects to the given item/block. Here is an example of the declaration for cobblestone:<p>
* <i>ThaumcraftApi.registerObjectTag(new ItemStack(Blocks.cobblestone), (new AspectList()).add(Aspect.ENTROPY, 1).add(Aspect.EARTH, 1));</i>
* @param item the item passed. Pass OreDictionary.WILDCARD_VALUE 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(ItemStack item, AspectList aspects) {
if (aspects==null) aspects=new AspectList();
try {
objectTags.put(Arrays.asList(item.getItem(),item.getItemDamage()), aspects);
} catch (Exception e) {}
}
/**
* Used to assign apsects to the given item/block. Here is an example of the declaration for cobblestone:<p>
* <i>ThaumcraftApi.registerObjectTag(new ItemStack(Blocks.cobblestone), new int[]{0,1}, (new AspectList()).add(Aspect.ENTROPY, 1).add(Aspect.EARTH, 1));</i>
* @param item
* @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(ItemStack item, int[] meta, AspectList aspects) {
if (aspects==null) aspects=new AspectList();
try {
objectTags.put(Arrays.asList(item.getItem(),meta), aspects);
} catch (Exception e) {}
}
/**
* Used to assign apsects to the given ore dictionary item.
* @param oreDict the ore dictionary name
* @param aspects A ObjectTags object of the associated aspects
*/
public static void registerObjectTag(String oreDict, AspectList aspects) {
if (aspects==null) aspects=new AspectList();
ArrayList<ItemStack> ores = OreDictionary.getOres(oreDict);
if (ores!=null && ores.size()>0) {
for (ItemStack ore:ores) {
try {
objectTags.put(Arrays.asList(ore.getItem(), ore.getItemDamage()), aspects);
} catch (Exception e) {}
}
}
}
/**
* Used to assign aspects to the given item/block.
* Attempts to automatically generate aspect tags by checking registered recipes.
* Here is an example of the declaration for pistons:<p>
* <i>ThaumcraftApi.registerComplexObjectTag(new ItemStack(Blocks.cobblestone), (new AspectList()).add(Aspect.MECHANISM, 2).add(Aspect.MOTION, 4));</i>
* @param item, pass OreDictionary.WILDCARD_VALUE to meta 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(ItemStack item, AspectList aspects ) {
if (!exists(item.getItem(),item.getItemDamage())) {
AspectList tmp = ThaumcraftApiHelper.generateTags(item.getItem(), item.getItemDamage());
if (tmp != null && tmp.size()>0) {
for(Aspect tag:tmp.getAspects()) {
aspects.add(tag, tmp.getAmount(tag));
}
}
registerObjectTag(item,aspects);
} else {
AspectList tmp = ThaumcraftApiHelper.getObjectAspects(item);
for(Aspect tag:aspects.getAspects()) {
tmp.merge(tag, tmp.getAmount(tag));
}
registerObjectTag(item,tmp);
}
}
//CROPS //////////////////////////////////////////////////////////////////////////////////////////
/**
* To define mod crops you need to use FMLInterModComms in your @Mod.Init method.
* There are two 'types' of crops you can add. Standard crops and clickable crops.
*
* Standard crops work like normal vanilla crops - they grow until a certain metadata
* value is reached and you harvest them by destroying the block and collecting the blocks.
* You need to create and ItemStack that tells the golem what block id and metadata represents
* the crop when fully grown. Sending a metadata of [OreDictionary.WILDCARD_VALUE] will mean the metadata won't get
* checked.
* Example for vanilla wheat:
* FMLInterModComms.sendMessage("Thaumcraft", "harvestStandardCrop", new ItemStack(Block.crops,1,7));
*
* Clickable crops are crops that you right click to gather their bounty instead of destroying them.
* As for standard crops, you need to create and ItemStack that tells the golem what block id
* and metadata represents the crop when fully grown. The golem will trigger the blocks onBlockActivated method.
* Sending a metadata of [OreDictionary.WILDCARD_VALUE] will mean the metadata won't get checked.
* Example (this will technically do nothing since clicking wheat does nothing, but you get the idea):
* FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(Block.crops,1,7));
*
* Stacked crops (like reeds) are crops that you wish the bottom block should remain after harvesting.
* As for standard crops, you need to create and ItemStack that tells the golem what block id
* and metadata represents the crop when fully grown. Sending a metadata of [OreDictionary.WILDCARD_VALUE] will mean the actualy md won't get
* checked. If it has the order upgrade it will only harvest if the crop is more than one block high.
* Example:
* FMLInterModComms.sendMessage("Thaumcraft", "harvestStackedCrop", new ItemStack(Block.reed,1,7));
*/
//NATIVE CLUSTERS //////////////////////////////////////////////////////////////////////////////////
/**
* You can define certain ores that will have a chance to produce native clusters via FMLInterModComms
* in your @Mod.Init method using the "nativeCluster" string message.
* The format should be:
* "[ore item/block id],[ore item/block metadata],[cluster item/block id],[cluster item/block metadata],[chance modifier float]"
*
* NOTE: The chance modifier is a multiplier applied to the default chance for that cluster to be produced (default 27.5% for a pickaxe of the core)
*
* Example for vanilla iron ore to produce one of my own native iron clusters (assuming default id's) at double the default chance:
* FMLInterModComms.sendMessage("Thaumcraft", "nativeCluster","15,0,25016,16,2.0");
*/
//LAMP OF GROWTH BLACKLIST ///////////////////////////////////////////////////////////////////////////
/**
* You can blacklist crops that should not be effected by the Lamp of Growth via FMLInterModComms
* in your @Mod.Init method using the "lampBlacklist" itemstack message.
* Sending a metadata of [OreDictionary.WILDCARD_VALUE] will mean the metadata won't get checked.
* Example for vanilla wheat:
* FMLInterModComms.sendMessage("Thaumcraft", "lampBlacklist", new ItemStack(Block.crops,1,OreDictionary.WILDCARD_VALUE));
*/
//DIMENSION BLACKLIST ///////////////////////////////////////////////////////////////////////////
/**
* You can blacklist a dimension to not spawn certain thaumcraft features
* in your @Mod.Init method using the "dimensionBlacklist" string message in the format "[dimension]:[level]"
* The level values are as follows:
* [0] stop all tc spawning and generation
* [1] allow ore and node generation
* [2] allow mob spawning
* [3] allow ore and node gen + mob spawning
* Example:
* FMLInterModComms.sendMessage("Thaumcraft", "dimensionBlacklist", "15:1");
*/
//BIOME BLACKLIST ///////////////////////////////////////////////////////////////////////////
/**
* You can blacklist a biome to not spawn certain thaumcraft features
* in your @Mod.Init method using the "biomeBlacklist" string message in the format "[biome id]:[level]"
* The level values are as follows:
* [0] stop all tc spawning and generation
* [1] allow ore and node generation
* [2] allow mob spawning
* [3] allow ore and node gen + mob spawning
* Example:
* FMLInterModComms.sendMessage("Thaumcraft", "biomeBlacklist", "180:2");
*/
}

View file

@ -0,0 +1,268 @@
package thaumcraft.api;
import java.lang.reflect.Method;
import java.util.HashMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
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 {
public static AspectList cullTags(AspectList temp) {
AspectList temp2 = new AspectList();
for (Aspect tag:temp.getAspects()) {
if (tag!=null)
temp2.add(tag, temp.getAmount(tag));
}
while (temp2!=null && temp2.size()>10) {
Aspect lowest = null;
int low = Integer.MAX_VALUE;
for (Aspect tag:temp2.getAspects()) {
if (tag==null) continue;
if (temp2.getAmount(tag)<low) {
low = temp2.getAmount(tag);
lowest = tag;
}
}
temp2.aspects.remove(lowest);
}
return temp2;
}
public static boolean areItemsEqual(ItemStack s1,ItemStack s2)
{
if (s1.isItemStackDamageable() && s2.isItemStackDamageable())
{
return s1.getItem() == s2.getItem();
} else
return s1.getItem() == s2.getItem() && s1.getItemDamage() == s2.getItemDamage();
}
static Method isResearchComplete;
static Method getObjectTags;
static Method getBonusTags;
static Method generateTags;
public static boolean isResearchComplete(String username, String researchkey) {
boolean ot = false;
try {
if(isResearchComplete == null) {
Class fake = Class.forName("thaumcraft.common.lib.research.ResearchManager");
isResearchComplete = fake.getMethod("isResearchComplete", String.class, String.class);
}
ot = (Boolean) isResearchComplete.invoke(null, username, researchkey);
} catch(Exception ex) {
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.research.ResearchManager method isResearchComplete");
}
return ot;
}
public static ItemStack getStackInRowAndColumn(Object instance, int row, int column) {
ItemStack ot = null;
try {
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) {
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.tiles.TileMagicWorkbench method getStackInRowAndColumn");
}
return ot;
}
public static AspectList getObjectAspects(ItemStack is) {
AspectList ot = null;
try {
if(getObjectTags == null) {
Class fake = Class.forName("thaumcraft.common.lib.crafting.ThaumcraftCraftingManager");
getObjectTags = fake.getMethod("getObjectTags", ItemStack.class);
}
ot = (AspectList) getObjectTags.invoke(null, is);
} catch(Exception ex) {
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.crafting.ThaumcraftCraftingManager method getObjectTags");
}
return ot;
}
public static AspectList getBonusObjectTags(ItemStack is,AspectList ot) {
try {
if(getBonusTags == null) {
Class fake = Class.forName("thaumcraft.common.lib.crafting.ThaumcraftCraftingManager");
getBonusTags = fake.getMethod("getBonusTags", ItemStack.class, AspectList.class);
}
ot = (AspectList) getBonusTags.invoke(null, is, ot);
} catch(Exception ex) {
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.crafting.ThaumcraftCraftingManager method getBonusTags");
}
return ot;
}
public static AspectList generateTags(Item item, int meta) {
try {
if(generateTags == null) {
Class fake = Class.forName("thaumcraft.common.lib.crafting.ThaumcraftCraftingManager");
generateTags = fake.getMethod("generateTags", Item.class, int.class);
}
return (AspectList) generateTags.invoke(null, item, meta);
} catch(Exception ex) {
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.crafting.ThaumcraftCraftingManager method generateTags");
}
return null;
}
public static boolean containsMatch(boolean strict, ItemStack[] inputs, ItemStack... targets)
{
for (ItemStack input : inputs)
{
for (ItemStack target : targets)
{
if (itemMatches(target, input, strict))
{
return true;
}
}
}
return false;
}
public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict)
{
if (input == null && target != null || input != null && target == null)
{
return false;
}
return (target.getItem() == input.getItem() && ((target.getItemDamage() == OreDictionary.WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage()));
}
public static TileEntity getConnectableTile(World world, int x, int y, int z, ForgeDirection face) {
TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite()))
return te;
else
return null;
}
public static TileEntity getConnectableTile(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
TileEntity te = world.getTileEntity(x+face.offsetX, y+face.offsetY, z+face.offsetZ);
if (te instanceof IEssentiaTransport && ((IEssentiaTransport)te).isConnectable(face.getOpposite()))
return te;
else
return null;
}
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) {
if (allAspects.get(amount)==null) {
AspectList al = new AspectList();
for (Aspect aspect:Aspect.aspects.values()) {
al.add(aspect, amount);
}
allAspects.put(amount, al);
}
return allAspects.get(amount);
}
public static AspectList getAllCompoundAspects(int amount) {
if (allCompoundAspects.get(amount)==null) {
AspectList al = new AspectList();
for (Aspect aspect:Aspect.getCompoundAspects()) {
al.add(aspect, amount);
}
allCompoundAspects.put(amount, al);
}
return allCompoundAspects.get(amount);
}
static Method consumeVisFromWand;
/**
* Use to subtract vis from a wand for most operations
* Wands store vis differently so "real" vis costs need to be multiplied by 100 before calling this method
* @param wand the wand itemstack
* @param player the player using the wand
* @param cost the cost of the operation.
* @param doit actually subtract the vis from the wand if true - if false just simulate the result
* @param crafting is this a crafting operation or not - if
* false then things like frugal and potency will apply to the costs
* @return was the vis successfully subtracted
*/
public static boolean consumeVisFromWand(ItemStack wand, EntityPlayer player,
AspectList cost, boolean doit, boolean crafting) {
boolean ot = false;
try {
if(consumeVisFromWand == null) {
Class fake = Class.forName("thaumcraft.common.items.wands.ItemWandCasting");
consumeVisFromWand = fake.getMethod("consumeAllVis",
ItemStack.class, EntityPlayer.class, AspectList.class, boolean.class, boolean.class);
}
ot = (Boolean) consumeVisFromWand.invoke(
consumeVisFromWand.getDeclaringClass().cast(wand.getItem()), wand, player, cost, doit, crafting);
} catch(Exception ex) {
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.items.wands.ItemWandCasting method consumeAllVis");
}
return ot;
}
static Method consumeVisFromWandCrafting;
/**
* Subtract vis for use by a crafting mechanic. Costs are calculated slightly
* differently and things like the frugal enchant is ignored
* Must NOT be multiplied by 100 - send the actual vis cost
* @param wand the wand itemstack
* @param player the player using the wand
* @param cost the cost of the operation.
* @param doit actually subtract the vis from the wand if true - if false just simulate the result
* @return was the vis successfully subtracted
*/
public static boolean consumeVisFromWandCrafting(ItemStack wand, EntityPlayer player,
AspectList cost, boolean doit) {
boolean ot = false;
try {
if(consumeVisFromWandCrafting == null) {
Class fake = Class.forName("thaumcraft.common.items.wands.ItemWandCasting");
consumeVisFromWandCrafting = fake.getMethod("consumeAllVisCrafting",
ItemStack.class, EntityPlayer.class, AspectList.class, boolean.class);
}
ot = (Boolean) consumeVisFromWandCrafting.invoke(
consumeVisFromWandCrafting.getDeclaringClass().cast(wand.getItem()), wand, player, cost, doit);
} catch(Exception ex) {
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.items.wands.ItemWandCasting method consumeAllVisCrafting");
}
return ot;
}
static Method consumeVisFromInventory;
/**
* Subtract vis from a wand the player is carrying. Works like consumeVisFromWand in that actual vis
* costs should be multiplied by 100. The costs are handled like crafting however and things like
* frugal don't effect them
* @param player the player using the wand
* @param cost the cost of the operation.
* @return was the vis successfully subtracted
*/
public static boolean consumeVisFromInventory(EntityPlayer player, AspectList cost) {
boolean ot = false;
try {
if(consumeVisFromInventory == null) {
Class fake = Class.forName("thaumcraft.common.items.wands.WandManager");
consumeVisFromInventory = fake.getMethod("consumeVisFromInventory",
EntityPlayer.class, AspectList.class);
}
ot = (Boolean) consumeVisFromInventory.invoke(null, player, cost);
} catch(Exception ex) {
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.items.wands.WandManager method consumeVisFromInventory");
}
return ot;
}
}

View file

@ -0,0 +1,201 @@
package thaumcraft.api.aspects;
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 {
String tag;
Aspect[] components;
int color;
private String chatcolor;
ResourceLocation image;
int blend;
/**
* 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 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
*/
public Aspect(String tag, int color, Aspect[] components, ResourceLocation image, int blend) {
if (aspects.containsKey(tag)) throw new IllegalArgumentException(tag+" already registered!");
this.tag = tag;
this.components = components;
this.color = color;
this.image = image;
this.blend = blend;
aspects.put(tag, this);
}
/**
* Shortcut constructor I use for the default aspects - you shouldn't be using this.
*/
public Aspect(String tag, int color, Aspect[] components) {
this(tag,color,components,new ResourceLocation("thaumcraft","textures/aspects/"+tag.toLowerCase()+".png"),1);
}
/**
* Shortcut constructor I use for the default aspects - you shouldn't be using this.
*/
public Aspect(String tag, int color, Aspect[] components, int blend) {
this(tag,color,components,new ResourceLocation("thaumcraft","textures/aspects/"+tag.toLowerCase()+".png"),blend);
}
/**
* Shortcut constructor I use for the primal aspects -
* you shouldn't use this as making your own primal aspects will break all the things.
*/
public Aspect(String tag, int color, String chatcolor, int blend) {
this(tag,color,(Aspect[])null, blend);
this.setChatcolor(chatcolor);
}
public int getColor() {
return color;
}
public String getName() {
return WordUtils.capitalizeFully(tag);
}
public String getLocalizedDescription() {
return StatCollector.translateToLocal("tc.aspect."+tag);
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public Aspect[] getComponents() {
return components;
}
public void setComponents(Aspect[] components) {
this.components = components;
}
public ResourceLocation getImage() {
return image;
}
public static Aspect getAspect(String tag) {
return aspects.get(tag);
}
public int getBlend() {
return blend;
}
public void setBlend(int blend) {
this.blend = blend;
}
public boolean isPrimal() {
return getComponents()==null || getComponents().length!=2;
}
///////////////////////////////
public static ArrayList<Aspect> getPrimalAspects() {
ArrayList<Aspect> primals = new ArrayList<Aspect>();
Collection<Aspect> pa = aspects.values();
for (Aspect aspect:pa) {
if (aspect.isPrimal()) primals.add(aspect);
}
return primals;
}
public static ArrayList<Aspect> getCompoundAspects() {
ArrayList<Aspect> compounds = new ArrayList<Aspect>();
Collection<Aspect> pa = aspects.values();
for (Aspect aspect:pa) {
if (!aspect.isPrimal()) compounds.add(aspect);
}
return compounds;
}
public String getChatcolor() {
return chatcolor;
}
public void setChatcolor(String chatcolor) {
this.chatcolor = chatcolor;
}
///////////////////////////////
public static LinkedHashMap<String,Aspect> aspects = new LinkedHashMap<String,Aspect>();
//PRIMAL
public static final Aspect AIR = new Aspect("aer",0xffff7e,"e",1);
public static final Aspect EARTH = new Aspect("terra",0x56c000,"2",1);
public static final Aspect FIRE = new Aspect("ignis",0xff5a01,"c",1);
public static final Aspect WATER = new Aspect("aqua",0x3cd4fc,"3",1);
public static final Aspect ORDER = new Aspect("ordo",0xd5d4ec,"7",1);
public static final Aspect ENTROPY = new Aspect("perditio",0x404040,"8",771);
//SECONDARY
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 WEATHER = new Aspect("tempestas",0xFFFFFF, new Aspect[] {AIR, WATER});
public static final Aspect MOTION = new Aspect("motus",0xcdccf4, new Aspect[] {AIR, ORDER});
public static final Aspect COLD = new Aspect("gelum",0xe1ffff, new Aspect[] {FIRE, ENTROPY});
public static final Aspect CRYSTAL = new Aspect("vitreus",0x80ffff, new Aspect[] {EARTH, ORDER});
public static final Aspect LIFE = new Aspect("victus",0xde0005, new Aspect[] {WATER, EARTH});
public static final Aspect POISON = new Aspect("venenum",0x89f000, new Aspect[] {WATER, ENTROPY});
public static final Aspect ENERGY = new Aspect("potentia",0xc0ffff, new Aspect[] {ORDER, FIRE});
public static final Aspect EXCHANGE = new Aspect("permutatio",0x578357, new Aspect[] {ENTROPY, ORDER});
// public static final Aspect ?? = new Aspect("??",0xcdccf4, new Aspect[] {AIR, EARTH});
// public static final Aspect ?? = new Aspect("??",0xcdccf4, new Aspect[] {FIRE, EARTH});
// public static final Aspect ?? = new Aspect("??",0xcdccf4, new Aspect[] {FIRE, WATER});
// public static final Aspect ?? = new Aspect("??",0xcdccf4, new Aspect[] {ORDER, WATER});
// public static final Aspect ?? = new Aspect("??",0xcdccf4, new Aspect[] {EARTH, ENTROPY});
//TERTIARY
public static final Aspect METAL = new Aspect("metallum",0xb5b5cd, new Aspect[] {EARTH, CRYSTAL});
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, ORDER});
public static final Aspect TRAVEL = new Aspect("iter",0xe0585b, new Aspect[] {MOTION, EARTH});
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 SLIME = new Aspect("limus",0x01f800, new Aspect[] {LIFE, WATER});
public static final Aspect PLANT = new Aspect("herba",0x01ac00, new Aspect[] {LIFE, EARTH});
public static final Aspect TREE = new Aspect("arbor",0x876531, new Aspect[] {AIR, 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 MAN = new Aspect("humanus",0xffd7c0, new Aspect[] {BEAST, MIND});
public static final Aspect CROP = new Aspect("messis",0xe1b371, new Aspect[] {PLANT, MAN});
public static final Aspect MINE = new Aspect("perfodio",0xdcd2d8, new Aspect[] {MAN, EARTH});
public static final Aspect TOOL = new Aspect("instrumentum",0x4040ee, new Aspect[] {MAN, ORDER});
public static final Aspect HARVEST = new Aspect("meto",0xeead82, new Aspect[] {CROP, TOOL});
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});
}

View file

@ -0,0 +1,256 @@
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
/**
* this creates a new aspect list with preloaded values based off the aspects of the given item.
* @param the itemstack of the given item
*/
public AspectList(ItemStack stack) {
try {
AspectList temp = ThaumcraftApiHelper.getObjectAspects(stack);
if (temp!=null)
for (Aspect tag:temp.getAspects()) {
add(tag,temp.getAmount(tag));
}
} catch (Exception e) {}
}
public AspectList() {
}
public AspectList copy() {
AspectList out = new AspectList();
for (Aspect a:this.getAspects())
out.add(a, this.getAmount(a));
return out;
}
/**
* @return the amount of different aspects in this collection
*/
public int size() {
return aspects.size();
}
/**
* @return the amount of total vis in this collection
*/
public int visSize() {
int q = 0;
for (Aspect as:aspects.keySet()) {
q+=this.getAmount(as);
}
return q;
}
/**
* @return an array of all the aspects in this collection
*/
public Aspect[] getAspects() {
Aspect[] q = new Aspect[1];
return aspects.keySet().toArray(q);
}
/**
* @return an array of all the aspects in this collection
*/
public Aspect[] getPrimalAspects() {
AspectList t = new AspectList();
for (Aspect as:aspects.keySet()) {
if (as.isPrimal()) {
t.add(as,1);
}
}
Aspect[] q = new Aspect[1];
return t.aspects.keySet().toArray(q);
}
/**
* @return an array of all the aspects in this collection sorted by name
*/
public Aspect[] getAspectsSorted() {
try {
Aspect[] out = aspects.keySet().toArray(new Aspect[1]);
boolean change=false;
do {
change=false;
for(int a=0;a<out.length-1;a++) {
Aspect e1 = out[a];
Aspect e2 = out[a+1];
if (e1!=null && e2!=null && e1.getTag().compareTo(e2.getTag())>0) {
out[a] = e2;
out[a+1] = e1;
change = true;
break;
}
}
} while (change==true);
return out;
} catch (Exception e) {
return this.getAspects();
}
}
/**
* @return an array of all the aspects in this collection sorted by amount
*/
public Aspect[] getAspectsSortedAmount() {
try {
Aspect[] out = aspects.keySet().toArray(new Aspect[1]);
boolean change=false;
do {
change=false;
for(int a=0;a<out.length-1;a++) {
int e1 = getAmount(out[a]);
int e2 = getAmount(out[a+1]);
if (e1>0 && e2>0 && e2>e1) {
Aspect ea = out[a];
Aspect eb = out[a+1];
out[a] = eb;
out[a+1] = ea;
change = true;
break;
}
}
} while (change==true);
return out;
} catch (Exception e) {
return this.getAspects();
}
}
/**
* @param key
* @return the amount associated with the given aspect in this collection
*/
public int getAmount(Aspect 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
*/
public boolean reduce(Aspect key, int amount) {
if (getAmount(key)>=amount) {
int am = getAmount(key)-amount;
aspects.put(key, am);
return true;
}
return false;
}
/**
* 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
*/
public AspectList remove(Aspect key, int amount) {
int am = getAmount(key)-amount;
if (am<=0) aspects.remove(key); else
this.aspects.put(key, am);
return this;
}
/**
* Simply removes the aspect from the list
* @param key
* @param amount
* @return
*/
public AspectList remove(Aspect key) {
aspects.remove(key);
return this;
}
/**
* 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
*/
public AspectList add(Aspect aspect, int amount) {
if (this.aspects.containsKey(aspect)) {
int oldamount = this.aspects.get(aspect);
amount+=oldamount;
}
this.aspects.put( aspect, amount );
return this;
}
/**
* 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
*/
public AspectList merge(Aspect aspect, int amount) {
if (this.aspects.containsKey(aspect)) {
int oldamount = this.aspects.get(aspect);
if (amount<oldamount) amount=oldamount;
}
this.aspects.put( aspect, amount );
return this;
}
/**
* Reads the list of aspects from nbt
* @param nbttagcompound
* @return
*/
public void readFromNBT(NBTTagCompound nbttagcompound)
{
aspects.clear();
NBTTagList tlist = nbttagcompound.getTagList("Aspects",(byte)10);
for (int j = 0; j < tlist.tagCount(); j++) {
NBTTagCompound rs = (NBTTagCompound) tlist.getCompoundTagAt(j);
if (rs.hasKey("key")) {
add( Aspect.getAspect(rs.getString("key")),
rs.getInteger("amount"));
}
}
}
/**
* Writes the list of aspects to nbt
* @param nbttagcompound
* @return
*/
public void writeToNBT(NBTTagCompound nbttagcompound)
{
NBTTagList tlist = new NBTTagList();
nbttagcompound.setTag("Aspects", tlist);
for (Aspect aspect : getAspects())
if (aspect != null) {
NBTTagCompound f = new NBTTagCompound();
f.setString("key", aspect.getTag());
f.setInteger("amount", getAmount(aspect));
tlist.appendTag(f);
}
}
}

View file

@ -0,0 +1,36 @@
package thaumcraft.api.aspects;
import java.lang.reflect.Method;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.FMLLog;
public class AspectSourceHelper {
static Method drainEssentia;
/**
* This method is what is used to drain essentia from jars and other sources for things like
* infusion crafting or powering the arcane furnace. A record of possible sources are kept track of
* and refreshed as needed around the calling tile entity. This also renders the essentia trail particles.
* Only 1 essentia is drained at a time
* @param tile the tile entity that is draining the essentia
* @param aspect the aspect that you are looking for
* @param direction the direction from which you wish to drain. Forgedirection.Unknown simply seeks in all directions.
* @param range how many blocks you wish to search for essentia sources.
* @return boolean returns true if essentia was found and removed from a source.
*/
public static boolean drainEssentia(TileEntity tile, Aspect aspect, ForgeDirection direction, int range) {
try {
if(drainEssentia == null) {
Class fake = Class.forName("thaumcraft.common.lib.EssentiaHandler");
drainEssentia = fake.getMethod("drainEssentia", TileEntity.class, Aspect.class, ForgeDirection.class, int.class);
}
return (Boolean) drainEssentia.invoke(null, tile, aspect, direction, range);
} catch(Exception ex) {
FMLLog.warning("[Thaumcraft API] Could not invoke thaumcraft.common.lib.EssentiaHandler method drainEssentia");
}
return false;
}
}

View file

@ -0,0 +1,80 @@
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
*
*/
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
*/
public boolean doesContainerAccept(Aspect tag);
/**
* 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.
*/
public int addToContainer(Aspect tag, int amount);
/**
* 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
*/
public boolean takeFromContainer(Aspect tag, int amount);
/**
* 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
*
* Going away in the next major patch
*/
@Deprecated
public boolean takeFromContainer(AspectList ot);
/**
* Checks if the tile entity contains the listed amount (or more) of the aspect
* @param tag
* @param amount
* @return
*/
public boolean doesContainerContainAmount(Aspect tag,int amount);
/**
* 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
*
* Going away in the next major patch
*/
@Deprecated
public boolean doesContainerContain(AspectList ot);
/**
* Returns how much of the aspect this tile entity contains
* @param tag
* @return the amount of that aspect found
*/
public int containerContains(Aspect tag);
}

View file

@ -0,0 +1,16 @@
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.
*
*/
public interface IAspectSource extends IAspectContainer {
}

View file

@ -0,0 +1,37 @@
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
*
*/
public interface IEssentiaContainerItem {
public AspectList getAspects(ItemStack itemstack);
public void setAspects(ItemStack itemstack, AspectList aspects);
}
//Example implementation
/*
@Override
public AspectList getAspects(ItemStack itemstack) {
if (itemstack.hasTagCompound()) {
AspectList aspects = new AspectList();
aspects.readFromNBT(itemstack.getTagCompound());
return aspects.size()>0?aspects:null;
}
return null;
}
@Override
public void setAspects(ItemStack itemstack, AspectList aspects) {
if (!itemstack.hasTagCompound()) itemstack.setTagCompound(new NBTTagCompound());
aspects.writeToNBT(itemstack.getTagCompound());
}
*/

View file

@ -0,0 +1,100 @@
package thaumcraft.api.aspects;
import net.minecraftforge.common.util.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
*/
public interface IEssentiaTransport {
/**
* Is this tile able to connect to other vis users/sources on the specified side?
* @param face
* @return
*/
public boolean isConnectable(ForgeDirection face);
/**
* Is this side used to input essentia?
* @param face
* @return
*/
boolean canInputFrom(ForgeDirection face);
/**
* Is this side used to output essentia?
* @param face
* @return
*/
boolean canOutputTo(ForgeDirection face);
/**
* Sets the amount of suction this block will apply
* @param suction
*/
public void setSuction(Aspect aspect, int amount);
/**
* Returns the type of suction this block is applying.
* @param loc
* the location from where the suction is being checked
* @return
* a return type of null indicates the suction is untyped and the first thing available will be drawn
*/
public Aspect getSuctionType(ForgeDirection face);
/**
* Returns the strength of suction this block is applying.
* @param loc
* the location from where the suction is being checked
* @return
*/
public int getSuctionAmount(ForgeDirection face);
/**
* remove the specified amount of essentia from this transport tile
* @return how much was actually taken
*/
public int takeEssentia(Aspect aspect, int amount, ForgeDirection face);
/**
* add the specified amount of essentia to this transport tile
* @return how much was actually added
*/
public int addEssentia(Aspect aspect, int amount, ForgeDirection face);
/**
* What type of essentia this contains
* @param face
* @return
*/
public Aspect getEssentiaType(ForgeDirection face);
/**
* How much essentia this block contains
* @param face
* @return
*/
public int getEssentiaAmount(ForgeDirection face);
/**
* Essentia will not be drawn from this container unless the suction exceeds this amount.
* @return the amount
*/
public int getMinimumSuction();
/**
* 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

@ -0,0 +1,74 @@
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 {
private ItemStack recipeOutput;
public Object catalyst;
public AspectList aspects;
public String key;
public CrucibleRecipe(String researchKey, ItemStack result, Object cat, AspectList tags) {
recipeOutput = result;
this.aspects = tags;
this.key = researchKey;
this.catalyst = cat;
if (cat instanceof String) {
this.catalyst = OreDictionary.getOres((String) cat);
}
}
public boolean matches(AspectList itags, ItemStack cat) {
if (catalyst instanceof ItemStack &&
!ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
return false;
} else
if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
if (!ThaumcraftApiHelper.containsMatch(true, ((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{}), cat)) return false;
}
if (itags==null) return false;
for (Aspect tag:aspects.getAspects()) {
if (itags.getAmount(tag)<aspects.getAmount(tag)) return false;
}
return true;
}
public boolean catalystMatches(ItemStack cat) {
if (catalyst instanceof ItemStack && ThaumcraftApiHelper.itemMatches((ItemStack) catalyst,cat,false)) {
return true;
} else
if (catalyst instanceof ArrayList && ((ArrayList<ItemStack>)catalyst).size()>0) {
if (ThaumcraftApiHelper.containsMatch(true,
((ArrayList<ItemStack>)catalyst).toArray(new ItemStack[]{}), cat)) return true;
}
return false;
}
public AspectList removeMatching(AspectList itags) {
AspectList temptags = new AspectList();
temptags.aspects.putAll(itags.aspects);
for (Aspect tag:aspects.getAspects()) {
temptags.remove(tag, aspects.getAmount(tag));
// if (!temptags.remove(tag, aspects.getAmount(tag))) return null;
}
itags = temptags;
return itags;
}
public ItemStack getRecipeOutput() {
return recipeOutput;
}
}

View file

@ -0,0 +1,35 @@
package thaumcraft.api.crafting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import thaumcraft.api.aspects.AspectList;
public interface IArcaneRecipe
{
/**
* Used to check if a recipe matches current crafting inventory
* @param player
*/
boolean matches(IInventory var1, World world, EntityPlayer player);
/**
* Returns an Item that is the result of this recipe
*/
ItemStack getCraftingResult(IInventory var1);
/**
* Returns the size of the recipe area
*/
int getRecipeSize();
ItemStack getRecipeOutput();
AspectList getAspects();
AspectList getAspects(IInventory var1);
String getResearch();
}

View file

@ -0,0 +1,19 @@
package thaumcraft.api.crafting;
import net.minecraft.world.World;
/**
*
* @author Azanor
*
* Blocks that implement this interface act as infusion crafting stabilisers like candles and skulls
*
*/
public interface IInfusionStabiliser {
/**
* returns true if the block can stabilise things
*/
public boolean canStabaliseInfusion(World world, int x, int y, int z);
}

View file

@ -0,0 +1,156 @@
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;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.AspectList;
public class InfusionEnchantmentRecipe
{
public AspectList aspects;
public String research;
public ItemStack[] components;
public Enchantment enchantment;
public int recipeXP;
public int instability;
public InfusionEnchantmentRecipe(String research, Enchantment input, int inst,
AspectList aspects2, ItemStack[] recipe) {
this.research = research;
this.enchantment = input;
this.aspects = aspects2;
this.components = recipe;
this.instability = inst;
this.recipeXP = Math.max(1, input.getMinEnchantability(1)/3);
}
/**
* Used to check if a recipe matches current crafting inventory
* @param player
*/
public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player) {
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) {
return false;
}
if (!enchantment.canApply(central) || !central.getItem().isItemTool(central)) {
return false;
}
Map map1 = EnchantmentHelper.getEnchantments(central);
Iterator iterator = map1.keySet().iterator();
while (iterator.hasNext())
{
int j1 = ((Integer)iterator.next()).intValue();
Enchantment ench = Enchantment.enchantmentsList[j1];
if (j1 == enchantment.effectId &&
EnchantmentHelper.getEnchantmentLevel(j1, central)>=ench.getMaxLevel())
return false;
if (enchantment.effectId != ench.effectId &&
(!enchantment.canApplyTogether(ench) ||
!ench.canApplyTogether(enchantment))) {
return false;
}
}
ItemStack i2 = null;
ArrayList<ItemStack> ii = new ArrayList<ItemStack>();
for (ItemStack is:input) {
ii.add(is.copy());
}
for (ItemStack comp:components) {
boolean b=false;
for (int a=0;a<ii.size();a++) {
i2 = ii.get(a).copy();
if (comp.getItemDamage()==OreDictionary.WILDCARD_VALUE) {
i2.setItemDamage(OreDictionary.WILDCARD_VALUE);
}
if (areItemStacksEqual(i2, comp,true)) {
ii.remove(a);
b=true;
break;
}
}
if (!b) return false;
}
// System.out.println(ii.size());
return ii.size()==0?true:false;
}
private boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
{
if (stack0==null && stack1!=null) return false;
if (stack0!=null && stack1==null) return false;
if (stack0==null && stack1==null) return true;
boolean t1=false;
if (fuzzy) {
t1=true;
int od = OreDictionary.getOreID(stack0);
if (od!=-1) {
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
return true;
}
}
else
t1=ItemStack.areItemStackTagsEqual(stack0, stack1);
return stack0.getItem() != stack1.getItem() ? false : (stack0.getItemDamage() != stack1.getItemDamage() ? false : (stack0.stackSize > stack0.getMaxStackSize() ? false : t1));
}
public Enchantment getEnchantment() {
return enchantment;
}
public AspectList getAspects() {
return aspects;
}
public String getResearch() {
return research;
}
public int calcInstability(ItemStack recipeInput) {
int i = 0;
Map map1 = EnchantmentHelper.getEnchantments(recipeInput);
Iterator iterator = map1.keySet().iterator();
while (iterator.hasNext())
{
int j1 = ((Integer)iterator.next()).intValue();
i += EnchantmentHelper.getEnchantmentLevel(j1, recipeInput);
}
return (i/2) + instability;
}
public int calcXP(ItemStack recipeInput) {
return recipeXP * (1+EnchantmentHelper.getEnchantmentLevel(enchantment.effectId, recipeInput));
}
public float getEssentiaMod(ItemStack recipeInput) {
float mod = EnchantmentHelper.getEnchantmentLevel(enchantment.effectId, recipeInput);
Map map1 = EnchantmentHelper.getEnchantments(recipeInput);
Iterator iterator = map1.keySet().iterator();
while (iterator.hasNext())
{
int j1 = ((Integer)iterator.next()).intValue();
if (j1 != enchantment.effectId)
mod += EnchantmentHelper.getEnchantmentLevel(j1, recipeInput) * .1f;
}
return mod;
}
}

View file

@ -0,0 +1,128 @@
package thaumcraft.api.crafting;
import java.util.ArrayList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.AspectList;
public class InfusionRecipe
{
protected AspectList aspects;
protected String research;
private ItemStack[] components;
private ItemStack recipeInput;
protected Object recipeOutput;
protected int instability;
public InfusionRecipe(String research, Object output, int inst,
AspectList aspects2, ItemStack input, ItemStack[] recipe) {
this.research = research;
this.recipeOutput = output;
this.recipeInput = input;
this.aspects = aspects2;
this.components = recipe;
this.instability = inst;
}
/**
* Used to check if a recipe matches current crafting inventory
* @param player
*/
public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player) {
if (getRecipeInput()==null) return false;
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) {
return false;
}
ItemStack i2 = central.copy();
if (getRecipeInput().getItemDamage()==OreDictionary.WILDCARD_VALUE) {
i2.setItemDamage(OreDictionary.WILDCARD_VALUE);
}
if (!areItemStacksEqual(i2, getRecipeInput(), true)) return false;
ArrayList<ItemStack> ii = new ArrayList<ItemStack>();
for (ItemStack is:input) {
ii.add(is.copy());
}
for (ItemStack comp:getComponents()) {
boolean b=false;
for (int a=0;a<ii.size();a++) {
i2 = ii.get(a).copy();
if (comp.getItemDamage()==OreDictionary.WILDCARD_VALUE) {
i2.setItemDamage(OreDictionary.WILDCARD_VALUE);
}
if (areItemStacksEqual(i2, comp,true)) {
ii.remove(a);
b=true;
break;
}
}
if (!b) return false;
}
return ii.size()==0?true:false;
}
protected boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
{
if (stack0==null && stack1!=null) return false;
if (stack0!=null && stack1==null) return false;
if (stack0==null && stack1==null) return true;
boolean t1=false;
if (fuzzy) {
t1=true;
int od = OreDictionary.getOreID(stack0);
if (od!=-1) {
ItemStack[] ores = OreDictionary.getOres(od).toArray(new ItemStack[]{});
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[]{stack1}, ores))
return true;
}
}
else
t1=ItemStack.areItemStackTagsEqual(stack0, stack1);
return stack0.getItem() != stack1.getItem() ? false : (stack0.getItemDamage() != stack1.getItemDamage() ? false : (stack0.stackSize > stack0.getMaxStackSize() ? false : t1));
}
public Object getRecipeOutput() {
return getRecipeOutput(this.getRecipeInput());
}
public AspectList getAspects() {
return getAspects(this.getRecipeInput());
}
public int getInstability() {
return getInstability(this.getRecipeInput());
}
public String getResearch() {
return research;
}
public ItemStack getRecipeInput() {
return recipeInput;
}
public ItemStack[] getComponents() {
return components;
}
public Object getRecipeOutput(ItemStack input) {
return recipeOutput;
}
public AspectList getAspects(ItemStack input) {
return aspects;
}
public int getInstability(ItemStack input) {
return instability;
}
}

View file

@ -0,0 +1,261 @@
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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.AspectList;
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 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){ this(research, new ItemStack(result), aspects, 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();
this.research = research;
this.aspects = aspects;
String shape = "";
int idx = 0;
if (recipe[idx] instanceof Boolean)
{
mirrored = (Boolean)recipe[idx];
if (recipe[idx+1] instanceof Object[])
{
recipe = (Object[])recipe[idx+1];
}
else
{
idx = 1;
}
}
if (recipe[idx] instanceof String[])
{
String[] parts = ((String[])recipe[idx++]);
for (String s : parts)
{
width = s.length();
shape += s;
}
height = parts.length;
}
else
{
while (recipe[idx] instanceof String)
{
String s = (String)recipe[idx++];
shape += s;
width = s.length();
height++;
}
}
if (width * height != shape.length())
{
String ret = "Invalid shaped ore recipe: ";
for (Object tmp : recipe)
{
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
for (; idx < recipe.length; idx += 2)
{
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, 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, OreDictionary.getOres((String)in));
}
else
{
String ret = "Invalid shaped ore recipe: ";
for (Object tmp : recipe)
{
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
}
input = new Object[width * height];
int x = 0;
for (char chr : shape.toCharArray())
{
input[x++] = itemMap.get(chr);
}
}
@Override
public ItemStack getCraftingResult(IInventory var1){ return output.copy(); }
@Override
public int getRecipeSize(){ return input.length; }
@Override
public ItemStack getRecipeOutput(){ return output; }
@Override
public boolean matches(IInventory inv, World world, EntityPlayer player)
{
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) {
return false;
}
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++)
{
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y)
{
if (checkMatch(inv, x, y, false))
{
return true;
}
if (mirrored && checkMatch(inv, x, y, true))
{
return true;
}
}
}
return false;
}
private boolean checkMatch(IInventory inv, int startX, int startY, boolean mirror)
{
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++)
{
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++)
{
int subX = x - startX;
int subY = y - startY;
Object target = null;
if (subX >= 0 && subY >= 0 && subX < width && subY < height)
{
if (mirror)
{
target = input[width - subX - 1 + subY * width];
}
else
{
target = input[subX + subY * width];
}
}
ItemStack slot = ThaumcraftApiHelper.getStackInRowAndColumn(inv, x, y);
if (target instanceof ItemStack)
{
if (!checkItemEquals((ItemStack)target, slot))
{
return false;
}
}
else if (target instanceof ArrayList)
{
boolean matched = false;
for (ItemStack item : (ArrayList<ItemStack>)target)
{
matched = matched || checkItemEquals(item, slot);
}
if (!matched)
{
return false;
}
}
else if (target == null && slot != null)
{
return false;
}
}
}
return true;
}
private boolean checkItemEquals(ItemStack target, ItemStack input)
{
if (input == null && target != null || input != null && target == null)
{
return false;
}
return (target.getItem() == input.getItem() &&
(!target.hasTagCompound() || ItemStack.areItemStackTagsEqual(target, input)) &&
(target.getItemDamage() == OreDictionary.WILDCARD_VALUE|| target.getItemDamage() == input.getItemDamage()));
}
public ShapedArcaneRecipe setMirrored(boolean mirror)
{
mirrored = mirror;
return this;
}
/**
* 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()
{
return this.input;
}
@Override
public AspectList getAspects() {
return aspects;
}
@Override
public AspectList getAspects(IInventory inv) {
return aspects;
}
@Override
public String getResearch() {
return research;
}
}

View file

@ -0,0 +1,157 @@
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;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.AspectList;
public class ShapelessArcaneRecipe implements IArcaneRecipe
{
private ItemStack output = null;
private ArrayList input = new ArrayList();
public AspectList aspects = null;
public String research;
public ShapelessArcaneRecipe(String research, Block result, AspectList aspects, Object... recipe){ this(research,new ItemStack(result),aspects, recipe); }
public ShapelessArcaneRecipe(String research, Item result, AspectList aspects, Object... recipe){ this(research,new ItemStack(result),aspects, recipe); }
public ShapelessArcaneRecipe(String research, ItemStack result, AspectList aspects, Object... recipe)
{
output = result.copy();
this.research = research;
this.aspects = aspects;
for (Object in : recipe)
{
if (in instanceof ItemStack)
{
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((Block)in));
}
else if (in instanceof String)
{
input.add(OreDictionary.getOres((String)in));
}
else
{
String ret = "Invalid shapeless ore recipe: ";
for (Object tmp : recipe)
{
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
}
}
@Override
public int getRecipeSize(){ return input.size(); }
@Override
public ItemStack getRecipeOutput(){ return output; }
@Override
public ItemStack getCraftingResult(IInventory var1){ return output.copy(); }
@Override
public boolean matches(IInventory var1, World world, EntityPlayer player)
{
if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) {
return false;
}
ArrayList required = new ArrayList(input);
for (int x = 0; x < 9; x++)
{
ItemStack slot = var1.getStackInSlot(x);
if (slot != null)
{
boolean inRecipe = false;
Iterator req = required.iterator();
while (req.hasNext())
{
boolean match = false;
Object next = req.next();
if (next instanceof ItemStack)
{
match = checkItemEquals((ItemStack)next, slot);
}
else if (next instanceof ArrayList)
{
for (ItemStack item : (ArrayList<ItemStack>)next)
{
match = match || checkItemEquals(item, slot);
}
}
if (match)
{
inRecipe = true;
required.remove(next);
break;
}
}
if (!inRecipe)
{
return false;
}
}
}
return required.isEmpty();
}
private boolean checkItemEquals(ItemStack target, ItemStack input)
{
return (target.getItem() == input.getItem() &&
(!target.hasTagCompound() || ItemStack.areItemStackTagsEqual(target, input)) &&
(target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input.getItemDamage()));
}
/**
* 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()
{
return this.input;
}
@Override
public AspectList getAspects() {
return aspects;
}
@Override
public AspectList getAspects(IInventory inv) {
return aspects;
}
@Override
public String getResearch() {
return research;
}
}

View file

@ -0,0 +1,53 @@
package thaumcraft.api.nodes;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.aspects.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();
public AspectList getAspectsBase();
/**
* 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(Aspect aspect);
/**
* Set the maximum capacity of each aspect the node can hold
* @return
*/
public void setNodeVisBase(Aspect aspect, short nodeVisBase);
}

View file

@ -0,0 +1,22 @@
package thaumcraft.api.nodes;
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.
*
*/
public interface IRevealer {
/*
* If this method returns true the nodes will be visible.
*/
public boolean showNodes(ItemStack itemstack, EntityLivingBase player);
}

View file

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

View file

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

View file

@ -0,0 +1,9 @@
package thaumcraft.api.research;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface IScanEventHandler {
ScanResult scanPhenomena(ItemStack stack, World world, EntityPlayer player);
}

View file

@ -0,0 +1,101 @@
package thaumcraft.api.research;
import java.util.Collection;
import java.util.LinkedHashMap;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.apache.logging.log4j.Level;
import cpw.mods.fml.common.FMLLog;
public class ResearchCategories {
//Research
public static LinkedHashMap <String, ResearchCategoryList> researchCategories = new LinkedHashMap <String,ResearchCategoryList>();
/**
* @param key
* @return the research item linked to this key
*/
public static ResearchCategoryList getResearchList(String key) {
return researchCategories.get(key);
}
/**
* @param key
* @return the name of the research category linked to this key.
* Must be stored as localization information in the LanguageRegistry.
*/
public static String getCategoryName(String key) {
return StatCollector.translateToLocal("tc.research_category."+key);
}
/**
* @param key the research key
* @return the ResearchItem object.
*/
public static ResearchItem getResearch(String key) {
Collection rc = researchCategories.values();
for (Object cat:rc) {
Collection rl = ((ResearchCategoryList)cat).research.values();
for (Object ri:rl) {
if ((((ResearchItem)ri).key).equals(key)) return (ResearchItem)ri;
}
}
return null;
}
/**
* This should only be done at the PostInit stage
* @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
*/
public static void registerCategory(String key, ResourceLocation icon, ResourceLocation background) {
if (getResearchList(key)==null) {
ResearchCategoryList rl = new ResearchCategoryList(icon, background);
researchCategories.put(key, rl);
}
}
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl!=null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr:rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research ["+ri.getName()+"] not added as it overlaps with existing research ["+rr.getName()+"]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn)
{
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow)
{
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn)
{
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow)
{
rl.maxDisplayRow = ri.displayRow;
}
}
}
}

View file

@ -0,0 +1,37 @@
package thaumcraft.api.research;
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 int minDisplayColumn;
/** Is the smallest row used on the GUI. */
public int minDisplayRow;
/** Is the biggest column used on the GUI. */
public int maxDisplayColumn;
/** Is the biggest row used on the GUI. */
public int maxDisplayRow;
/** display variables **/
public ResourceLocation icon;
public ResourceLocation background;
public ResearchCategoryList(ResourceLocation icon, ResourceLocation background) {
this.icon = icon;
this.background = background;
}
//Research
public Map<String, ResearchItem> research = new HashMap<String,ResearchItem>();
}

View file

@ -0,0 +1,367 @@
package thaumcraft.api.research;
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;
public class ResearchItem
{
/**
* A short string used as a key for this research. Must be unique
*/
public final String key;
/**
* A short string used as a reference to the research category to which this must be added.
*/
public final String category;
/**
* The aspect tags and their values required to complete this research
*/
public final AspectList tags;
/**
* This links to any research that needs to be completed before this research can be discovered or learnt.
*/
public String[] parents = null;
/**
* Like parent above, but a line will not be displayed in the thaumonomicon linking them. Just used to prevent clutter.
*/
public String[] parentsHidden = null;
/**
* any research linked to this that will be unlocked automatically when this research is complete
*/
public String[] siblings = null;
/**
* the horizontal position of the research icon
*/
public final int displayColumn;
/**
* the vertical position of the research icon
*/
public final int displayRow;
/**
* the icon to be used for this research
*/
public final ItemStack icon_item;
/**
* the icon to be used for this research
*/
public final ResourceLocation icon_resource;
/**
* How large the research grid is. Valid values are 1 to 3.
*/
private int complexity;
/**
* Special research has a spiky border. Used for important research milestones.
*/
private boolean isSpecial;
/**
* Research that can be directly purchased with RP in normal research difficulty.
*/
private boolean isSecondary;
/**
* This indicates if the research should use a circular icon border. Usually used for "passive" research
* that doesn't have recipes and grants passive effects, or that unlock automatically.
*/
private boolean isRound;
/**
* Stub research cannot be discovered by normal means, but can be unlocked via the sibling system.
*/
private boolean isStub;
/**
* This indicated that the research is completely hidden and cannot be discovered by any
* player-controlled means. The recipes will never show up in the thaumonomicon.
* Usually used to unlock "hidden" recipes via sibling unlocking, like
* the various cap and rod combos for wands.
*/
private boolean isVirtual;
@Deprecated
private boolean isLost;
/**
* Concealed research does not display in the thaumonomicon until parent researches are discovered.
*/
private boolean isConcealed;
/**
* Hidden research can only be discovered via scanning or knowledge fragments
*/
private boolean isHidden;
/**
* These research items will automatically unlock for all players on game start
*/
private boolean isAutoUnlock;
/**
* Scanning these items will have a chance of revealing hidden knowledge in the thaumonomicon
*/
private ItemStack[] itemTriggers;
/**
* Scanning these entities will have a chance of revealing hidden knowledge in the thaumonomicon
*/
private String[] entityTriggers;
/**
* Scanning things with these aspects will have a chance of revealing hidden knowledge in the thaumonomicon
*/
private Aspect[] aspectTriggers;
private ResearchPage[] pages = null;
public ResearchItem(String key, String category)
{
this.key = key;
this.category = category;
this.tags = new AspectList();
this.icon_resource = null;
this.icon_item = null;
this.displayColumn = 0;
this.displayRow = 0;
this.setVirtual();
}
public ResearchItem(String key, String category, AspectList tags, int col, int row, int complex, ResourceLocation icon)
{
this.key = key;
this.category = category;
this.tags = tags;
this.icon_resource = icon;
this.icon_item = null;
this.displayColumn = col;
this.displayRow = row;
this.complexity = complex;
if (complexity < 1) this.complexity = 1;
if (complexity > 3) this.complexity = 3;
}
public ResearchItem(String key, String category, AspectList tags, int col, int row, int complex, ItemStack icon)
{
this.key = key;
this.category = category;
this.tags = tags;
this.icon_item = icon;
this.icon_resource = null;
this.displayColumn = col;
this.displayRow = row;
this.complexity = complex;
if (complexity < 1) this.complexity = 1;
if (complexity > 3) this.complexity = 3;
}
public ResearchItem setSpecial()
{
this.isSpecial = true;
return this;
}
public ResearchItem setStub()
{
this.isStub = true;
return this;
}
@Deprecated
public ResearchItem setLost()
{
this.isLost = true;
return this;
}
public ResearchItem setConcealed()
{
this.isConcealed = true;
return this;
}
public ResearchItem setHidden()
{
this.isHidden = true;
return this;
}
public ResearchItem setVirtual()
{
this.isVirtual = true;
return this;
}
public ResearchItem setParents(String... par)
{
this.parents = par;
return this;
}
public ResearchItem setParentsHidden(String... par)
{
this.parentsHidden = par;
return this;
}
public ResearchItem setSiblings(String... sib)
{
this.siblings = sib;
return this;
}
public ResearchItem setPages(ResearchPage... par)
{
this.pages = par;
return this;
}
public ResearchPage[] getPages() {
return pages;
}
public ResearchItem setItemTriggers(ItemStack... par)
{
this.itemTriggers = par;
return this;
}
public ResearchItem setEntityTriggers(String... par)
{
this.entityTriggers = par;
return this;
}
public ResearchItem setAspectTriggers(Aspect... par)
{
this.aspectTriggers = par;
return this;
}
public ItemStack[] getItemTriggers() {
return itemTriggers;
}
public String[] getEntityTriggers() {
return entityTriggers;
}
public Aspect[] getAspectTriggers() {
return aspectTriggers;
}
public ResearchItem registerResearchItem()
{
ResearchCategories.addResearch(this);
return this;
}
public String getName()
{
return StatCollector.translateToLocal("tc.research_name."+key);
}
public String getText()
{
return StatCollector.translateToLocal("tc.research_text."+key);
}
public boolean isSpecial()
{
return this.isSpecial;
}
public boolean isStub()
{
return this.isStub;
}
@Deprecated
public boolean isLost()
{
return this.isLost;
}
public boolean isConcealed()
{
return this.isConcealed;
}
public boolean isHidden()
{
return this.isHidden;
}
public boolean isVirtual()
{
return this.isVirtual;
}
public boolean isAutoUnlock() {
return isAutoUnlock;
}
public ResearchItem setAutoUnlock()
{
this.isAutoUnlock = true;
return this;
}
public boolean isRound() {
return isRound;
}
public ResearchItem setRound() {
this.isRound = true;
return this;
}
public boolean isSecondary() {
return isSecondary;
}
public ResearchItem setSecondary() {
this.isSecondary = true;
return this;
}
public int getComplexity() {
return complexity;
}
public ResearchItem setComplexity(int complexity) {
this.complexity = complexity;
return this;
}
/**
* @return the aspect aspects ordinal with the highest value. Used to determine scroll color and similar things
*/
public Aspect getResearchPrimaryTag() {
Aspect aspect=null;
int highest=0;
if (tags!=null)
for (Aspect tag:tags.getAspects()) {
if (tags.getAmount(tag)>highest) {
aspect=tag;
highest=tags.getAmount(tag);
};
}
return aspect;
}
}

View file

@ -0,0 +1,174 @@
package thaumcraft.api.research;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.crafting.CrucibleRecipe;
import thaumcraft.api.crafting.IArcaneRecipe;
import thaumcraft.api.crafting.InfusionEnchantmentRecipe;
import thaumcraft.api.crafting.InfusionRecipe;
public class ResearchPage {
public static enum PageType
{
TEXT,
TEXT_CONCEALED,
IMAGE,
CRUCIBLE_CRAFTING,
ARCANE_CRAFTING,
ASPECTS,
NORMAL_CRAFTING,
INFUSION_CRAFTING,
COMPOUND_CRAFTING,
INFUSION_ENCHANTMENT
}
public PageType type = PageType.TEXT;
public String text=null;
public String research=null;
public ResourceLocation image=null;
public AspectList aspects=null;
public Object recipe=null;
public ItemStack recipeOutput=null;
/**
* @param text this can (but does not have to) be a reference to a localization variable, not the actual text.
*/
public ResearchPage(String text) {
this.type = PageType.TEXT;
this.text = text;
}
/**
* @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.
*/
public ResearchPage(String research, String text) {
this.type = PageType.TEXT_CONCEALED;
this.research = research;
this.text = text;
}
/**
* @param recipe a vanilla crafting recipe.
*/
public ResearchPage(IRecipe recipe) {
this.type = PageType.NORMAL_CRAFTING;
this.recipe = recipe;
this.recipeOutput = recipe.getRecipeOutput();
}
/**
* @param recipe a collection of vanilla crafting recipes.
*/
public ResearchPage(IRecipe[] recipe) {
this.type = PageType.NORMAL_CRAFTING;
this.recipe = recipe;
}
/**
* @param recipe a collection of arcane crafting recipes.
*/
public ResearchPage(IArcaneRecipe[] recipe) {
this.type = PageType.ARCANE_CRAFTING;
this.recipe = recipe;
}
/**
* @param recipe a collection of infusion crafting recipes.
*/
public ResearchPage(InfusionRecipe[] recipe) {
this.type = PageType.INFUSION_CRAFTING;
this.recipe = recipe;
}
/**
* @param recipe a compound crafting recipe.
*/
public ResearchPage(List recipe) {
this.type = PageType.COMPOUND_CRAFTING;
this.recipe = recipe;
}
/**
* @param recipe an arcane worktable crafting recipe.
*/
public ResearchPage(IArcaneRecipe recipe) {
this.type = PageType.ARCANE_CRAFTING;
this.recipe = recipe;
this.recipeOutput = recipe.getRecipeOutput();
}
/**
* @param recipe an alchemy crafting recipe.
*/
public ResearchPage(CrucibleRecipe recipe) {
this.type = PageType.CRUCIBLE_CRAFTING;
this.recipe = recipe;
this.recipeOutput = recipe.getRecipeOutput();
}
/**
* @param recipe an infusion crafting recipe.
*/
public ResearchPage(InfusionRecipe recipe) {
this.type = PageType.INFUSION_CRAFTING;
this.recipe = recipe;
if (recipe.getRecipeOutput() instanceof ItemStack) {
this.recipeOutput = (ItemStack) recipe.getRecipeOutput();
} else {
this.recipeOutput = recipe.getRecipeInput();
}
}
/**
* @param recipe an infusion crafting recipe.
*/
public ResearchPage(InfusionEnchantmentRecipe recipe) {
this.type = PageType.INFUSION_ENCHANTMENT;
this.recipe = recipe;
// if (recipe.recipeOutput instanceof ItemStack) {
// this.recipeOutput = (ItemStack) recipe.recipeOutput;
// } else {
// this.recipeOutput = recipe.recipeInput;
// }
}
/**
* @param image
* @param caption this can (but does not have to) be a reference to a localization variable, not the actual text.
*/
public ResearchPage(ResourceLocation image, String caption) {
this.type = PageType.IMAGE;
this.image = image;
this.text = caption;
}
/**
* This function should really not be called directly - used internally
*/
public ResearchPage(AspectList as) {
this.type = PageType.ASPECTS;
this.aspects = as;
}
/**
* returns a localized text of the text field (if one exists). Returns the text field itself otherwise.
* @return
*/
public String getTranslatedText() {
String ret="";
if (text != null) {
ret = StatCollector.translateToLocal(text);
if (ret.isEmpty()) ret = text;
}
return ret;
}
}

View file

@ -0,0 +1,39 @@
package thaumcraft.api.research;
import net.minecraft.entity.Entity;
public class ScanResult {
public byte type = 0; //1=blocks,2=entities,3=phenomena
public int id;
public int meta;
public Entity entity;
public String phenomena;
public ScanResult(byte type, int blockId, int blockMeta, Entity entity,
String phenomena) {
super();
this.type = type;
this.id = blockId;
this.meta = blockMeta;
this.entity = entity;
this.phenomena = phenomena;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof ScanResult) {
ScanResult sr = (ScanResult) obj;
if (type != sr.type)
return false;
if (type == 1
&& (id != sr.id || meta != sr.meta))
return false;
if (type == 2 && entity.getEntityId() != sr.entity.getEntityId())
return false;
if (type == 3 && !phenomena.equals(sr.phenomena))
return false;
}
return true;
}
}

View file

@ -0,0 +1,64 @@
package thaumcraft.api.wands;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import thaumcraft.api.aspects.AspectList;
public interface IWandFocus {
public enum WandFocusAnimation {
WAVE, CHARGE;
}
/**
* @return The color the focus should be changed to.
*/
public int getFocusColor();
/**
* @return An icon that will be drawn as a block inside the focus "block".
*/
IIcon getFocusDepthLayerIcon();
public IIcon getOrnament();
public WandFocusAnimation getAnimation();
/**
* Gets the amount of vis used per aspect per click or tick. This cost is actually listed as
* a hundredth of a single point of vis, so a cost of 100 will equal one vis per tick/click.
* It is returned as an AspectList to allow for multiple vis types in different ratios.
*/
public AspectList getVisCost();
public boolean isVisCostPerTick();
public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition movingobjectposition);
public void onUsingFocusTick(ItemStack itemstack, EntityPlayer player, int count);
public void onPlayerStoppedUsingFocus(ItemStack itemstack, World world, EntityPlayer player, int count);
/**
* 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
* two numeric characters based on... whatever.
*/
public String getSortingHelper(ItemStack itemstack);
boolean onFocusBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player);
public boolean acceptsEnchant(int id);
}

View file

@ -0,0 +1,16 @@
package thaumcraft.api.wands;
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.
*
*/
public interface IWandRodOnUpdate {
void onUpdate(ItemStack itemstack, EntityPlayer player);
}

View file

@ -0,0 +1,12 @@
package thaumcraft.api.wands;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface IWandTriggerManager {
public boolean performTrigger(World world, ItemStack wand, EntityPlayer player,
int x, int y, int z, int side, int event);
}

View file

@ -0,0 +1,25 @@
package thaumcraft.api.wands;
import net.minecraft.entity.player.EntityPlayer;
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.
*
*/
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);
public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count);
public void onWandStoppedUsing(ItemStack wandstack, World world, EntityPlayer player, int count);
}

View file

@ -0,0 +1,166 @@
package thaumcraft.api.wands;
import java.text.DecimalFormat;
import java.util.List;
import java.util.Map;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
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 {
public ItemFocusBasic ()
{
super();
maxStackSize = 1;
canRepair=false;
this.setMaxDamage(0);
}
public IIcon icon;
@SideOnly(Side.CLIENT)
@Override
public IIcon getIconFromDamage(int par1) {
return icon;
}
@Override
public boolean isItemTool(ItemStack par1ItemStack)
{
return true;
}
@Override
public boolean isDamageable() {
return true;
}
@Override
public void addInformation(ItemStack stack,EntityPlayer player, List list, boolean par4) {
AspectList al = this.getVisCost();
if (al!=null && al.size()>0) {
list.add(StatCollector.translateToLocal(isVisCostPerTick()?"item.Focus.cost2":"item.Focus.cost1"));
for (Aspect aspect:al.getAspectsSorted()) {
DecimalFormat myFormatter = new DecimalFormat("#####.##");
String amount = myFormatter.format(al.getAmount(aspect)/100f);
list.add(" \u00A7"+aspect.getChatcolor()+aspect.getName()+"\u00A7r x "+ amount);
}
}
}
@Override
public int getItemEnchantability() {
return 5;
}
@Override
public EnumRarity getRarity(ItemStack itemstack)
{
return EnumRarity.rare;
}
@Override
public int getFocusColor() {
// TODO Auto-generated method stub
return 0;
}
@Override
public AspectList getVisCost() {
// TODO Auto-generated method stub
return null;
}
@Override
public ItemStack onFocusRightClick(ItemStack itemstack, World world,
EntityPlayer player, MovingObjectPosition movingobjectposition) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onUsingFocusTick(ItemStack itemstack, EntityPlayer player,
int count) {
// TODO Auto-generated method stub
}
@Override
public void onPlayerStoppedUsingFocus(ItemStack itemstack, World world,
EntityPlayer player, int count) {
// TODO Auto-generated method stub
}
/**
* Just insert two alphanumeric characters before this string in your focus item class
*/
@Override
public String getSortingHelper(ItemStack itemstack) {
Map<Integer,Integer> ench = EnchantmentHelper.getEnchantments(itemstack);
String out="";
for (Integer lvl:ench.values()) {
out = out + lvl + "";
}
return out;
}
@Override
public boolean isVisCostPerTick() {
return false;
}
@Override
public IIcon getOrnament() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean onFocusBlockStartBreak(ItemStack itemstack, int x, int y,
int z, EntityPlayer player) {
// TODO Auto-generated method stub
return false;
}
@Override
public WandFocusAnimation getAnimation() {
return WandFocusAnimation.WAVE;
}
@Override
public IIcon getFocusDepthLayerIcon() {
// TODO Auto-generated method stub
return null;
}
/**
* @see thaumcraft.api.wands.IWandFocus#acceptsEnchant(int)
* By default fortune is off for all wands
**/
@Override
public boolean acceptsEnchant(int id) {
if (id==ThaumcraftApi.enchantFrugal||
id==ThaumcraftApi.enchantPotency) return true;
return false;
}
}

View file

@ -0,0 +1,48 @@
package thaumcraft.api.wands;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
/**
*
* @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.
*
*/
public class StaffRod extends WandRod {
boolean runes=false;
public StaffRod(String tag, int capacity, ItemStack item, int craftCost) {
super(tag+"_staff", capacity, item, craftCost);
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+tag+".png");
}
public StaffRod(String tag, int capacity, ItemStack item, int craftCost,
IWandRodOnUpdate onUpdate, ResourceLocation texture) {
super(tag+"_staff", capacity, item, craftCost, onUpdate, texture);
}
public StaffRod(String tag, int capacity, ItemStack item, int craftCost,
IWandRodOnUpdate onUpdate) {
super(tag+"_staff", capacity, item, craftCost, onUpdate);
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+tag+".png");
}
public StaffRod(String tag, int capacity, ItemStack item, int craftCost,
ResourceLocation texture) {
super(tag+"_staff", capacity, item, craftCost, texture);
}
public boolean hasRunes() {
return runes;
}
public void setRunes(boolean hasRunes) {
this.runes = hasRunes;
}
}

View file

@ -0,0 +1,122 @@
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;
/**
* 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
*
*/
public class WandCap {
private String tag;
/**
* Cost to craft this wand. Combined with the rod cost.
*/
private int craftCost;
/**
* the amount by which all aspect costs are multiplied
*/
float baseCostModifier;
/**
* specifies a list of primal aspects that use the special discount figure instead of the normal discount.
*/
List<Aspect> specialCostModifierAspects;
/**
* the amount by which the specified aspect costs are multiplied
*/
float specialCostModifier;
/**
* The texture that will be used for the ingame wand cap
*/
ResourceLocation texture;
/**
* the actual item that makes up this cap and will be used to generate the wand recipes
*/
ItemStack item;
public static LinkedHashMap<String,WandCap> caps = new LinkedHashMap<String,WandCap>();
public WandCap (String tag, float discount, ItemStack item, int craftCost) {
this.setTag(tag);
this.baseCostModifier = discount;
this.specialCostModifierAspects = null;
texture = new ResourceLocation("thaumcraft","textures/models/wand_cap_"+getTag()+".png");
this.item=item;
this.setCraftCost(craftCost);
caps.put(tag, this);
}
public WandCap (String tag, float discount, List<Aspect> specialAspects, float discountSpecial, ItemStack item, int craftCost) {
this.setTag(tag);
this.baseCostModifier = discount;
this.specialCostModifierAspects = specialAspects;
this.specialCostModifier = discountSpecial;
texture = new ResourceLocation("thaumcraft","textures/models/wand_cap_"+getTag()+".png");
this.item=item;
this.setCraftCost(craftCost);
caps.put(tag, this);
}
public float getBaseCostModifier() {
return baseCostModifier;
}
public List<Aspect> getSpecialCostModifierAspects() {
return specialCostModifierAspects;
}
public float getSpecialCostModifier() {
return specialCostModifier;
}
public ResourceLocation getTexture() {
return texture;
}
public void setTexture(ResourceLocation texture) {
this.texture = texture;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public ItemStack getItem() {
return item;
}
public void setItem(ItemStack item) {
this.item = item;
}
public int getCraftCost() {
return craftCost;
}
public void setCraftCost(int craftCost) {
this.craftCost = craftCost;
}
// Some examples:
// WandCap WAND_CAP_IRON = new WandCap("iron", 1.1f, Arrays.asList(Aspect.ORDER),1, new ItemStack(ConfigItems.itemWandCap,1,0),1);
// WandCap WAND_CAP_GOLD = new WandCap("gold", 1f, new ItemStack(ConfigItems.itemWandCap,1,1),3);
}

View file

@ -0,0 +1,151 @@
package thaumcraft.api.wands;
import java.util.LinkedHashMap;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
/**
*
* @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.
*
*/
public class WandRod {
private String tag;
/**
* Cost to craft this wand. Combined with the rod cost.
*/
private int craftCost;
/**
* The amount of vis that can be stored - this number is actually multiplied
* by 100 for use by the wands internals
*/
int capacity;
/**
* The texture that will be used for the ingame wand rod
*/
protected ResourceLocation texture;
/**
* the actual item that makes up this rod and will be used to generate the wand recipes
*/
ItemStack item;
/**
* A class that will be called whenever the wand onUpdate tick is run
*/
IWandRodOnUpdate onUpdate;
/**
* Does the rod glow in the dark?
*/
boolean glow;
public static LinkedHashMap<String,WandRod> rods = new LinkedHashMap<String,WandRod>();
public WandRod (String tag, int capacity, ItemStack item, int craftCost, ResourceLocation texture) {
this.setTag(tag);
this.capacity = capacity;
this.texture = texture;
this.item=item;
this.setCraftCost(craftCost);
rods.put(tag, this);
}
public WandRod (String tag, int capacity, ItemStack item, int craftCost, IWandRodOnUpdate onUpdate, ResourceLocation texture) {
this.setTag(tag);
this.capacity = capacity;
this.texture = texture;
this.item=item;
this.setCraftCost(craftCost);
rods.put(tag, this);
this.onUpdate = onUpdate;
}
public WandRod (String tag, int capacity, ItemStack item, int craftCost) {
this.setTag(tag);
this.capacity = capacity;
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+getTag()+".png");
this.item=item;
this.setCraftCost(craftCost);
rods.put(tag, this);
}
public WandRod (String tag, int capacity, ItemStack item, int craftCost, IWandRodOnUpdate onUpdate) {
this.setTag(tag);
this.capacity = capacity;
this.texture = new ResourceLocation("thaumcraft","textures/models/wand_rod_"+getTag()+".png");
this.item=item;
this.setCraftCost(craftCost);
rods.put(tag, this);
this.onUpdate = onUpdate;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public int getCapacity() {
return capacity;
}
public void setCapacity(int capacity) {
this.capacity = capacity;
}
public ResourceLocation getTexture() {
return texture;
}
public void setTexture(ResourceLocation texture) {
this.texture = texture;
}
public ItemStack getItem() {
return item;
}
public void setItem(ItemStack item) {
this.item = item;
}
public int getCraftCost() {
return craftCost;
}
public void setCraftCost(int craftCost) {
this.craftCost = craftCost;
}
public IWandRodOnUpdate getOnUpdate() {
return onUpdate;
}
public void setOnUpdate(IWandRodOnUpdate onUpdate) {
this.onUpdate = onUpdate;
}
public boolean isGlowing() {
return glow;
}
public void setGlowing(boolean hasGlow) {
this.glow = hasGlow;
}
// Some examples:
// WandRod WAND_ROD_WOOD = new WandRod("wood",25,new ItemStack(Item.stick),1);
// WandRod WAND_ROD_BLAZE = new WandRod("blaze",100,new ItemStack(Item.blazeRod),7,new WandRodBlazeOnUpdate());
}

View file

@ -0,0 +1,72 @@
package thaumcraft.api.wands;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* 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
* blocks where you can't control what happens in their code.
* Example where it is used is in crafting the thaumonomicon from a bookshelf and the
* crucible from a cauldron
*
* @author azanor
*
*/
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 block
* @param meta send -1 as a wildcard value for all possible meta values
*/
public static void registerWandBlockTrigger(IWandTriggerManager manager, int event, Block block, int meta) {
triggers.put(Arrays.asList(block,meta),
Arrays.asList(manager,event));
}
private static HashMap<List,List> triggers = new HashMap<List,List>();
public static boolean hasTrigger(Block block, int meta) {
if (triggers.containsKey(Arrays.asList(block,meta)) ||
triggers.containsKey(Arrays.asList(block,-1))) return true;
return false;
}
/**
* 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
* @param x
* @param y
* @param z
* @param side
* @param block
* @param meta
* @return
*/
public static boolean performTrigger(World world, ItemStack wand, EntityPlayer player,
int x, int y, int z, int side, Block block, int meta) {
List l = triggers.get(Arrays.asList(block,meta));
if (l==null) l = triggers.get(Arrays.asList(block,-1));
if (l==null) return false;
IWandTriggerManager manager = (IWandTriggerManager) l.get(0);
int event = (Integer) l.get(1);
return manager.performTrigger(world, wand, player, x, y, z, side, event);
}
}

View file

@ -0,0 +1,979 @@
package WayofTime.alchemicalWizardry;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import joshie.alchemicalWizardy.ShapedBloodOrbRecipe;
import joshie.alchemicalWizardy.ShapelessBloodOrbRecipe;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.RecipeSorter.Category;
import thaumcraft.api.ItemApi;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemicalPotionCreationHandler;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.api.altarRecipeRegistry.AltarRecipeRegistry;
import WayofTime.alchemicalWizardry.api.bindingRegistry.BindingRegistry;
import WayofTime.alchemicalWizardry.api.rituals.Rituals;
import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardryFuelHandler;
import WayofTime.alchemicalWizardry.common.CommonProxy;
import WayofTime.alchemicalWizardry.common.EntityAirElemental;
import WayofTime.alchemicalWizardry.common.LifeBucketHandler;
import WayofTime.alchemicalWizardry.common.LifeEssence;
import WayofTime.alchemicalWizardry.common.ModLivingDropsEvent;
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
import WayofTime.alchemicalWizardry.common.block.ArmourForge;
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBileDemon;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBoulderFist;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityEarthElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityFallenAngel;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityFireElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityHolyElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityIceDemon;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityLowerGuardian;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityShade;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityShadeElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntitySmallEarthGolem;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWaterElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWingedFireDemon;
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.items.thaumcraft.ItemSanguineArmour;
import WayofTime.alchemicalWizardry.common.potion.PotionBoost;
import WayofTime.alchemicalWizardry.common.potion.PotionDrowning;
import WayofTime.alchemicalWizardry.common.potion.PotionFireFuse;
import WayofTime.alchemicalWizardry.common.potion.PotionFlameCloak;
import WayofTime.alchemicalWizardry.common.potion.PotionFlight;
import WayofTime.alchemicalWizardry.common.potion.PotionHeavyHeart;
import WayofTime.alchemicalWizardry.common.potion.PotionIceCloak;
import WayofTime.alchemicalWizardry.common.potion.PotionInhibit;
import WayofTime.alchemicalWizardry.common.potion.PotionPlanarBinding;
import WayofTime.alchemicalWizardry.common.potion.PotionProjectileProtect;
import WayofTime.alchemicalWizardry.common.potion.PotionReciprocation;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectAnimalGrowth;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectAutoAlchemy;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectBiomeChanger;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectContainment;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectCrushing;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectExpulsion;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectFeatheredEarth;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectFeatheredKnife;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectFlight;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectGrowth;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectHealing;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectInterdiction;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectItemSuction;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectJumping;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectLava;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectLeap;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectMagnetic;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectSoulBound;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectSummonMeteor;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectSupression;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectUnbinding;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectWater;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectWellOfSuffering;
import WayofTime.alchemicalWizardry.common.spell.simple.HomSpellRegistry;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellEarthBender;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellExplosions;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellFireBurst;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellFrozenWater;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellHolyBlast;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellLightningBolt;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellWateryGrave;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellWindGust;
import WayofTime.alchemicalWizardry.common.summoning.SummoningHelperAW;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit;
import WayofTime.alchemicalWizardry.common.tileEntity.TEDemonPortal;
import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
import WayofTime.alchemicalWizardry.common.tileEntity.TESchematicSaver;
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "v1.0.1g")
//@NetworkMod(clientSideRequired = true, serverSideRequired = false, channels = {"BloodAltar", "particle", "SetLifeEssence", "GetLifeEssence", "Ritual", "GetAltarEssence", "TESocket", "TEWritingTable", "CustomParticle", "SetPlayerVel", "SetPlayerPos", "TEPedestal", "TEPlinth", "TETeleposer", "InfiniteLPPath", "TEOrientor"}, packetHandler = PacketHandler.class)
public class AlchemicalWizardry
{
public static boolean doMeteorsDestroyBlocks = true;
public static String[] diamondMeteorArray;
public static int diamondMeteorRadius;
public static String[] stoneMeteorArray;
public static int stoneMeteorRadius;
public static String[] ironBlockMeteorArray;
public static int ironBlockMeteorRadius;
public static String[] netherStarMeteorArray;
public static int netherStarMeteorRadius;
public static String[] allowedCrushedOresArray;
public static Potion customPotionDrowning;
public static Potion customPotionBoost;
public static Potion customPotionProjProt;
public static Potion customPotionInhibit;
public static Potion customPotionFlight;
public static Potion customPotionReciprocation;
public static Potion customPotionFlameCloak;
public static Potion customPotionIceCloak;
public static Potion customPotionHeavyHeart;
public static Potion customPotionFireFuse;
public static Potion customPotionPlanarBinding;
public static int customPotionDrowningID;
public static int customPotionBoostID;
public static int customPotionProjProtID;
public static int customPotionInhibitID;
public static int customPotionFlightID;
public static int customPotionReciprocationID;
public static int customPotionFlameCloakID;
public static int customPotionIceCloakID;
public static int customPotionHeavyHeartID;
public static int customPotionFireFuseID;
public static int customPotionPlanarBindingID;
public static boolean isThaumcraftLoaded;
public static boolean isForestryLoaded;
public static boolean wimpySettings;
public static CreativeTabs tabBloodMagic = new CreativeTabs("tabBloodMagic")
{
@Override
public ItemStack getIconItemStack()
{
return new ItemStack(ModItems.weakBloodOrb, 1, 0);
}
@Override
public Item getTabIconItem()
{
return ModItems.weakBloodOrb;
}
};
public static ToolMaterial bloodBoundToolMaterial = EnumHelper.addToolMaterial("BoundBlood", 4, 1000, 12.0f, 8.0f, 50);
public static ArmorMaterial sanguineArmourArmourMaterial = EnumHelper.addArmorMaterial("SanguineArmour", 1000, new int[]{3, 6, 5, 2}, 30);
//Dungeon loot chances
public static int standardBindingAgentDungeonChance;
public static int mundanePowerCatalystDungeonChance;
public static int averagePowerCatalystDungeonChance;
public static int greaterPowerCatalystDungeonChance;
public static int mundaneLengtheningCatalystDungeonChance;
public static int averageLengtheningCatalystDungeonChance;
public static int greaterLengtheningCatalystDungeonChance;
//Mob IDs
public static int entityFallenAngelID = 20;
public static int entityLowerGuardianID = 21;
public static int entityBileDemonID = 22;
public static int entityWingedFireDemonID = 23;
public static int entitySmallEarthGolemID = 24;
public static int entityIceDemonID = 25;
public static int entityBoulderFistID = 26;
public static int entityShadeID = 27;
public static int entityAirElementalID = 28;
public static int entityWaterElementalID = 29;
public static int entityEarthElementalID = 30;
public static int entityFireElementalID = 31;
public static int entityShadeElementalID = 32;
public static int entityHolyElementalID = 33;
public static Fluid lifeEssenceFluid;
// The instance of your mod that Forge uses.
@Instance("AWWayofTime")
public static AlchemicalWizardry instance;
// Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide = "WayofTime.alchemicalWizardry.client.ClientProxy", serverSide = "WayofTime.alchemicalWizardry.common.CommonProxy")
public static CommonProxy proxy;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
File bmDirectory = new File("config/BloodMagic/schematics");
if(!bmDirectory.exists() && bmDirectory.mkdirs())
{
try
{
InputStream in = AlchemicalWizardry.class.getResourceAsStream("/assets/alchemicalwizardry/schematics/building/buildings.zip");
System.out.println("none yet!");
if(in != null)
{
System.out.println("I have found a zip!");
ZipInputStream zipStream = new ZipInputStream(in);
ZipEntry entry = null;
int extractCount = 0;
while((entry = zipStream.getNextEntry()) != null)
{
File file = new File(bmDirectory, entry.getName());
if(file.exists() && file.length() > 3L)
{
continue;
}
FileOutputStream out = new FileOutputStream(file);
byte[] buffer = new byte[8192];
int len;
while((len = zipStream.read(buffer)) != -1)
{
out.write(buffer, 0, len);
}
out.close();
extractCount++;
}
}
}
catch(Exception e)
{
}
}
TEDemonPortal.loadBuildingList();
MinecraftForge.EVENT_BUS.register(new LifeBucketHandler());
BloodMagicConfiguration.init(new File(event.getModConfigurationDirectory(), "AWWayofTime.cfg"));
//Custom config stuff goes here
Potion[] potionTypes = null;
for (Field f : Potion.class.getDeclaredFields())
{
f.setAccessible(true);
try
{
if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a"))
{
Field modfield = Field.class.getDeclaredField("modifiers");
modfield.setAccessible(true);
modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL);
potionTypes = (Potion[]) f.get(null);
final Potion[] newPotionTypes = new Potion[256];
System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length);
f.set(null, newPotionTypes);
}
} catch (Exception e)
{
System.err.println("Severe error, please report this to the mod author:");
System.err.println(e);
}
}
AlchemicalWizardry.lifeEssenceFluid = new LifeEssence("Life Essence");
FluidRegistry.registerFluid(lifeEssenceFluid);
ModBlocks.init();
ModBlocks.registerBlocksInPre();
ModItems.init();
ModItems.registerItems();
RecipeSorter.INSTANCE.register("AWWayofTime:shapedorb", ShapedBloodOrbRecipe.class, Category.SHAPED, "before:minecraft:shapeless");
RecipeSorter.INSTANCE.register("AWWayofTime:shapelessorb", ShapelessBloodOrbRecipe.class, Category.SHAPELESS, "after:minecraft:shapeless");
//FMLCommonHandler.instance().bus().register(new AlchemicalWizardryEventHooks());
MinecraftForge.EVENT_BUS.register(new AlchemicalWizardryEventHooks());
NewPacketHandler.INSTANCE.ordinal();
}
@EventHandler
public void load(FMLInitializationEvent event)
{
int craftingConstant = OreDictionary.WILDCARD_VALUE;
//TickRegistry.registerTickHandler(new AlchemicalWizardryTickHandler(), Side.SERVER);
ModBlocks.registerBlocksInInit();
//blocks
proxy.registerRenderers();
proxy.registerEntities();
proxy.registerEntityTrackers();
//ItemStacks used for crafting go here
ItemStack lapisStack = new ItemStack(Items.dye,1,4);
ItemStack lavaBucketStack = new ItemStack(Items.lava_bucket);
ItemStack cobblestoneStack = new ItemStack(Blocks.cobblestone);
ItemStack glassStack = new ItemStack(Blocks.glass, 1, craftingConstant);
ItemStack ironIngotStack = new ItemStack(Items.iron_ingot);
ItemStack diamondStack = new ItemStack(Items.diamond, 1, craftingConstant);
ItemStack woolStack = new ItemStack(Blocks.wool);
ItemStack goldNuggetStack = new ItemStack(Items.gold_nugget);
ItemStack stoneStack = new ItemStack(Blocks.stone, 1, craftingConstant);
ItemStack redstoneStack = new ItemStack(Items.redstone);
ItemStack glowstoneBlockStack = new ItemStack(Blocks.glowstone);
ItemStack ironBlockStack = new ItemStack(Blocks.iron_block);
ItemStack waterBucketStack = new ItemStack(Items.water_bucket);
ItemStack emptyBucketStack = new ItemStack(Items.bucket);
ItemStack magmaCreamStack = new ItemStack(Items.magma_cream);
ItemStack stringStack = new ItemStack(Items.string);
ItemStack obsidianStack = new ItemStack(Blocks.obsidian);
ItemStack diamondSwordStack = new ItemStack(Items.diamond_sword);
ItemStack goldIngotStack = new ItemStack(Items.gold_ingot);
ItemStack cauldronStack = new ItemStack(Blocks.cauldron);
ItemStack furnaceStack = new ItemStack(Blocks.furnace);
ItemStack sugarStack = new ItemStack(Items.sugar);
ItemStack featherStack = new ItemStack(Items.feather);
ItemStack ghastTearStack = new ItemStack(Items.ghast_tear);
ItemStack ironPickaxeStack = new ItemStack(Items.iron_pickaxe);
ItemStack ironAxeStack = new ItemStack(Items.iron_axe);
ItemStack ironShovelStack = new ItemStack(Items.iron_shovel);
ItemStack glowstoneDustStack = new ItemStack(Items.glowstone_dust);
ItemStack saplingStack = new ItemStack(Blocks.sapling);
ItemStack reedStack = new ItemStack(Items.reeds);
ItemStack blankSlateStack = new ItemStack(ModItems.blankSlate, 1, craftingConstant);
//ItemStack glassShardStack = new ItemStack(glassShard);
ItemStack weakBloodOrbStackCrafted = new ItemStack(ModItems.weakBloodOrb);
//ItemStack bloodiedShardStack = new ItemStack(bloodiedShard);
ItemStack reinforcedSlateStack = new ItemStack(ModItems.reinforcedSlate, 1, craftingConstant);
ItemStack weakBloodOrbStack = new ItemStack(ModItems.weakBloodOrb, 1, craftingConstant);
ItemStack imbuedSlateStack = new ItemStack(ModItems.imbuedSlate, 1, craftingConstant);
ItemStack demonSlateStack = new ItemStack(ModItems.demonicSlate, 1, craftingConstant);
ItemStack apprenticeBloodOrbStack = new ItemStack(ModItems.apprenticeBloodOrb, 1, craftingConstant);
ItemStack magicianBloodOrbStack = new ItemStack(ModItems.magicianBloodOrb, 1, craftingConstant);
ItemStack waterSigilStackCrafted = new ItemStack(ModItems.waterSigil);
ItemStack lavaSigilStackCrafted = new ItemStack(ModItems.lavaSigil);
ItemStack voidSigilStackCrafted = new ItemStack(ModItems.voidSigil);
ItemStack airSigilStack = new ItemStack(ModItems.airSigil);
ItemStack lavaCrystalStackCrafted = new ItemStack(ModItems.lavaCrystal);
ItemStack lavaCrystalStack = new ItemStack(ModItems.lavaCrystal);
ItemStack energySwordStack = new ItemStack(ModItems.energySword);
ItemStack energyBlasterStack = new ItemStack(ModItems.energyBlaster);
ItemStack sacrificialDaggerStack = new ItemStack(ModItems.sacrificialDagger);
ItemStack bloodAltarStack = new ItemStack(ModBlocks.blockAltar,1,0);
ItemStack bloodRuneCraftedStack = new ItemStack(ModBlocks.bloodRune, 1);
ItemStack bloodRuneStack = new ItemStack(ModBlocks.bloodRune);
ItemStack speedRuneStack = new ItemStack(ModBlocks.speedRune);
ItemStack efficiencyRuneStack = new ItemStack(ModBlocks.efficiencyRune);
ItemStack runeOfSacrificeStack = new ItemStack(ModBlocks.runeOfSacrifice);
ItemStack runeOfSelfSacrificeStack = new ItemStack(ModBlocks.runeOfSelfSacrifice);
ItemStack miningSigilStackCrafted = new ItemStack(ModItems.sigilOfTheFastMiner);
ItemStack divinationSigilStackCrafted = new ItemStack(ModItems.divinationSigil);
// ItemStack elementalInkWaterStack = new ItemStack(elementalInkWater);
// ItemStack elementalInkFireStack = new ItemStack(elementalInkFire);
// ItemStack elementalInkEarthStack = new ItemStack(elementalInkEarth);
// ItemStack elementalInkAirStack = new ItemStack(elementalInkAir);
ItemStack waterScribeToolStack = new ItemStack(ModItems.waterScribeTool);
ItemStack fireScribeToolStack = new ItemStack(ModItems.fireScribeTool);
ItemStack earthScribeToolStack = new ItemStack(ModItems.earthScribeTool);
ItemStack airScribeToolStack = new ItemStack(ModItems.airScribeTool);
ItemStack ritualStoneStackCrafted = new ItemStack(ModBlocks.ritualStone, 4);
ItemStack ritualStoneStack = new ItemStack(ModBlocks.ritualStone);
ItemStack masterRitualStoneStack = new ItemStack(ModBlocks.blockMasterStone);
ItemStack imperfectRitualStoneStack = new ItemStack(ModBlocks.imperfectRitualStone);
ItemStack sigilOfElementalAffinityStackCrafted = new ItemStack(ModItems.sigilOfElementalAffinity);
ItemStack lavaSigilStack = new ItemStack(ModItems.lavaSigil);
ItemStack waterSigilStack = new ItemStack(ModItems.waterSigil);
ItemStack sigilOfHoldingStack = new ItemStack(ModItems.sigilOfHolding);
ItemStack weakBloodShardStack = new ItemStack(ModItems.weakBloodShard);
ItemStack emptySocketStack = new ItemStack(ModBlocks.emptySocket);
ItemStack bloodSocketStack = new ItemStack(ModBlocks.bloodSocket);
ItemStack armourForgeStack = new ItemStack(ModBlocks.armourForge);
ItemStack largeBloodStoneBrickStackCrafted = new ItemStack(ModBlocks.largeBloodStoneBrick, 32);
ItemStack largeBloodStoneBrickStack = new ItemStack(ModBlocks.largeBloodStoneBrick);
ItemStack bloodStoneBrickStackCrafted = new ItemStack(ModBlocks.bloodStoneBrick, 4);
ItemStack growthSigilStack = new ItemStack(ModItems.growthSigil);
ItemStack blockHomHeartStack = new ItemStack(ModBlocks.blockHomHeart);
ItemStack redWoolStack = new ItemStack(Blocks.wool, 1, 14);
ItemStack zombieHead = new ItemStack(Items.skull, 1, 2);
ItemStack simpleCatalystStack = new ItemStack(ModItems.simpleCatalyst);
ItemStack duskRitualDivinerStack = new ItemStack(ModItems.itemRitualDiviner);
((ItemRitualDiviner) duskRitualDivinerStack.getItem()).setMaxRuneDisplacement(duskRitualDivinerStack, 1);
//weakBloodOrbStackCrafted.setItemDamage(weakBloodOrbStackCrafted.getMaxDamage());
waterSigilStackCrafted.setItemDamage(waterSigilStackCrafted.getMaxDamage());
lavaSigilStackCrafted.setItemDamage(lavaSigilStackCrafted.getMaxDamage());
voidSigilStackCrafted.setItemDamage(voidSigilStackCrafted.getMaxDamage());
lavaCrystalStackCrafted.setItemDamage(lavaCrystalStackCrafted.getMaxDamage());
miningSigilStackCrafted.setItemDamage(miningSigilStackCrafted.getMaxDamage());
sigilOfElementalAffinityStackCrafted.setItemDamage(sigilOfElementalAffinityStackCrafted.getMaxDamage());
ItemStack archmageBloodOrbStack = new ItemStack(ModItems.archmageBloodOrb);
ItemStack sanctusStack = new ItemStack(ModItems.sanctus);
ItemStack aetherStack = new ItemStack(ModItems.aether);
ItemStack terraeStack = new ItemStack(ModItems.terrae);
ItemStack incendiumStack = new ItemStack(ModItems.incendium);
ItemStack tennebraeStack = new ItemStack(ModItems.tennebrae);
ItemStack aquasalusStack = new ItemStack(ModItems.aquasalus);
ItemStack crystallosStack = new ItemStack(ModItems.crystallos);
ItemStack crepitousStack = new ItemStack(ModItems.crepitous);
ItemStack magicalesStack = new ItemStack(ModItems.magicales);
//All crafting goes here
// GameRegistry.addRecipe(orbOfTestingStack, "x x", " ", "x x", 'x', cobblestoneStack);
//GameRegistry.addRecipe(glassShardStack, " x", "y ", 'x', ironIngotStack, 'y', glassStack);
//GameRegistry.addRecipe(weakBloodOrbStackCrafted, "xxx", "xdx", "www", 'x', bloodiedShardStack, 'd', diamondStack, 'w', woolStack);
GameRegistry.addRecipe(sacrificialDaggerStack, "ggg", " dg", "i g", 'g', glassStack, 'd', goldIngotStack, 'i', ironIngotStack);
//GameRegistry.addRecipe(blankSlateStack, "sgs", "gig", "sgs", 's', stoneStack, 'g', goldNuggetStack, 'i', ironIngotStack);
//GameRegistry.addRecipe(reinforcedSlateStack, "rir", "ibi", "gig", 'r', redstoneStack, 'i', ironIngotStack, 'b', blankSlateStack, 'g', glowstoneBlockStack);
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(lavaCrystalStackCrafted, "glg", "lbl", "odo", 'g', glassStack, 'l', lavaBucketStack, 'b', weakBloodOrbStack, 'd', diamondStack, 'o', obsidianStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(waterSigilStackCrafted, "www", "wbw", "wow", 'w', waterBucketStack, 'b', blankSlateStack, 'o', weakBloodOrbStack));
GameRegistry.addRecipe(lavaSigilStackCrafted, "lml", "lbl", "lcl", 'l', lavaBucketStack, 'b', blankSlateStack, 'm', magmaCreamStack, 'c', lavaCrystalStack);
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(voidSigilStackCrafted, "ese", "ere", "eoe", 'e', emptyBucketStack, 'r', reinforcedSlateStack, 'o', apprenticeBloodOrbStack, 's', stringStack));
GameRegistry.addRecipe(bloodAltarStack, "s s", "scs", "gdg", 's', stoneStack, 'c', furnaceStack, 'd', diamondStack, 'g', goldIngotStack);
//GameRegistry.addRecipe(energySwordStack, " o ", " o ", " s ", 'o', weakBloodOrbStack, 's', diamondSwordStack);
//GameRegistry.addRecipe(energyBlasterStack, "oi ", "gdi", " rd", 'o', weakBloodOrbStack, 'i', ironIngotStack, 'd', diamondStack, 'r', reinforcedSlateStack, 'g', goldIngotStack);
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(bloodRuneCraftedStack, "sss", "ror", "sss", 's', stoneStack, 'o', weakBloodOrbStack, 'r', blankSlateStack));
GameRegistry.addRecipe(speedRuneStack, "sbs", "uru", "sbs", 'u', sugarStack, 's', stoneStack, 'r', bloodRuneStack, 'b', blankSlateStack);
//GameRegistry.addRecipe(efficiencyRuneStack, "sbs", "rur", "sbs", 'r', redstoneStack, 's', stoneStack, 'u', bloodRuneStack,'b',blankSlateStack);
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.bloodRune, 1, 1), "sbs", "bob", "srs", 's', stoneStack, 'o', magicianBloodOrbStack, 'b', emptyBucketStack, 'r', new ItemStack(ModItems.imbuedSlate)));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.bloodRune, 1, 2), "sbs", "bob", "srs", 's', stoneStack, 'o', magicianBloodOrbStack, 'b', waterBucketStack, 'r', new ItemStack(ModItems.imbuedSlate)));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.bloodRune, 1, 3), "sws", "ror", "sws", 's', stoneStack, 'o', new ItemStack(ModItems.masterBloodOrb), 'w', weakBloodOrbStack, 'r', new ItemStack(ModItems.demonicSlate)));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(airSigilStack, "fgf", "fsf", "fof", 'f', featherStack, 'g', ghastTearStack, 's', reinforcedSlateStack, 'o', apprenticeBloodOrbStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(miningSigilStackCrafted, "sps", "hra", "sos", 'o', apprenticeBloodOrbStack, 's', stoneStack, 'p', ironPickaxeStack, 'h', ironShovelStack, 'a', ironAxeStack, 'r', reinforcedSlateStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(runeOfSacrificeStack, "srs", "gog", "srs", 's', stoneStack, 'g', goldIngotStack, 'o', apprenticeBloodOrbStack, 'r', reinforcedSlateStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(runeOfSelfSacrificeStack, "srs", "gog", "srs", 's', stoneStack, 'g', glowstoneDustStack, 'o', apprenticeBloodOrbStack, 'r', reinforcedSlateStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(divinationSigilStackCrafted, "ggg", "gsg", "gog", 'g', glassStack, 's', blankSlateStack, 'o', weakBloodOrbStack));
// GameRegistry.addRecipe(waterScribeToolStack, "f", "i", 'f', featherStack, 'i', elementalInkWaterStack);
// GameRegistry.addRecipe(fireScribeToolStack, "f", "i", 'f', featherStack, 'i', elementalInkFireStack);
// GameRegistry.addRecipe(earthScribeToolStack, "f", "i", 'f', featherStack, 'i', elementalInkEarthStack);
// GameRegistry.addRecipe(airScribeToolStack, "f", "i", 'f', featherStack, 'i', elementalInkAirStack);
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(ritualStoneStackCrafted, "srs", "ror", "srs", 's', obsidianStack, 'o', apprenticeBloodOrbStack, 'r', reinforcedSlateStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(masterRitualStoneStack, "brb", "ror", "brb", 'b', obsidianStack, 'o', magicianBloodOrbStack, 'r', ritualStoneStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(imperfectRitualStoneStack, "bsb", "sos", "bsb", 's', stoneStack, 'b', obsidianStack, 'o', weakBloodOrbStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(sigilOfElementalAffinityStackCrafted, "oao", "wsl", "oro", 'o', obsidianStack, 'a', airSigilStack, 'w', waterSigilStack, 'l', lavaSigilStack, 'r', magicianBloodOrbStack, 's', imbuedSlateStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(sigilOfHoldingStack, "asa", "srs", "aoa", 'a', blankSlateStack, 's', stoneStack, 'r', imbuedSlateStack, 'o', magicianBloodOrbStack));
GameRegistry.addRecipe(emptySocketStack, "bgb", "gdg", "bgb", 'b', weakBloodShardStack, 'g', glassStack, 'd', diamondStack);
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(armourForgeStack, "sfs", "fof", "sfs", 'f', bloodSocketStack, 's', stoneStack, 'o', magicianBloodOrbStack));
GameRegistry.addShapelessRecipe(largeBloodStoneBrickStackCrafted, weakBloodShardStack, stoneStack);
GameRegistry.addRecipe(bloodStoneBrickStackCrafted, "bb", "bb", 'b', largeBloodStoneBrickStack);
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(growthSigilStack, "srs", "rer", "sos", 's', saplingStack, 'r', reedStack, 'o', apprenticeBloodOrbStack, 'e', reinforcedSlateStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(blockHomHeartStack, "www", "srs", "sos", 'w', redWoolStack, 's', stoneStack, 'r', bloodRuneStack, 'o', apprenticeBloodOrbStack));
GameRegistry.addShapelessRecipe(new ItemStack(Items.skull, 1, 2), new ItemStack(Items.skull, 1, 1), new ItemStack(Items.rotten_flesh), new ItemStack(Items.iron_ingot), new ItemStack(Items.leather));
GameRegistry.addShapelessRecipe(new ItemStack(Items.skull, 1, 0), new ItemStack(Items.skull, 1, 1), new ItemStack(Items.bow, 1, 0), new ItemStack(Items.arrow, 1, 0), new ItemStack(Items.bone));
GameRegistry.addShapelessRecipe(new ItemStack(Items.skull, 1, 4), new ItemStack(Items.skull, 1, 1), new ItemStack(Items.gunpowder), new ItemStack(Blocks.dirt), new ItemStack(Blocks.sand));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.blockWritingTable), " s ", "ror", 's', new ItemStack(Items.brewing_stand), 'r', obsidianStack, 'o', weakBloodOrbStack));
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockPedestal), "ooo", " c ", "ooo", 'o', obsidianStack, 'c', weakBloodShardStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockPlinth), "iii", " p ", "iii", 'i', ironBlockStack, 'p', new ItemStack(ModBlocks.blockPedestal));
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemyFlask, 1, 0), new ItemStack(ModItems.alchemyFlask, 1, craftingConstant), new ItemStack(Items.nether_wart), redstoneStack, glowstoneDustStack);
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.sigilOfHaste), "csc", "sts", "ror", 'c', new ItemStack(Items.cookie), 's', new ItemStack(Items.sugar), 't', ModItems.demonicSlate, 'r', obsidianStack, 'o', new ItemStack(ModItems.masterBloodOrb)));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.sigilOfWind), "faf", "grg", "fof", 'f', featherStack, 'g', ghastTearStack, 'a', new ItemStack(ModItems.airSigil), 'o', new ItemStack(ModItems.masterBloodOrb), 'r', ModItems.demonicSlate));
GameRegistry.addRecipe(new ShapelessBloodOrbRecipe(new ItemStack(ModItems.weakBloodShard, 5, 0), new ItemStack(ModItems.masterBloodOrb), new ItemStack(ModItems.weakBloodShard), imbuedSlateStack));
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockTeleposer), "ggg", "efe", "ggg", 'g', goldIngotStack, 'f', new ItemStack(ModItems.telepositionFocus), 'e', new ItemStack(Items.ender_pearl));
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.reinforcedTelepositionFocus), new ItemStack(ModItems.enhancedTelepositionFocus), new ItemStack(ModItems.weakBloodShard));
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.demonicTelepositionFocus), new ItemStack(ModItems.reinforcedTelepositionFocus), new ItemStack(ModItems.demonBloodShard));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.sigilOfTheBridge), "nnn", "nsn", "ror", 'n', stoneStack, 'r', new ItemStack(Blocks.soul_sand), 's', imbuedSlateStack, 'o', magicianBloodOrbStack));
GameRegistry.addRecipe(new ItemStack(ModItems.armourInhibitor), " gg", "gsg", "gg ", 'g', goldIngotStack, 's', new ItemStack(ModItems.weakBloodShard));
GameRegistry.addRecipe(new ItemStack(ModItems.itemRitualDiviner), "d1d", "2e3", "d4d", '1', new ItemStack(ModItems.airScribeTool), '2', new ItemStack(ModItems.waterScribeTool), '3', new ItemStack(ModItems.fireScribeTool), '4', new ItemStack(ModItems.earthScribeTool), 'd', diamondStack, 'e', new ItemStack(Items.emerald));
GameRegistry.addRecipe(duskRitualDivinerStack, " d ", "srs", " d ", 'd', new ItemStack(ModItems.duskScribeTool), 's', new ItemStack(ModItems.demonicSlate), 'r', new ItemStack(ModItems.itemRitualDiviner));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.sigilOfMagnetism), "bgb", "gsg", "bob", 'b', new ItemStack(Blocks.iron_block), 'g', goldIngotStack, 's', new ItemStack(ModItems.imbuedSlate), 'o', magicianBloodOrbStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.energyBazooka), "Ocd", "cb ", "d w", 'O', archmageBloodOrbStack, 'c', crepitousStack, 'b', new ItemStack(ModItems.energyBlaster), 'd', diamondStack, 'w', new ItemStack(ModItems.weakBloodShard)));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.itemBloodLightSigil), "btb", "sss", "bob", 'o', magicianBloodOrbStack, 'b', glowstoneBlockStack, 't', new ItemStack(Blocks.torch), 's', imbuedSlateStack));
GameRegistry.addRecipe(new ItemStack(ModItems.itemKeyOfDiablo), " gw", "gdg", "wg ", 'w', weakBloodShardStack, 'g', goldIngotStack, 'd', diamondStack);
customPotionDrowning = (new PotionDrowning(customPotionDrowningID, true, 0)).setIconIndex(0, 0).setPotionName("Drowning");
customPotionBoost = (new PotionBoost(customPotionBoostID, false, 0)).setIconIndex(0, 0).setPotionName("Boost");
customPotionProjProt = (new PotionProjectileProtect(customPotionProjProtID, false, 0)).setIconIndex(0, 0).setPotionName("Whirlwind");
customPotionInhibit = (new PotionInhibit(customPotionInhibitID, false, 0)).setIconIndex(0, 0).setPotionName("Inhibit");
customPotionFlight = (new PotionFlight(customPotionFlightID, false, 0)).setIconIndex(0, 0).setPotionName("Flight");
customPotionReciprocation = (new PotionReciprocation(customPotionReciprocationID, false, 0xFFFFFF)).setIconIndex(0, 0).setPotionName("Reciprocation");
customPotionFlameCloak = (new PotionFlameCloak(customPotionFlameCloakID,false,0).setIconIndex(0,0).setPotionName("Flame Cloak"));
customPotionIceCloak = (new PotionIceCloak(customPotionIceCloakID,false,0).setIconIndex(0,0).setPotionName("Ice Cloak"));
customPotionHeavyHeart = (new PotionHeavyHeart(customPotionHeavyHeartID,true,0).setIconIndex(0, 0).setPotionName("Heavy Heart"));
customPotionFireFuse = (new PotionFireFuse(customPotionFireFuseID,true,0).setIconIndex(0, 0).setPotionName("Fire Fuse"));
customPotionPlanarBinding = (new PotionPlanarBinding(customPotionPlanarBindingID,true,0).setIconIndex(0,0).setPotionName("Planar Binding"));
ItemStack masterBloodOrbStack = new ItemStack(ModItems.masterBloodOrb);
//FluidStack lifeEssenceFluidStack = new FluidStack(lifeEssenceFluid, 1);
//LiquidStack lifeEssence = new LiquidStack(lifeEssenceFlowing, 1);
//LiquidDictionary.getOrCreateLiquid("Life Essence", lifeEssence);
// ModBlocks.blockLifeEssence.setUnlocalizedName("lifeEssenceBlock");
FluidContainerRegistry.registerFluidContainer(lifeEssenceFluid, new ItemStack(ModItems.bucketLife), FluidContainerRegistry.EMPTY_BUCKET);
//lifeEssenceFluid.setUnlocalizedName("lifeEssence");
//LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getLiquid("Life Essence", LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(AlchemicalWizardry.bucketLife), new ItemStack(Items.bucketEmpty)));
//GameRegistry.registerBlock(testingBlock, "testingBlock");
//LanguageRegistry.addName(testingBlock, "Testing Block");
//(testingBlock, "pickaxe", 0);
ModBlocks.blockAltar.setHarvestLevel("pickaxe", 1);
//Register Tile Entity
GameRegistry.registerTileEntity(TEAltar.class, "containerAltar");
GameRegistry.registerTileEntity(TEMasterStone.class, "containerMasterStone");
GameRegistry.registerTileEntity(TESocket.class, "containerSocket");
GameRegistry.registerTileEntity(TEWritingTable.class, "containerWritingTable");
GameRegistry.registerTileEntity(TEHomHeart.class, "containerHomHeart");
GameRegistry.registerTileEntity(TEPedestal.class, "containerPedestal");
GameRegistry.registerTileEntity(TEPlinth.class, "containerPlinth");
GameRegistry.registerTileEntity(TETeleposer.class, "containerTeleposer");
GameRegistry.registerTileEntity(TEConduit.class, "containerConduit");
GameRegistry.registerTileEntity(TEOrientable.class, "containerOrientable");
GameRegistry.registerTileEntity(TESpellParadigmBlock.class, "containerSpellParadigmBlock");
GameRegistry.registerTileEntity(TESpellEffectBlock.class, "containerSpellEffectBlock");
GameRegistry.registerTileEntity(TESpellModifierBlock.class, "containerSpellModifierBlock");
GameRegistry.registerTileEntity(TESpellEnhancementBlock.class, "containerSpellEnhancementBlock");
GameRegistry.registerTileEntity(TESpectralContainer.class,"spectralContainerTileEntity");
GameRegistry.registerTileEntity(TEDemonPortal.class, "containerDemonPortal");
GameRegistry.registerTileEntity(TESchematicSaver.class, "containerSchematicSaver");
//GameRegistry.registerBlock(ModBlocks.blockSpellEffect,"blockSpellEffect");
ModBlocks.bloodRune.setHarvestLevel("pickaxe", 2);
ModBlocks.speedRune.setHarvestLevel("pickaxe", 2);
ModBlocks.efficiencyRune.setHarvestLevel("pickaxe", 2);
ModBlocks.runeOfSacrifice.setHarvestLevel("pickaxe", 2);
ModBlocks.runeOfSelfSacrifice.setHarvestLevel("pickaxe", 2);
ModBlocks.ritualStone.setHarvestLevel("pickaxe", 2);
ModBlocks.bloodSocket.setHarvestLevel("pickaxe", 2);
ModBlocks.ritualStone.setHarvestLevel("pickaxe", 2);
ModBlocks.imperfectRitualStone.setHarvestLevel("pickaxe", 2);
ModBlocks.blockMasterStone.setHarvestLevel("pickaxe", 2);
ModBlocks.emptySocket.setHarvestLevel("pickaxe", 2);
ModBlocks.bloodStoneBrick.setHarvestLevel("pickaxe", 0);
ModBlocks.largeBloodStoneBrick.setHarvestLevel("pickaxe", 0);
ModBlocks.blockWritingTable.setHarvestLevel("pickaxe", 1);
ModBlocks.blockHomHeart.setHarvestLevel("pickaxe", 1);
ModBlocks.blockPedestal.setHarvestLevel("pickaxe", 2);
ModBlocks.blockPlinth.setHarvestLevel("pickaxe", 2);
ModBlocks.blockTeleposer.setHarvestLevel("pickaxe", 2);
//Fuel handler
GameRegistry.registerFuelHandler(new AlchemicalWizardryFuelHandler());
//EntityRegistry.registerModEntity(EnergyBlastProjectile.class, "BlasterProj", 0, this, 128, 5, true);
//Gui registration
// NetworkRegistry.instance().registerGuiHandler(this, new GuiHandlerAltar());
UpgradedAltars.loadAltars();
SigilOfHolding.initiateSigilOfHolding();
ArmourForge.initializeRecipes();
TEPlinth.initialize();
this.initAlchemyPotionRecipes();
this.initAltarRecipes();
this.initRituals();
this.initBindingRecipes();
//MinecraftForge.setToolClass(ModItems.boundPickaxe, "pickaxe", 5);
//MinecraftForge.setToolClass(ModItems.boundAxe, "axe", 5);
//MinecraftForge.setToolClass(ModItems.boundShovel, "shovel", 5);
MinecraftForge.EVENT_BUS.register(new ModLivingDropsEvent());
proxy.InitRendering();
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
// ItemStack[] comp = new ItemStack[5];
// for(int i=0;i<5;i++)
// {
// comp[i] = redstoneStack;
// }
// AlchemyRecipeRegistry.registerRecipe(glowstoneDustStack, 2, comp, 2);
ItemStack gunpowderStack = new ItemStack(Items.gunpowder);
ItemStack offensaStack = new ItemStack(ModItems.baseAlchemyItems,1,0);
ItemStack praesidiumStack = new ItemStack(ModItems.baseAlchemyItems,1,1);
ItemStack orbisTerraeStack = new ItemStack(ModItems.baseAlchemyItems,1,2);
ItemStack strengthenedCatalystStack = new ItemStack(ModItems.baseAlchemyItems,1,3);
ItemStack concentratedCatalystStack = new ItemStack(ModItems.baseAlchemyItems,1,4);
ItemStack fracturedBoneStack = new ItemStack(ModItems.baseAlchemyItems,1,5);
ItemStack virtusStack = new ItemStack(ModItems.baseAlchemyItems,1,6);
ItemStack reductusStack = new ItemStack(ModItems.baseAlchemyItems,1,7);
ItemStack potentiaStack = new ItemStack(ModItems.baseAlchemyItems,1,8);
ItemStack strengthenedCatalystStackCrafted = new ItemStack(ModItems.baseAlchemyItems,2,3);
ItemStack fracturedBoneStackCrafted = new ItemStack(ModItems.baseAlchemyItems,4,5);
//TODO NEW RECIPES!
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.weakBindingAgent), 10, new ItemStack[]{simpleCatalystStack, simpleCatalystStack, new ItemStack(Items.clay_ball)}, 2);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.standardBindingAgent), 15, new ItemStack[]{new ItemStack(ModItems.weakBindingAgent), sanctusStack, new ItemStack(ModItems.crystallos)}, 3);
AlchemyRecipeRegistry.registerRecipe(simpleCatalystStack, 2, new ItemStack[]{sugarStack, redstoneStack, redstoneStack, glowstoneDustStack, new ItemStack(Items.gunpowder)}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.incendium), 5, new ItemStack[]{lavaBucketStack, new ItemStack(Items.blaze_powder), new ItemStack(Items.blaze_powder), new ItemStack(Blocks.netherrack), simpleCatalystStack}, 2);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.aether), 5, new ItemStack[]{featherStack, featherStack, glowstoneDustStack, ghastTearStack, simpleCatalystStack}, 2);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.sanctus), 5, new ItemStack[]{glowstoneDustStack, new ItemStack(Items.gold_nugget), glowstoneDustStack, glassStack, simpleCatalystStack}, 2);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.crepitous), 5, new ItemStack[]{new ItemStack(Items.gunpowder), new ItemStack(Items.gunpowder), cobblestoneStack, cobblestoneStack, simpleCatalystStack}, 2);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.crystallos), 5, new ItemStack[]{new ItemStack(Blocks.ice), new ItemStack(Blocks.ice), new ItemStack(Blocks.snow), new ItemStack(Blocks.snow), simpleCatalystStack}, 2);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.terrae), 5, new ItemStack[]{new ItemStack(Blocks.dirt), new ItemStack(Blocks.sand), obsidianStack, obsidianStack, simpleCatalystStack}, 2);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.aquasalus), 5, new ItemStack[]{simpleCatalystStack, new ItemStack(Items.dye, 1, 0), new ItemStack(Items.potionitem, 1, 0), new ItemStack(Items.potionitem, 1, 0), new ItemStack(Items.potionitem, 1, 0)}, 2);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.tennebrae), 5, new ItemStack[]{simpleCatalystStack, new ItemStack(Items.coal), new ItemStack(Items.coal), new ItemStack(Blocks.obsidian), new ItemStack(Items.clay_ball)}, 2);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.magicales), 5, new ItemStack[]{redstoneStack, simpleCatalystStack, new ItemStack(Items.gunpowder), new ItemStack(Items.glowstone_dust), new ItemStack(Items.glowstone_dust)}, 2);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.mundanePowerCatalyst), 10, new ItemStack[]{glowstoneDustStack, glowstoneDustStack, glowstoneDustStack, new ItemStack(ModItems.weakBindingAgent), simpleCatalystStack}, 3);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.mundaneLengtheningCatalyst), 10, new ItemStack[]{redstoneStack, redstoneStack, redstoneStack, new ItemStack(ModItems.weakBindingAgent), simpleCatalystStack}, 3);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.averagePowerCatalyst), 20, new ItemStack[]{new ItemStack(ModItems.mundanePowerCatalyst), new ItemStack(ModItems.mundanePowerCatalyst), new ItemStack(ModItems.standardBindingAgent)}, 4);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.averageLengtheningCatalyst), 20, new ItemStack[]{new ItemStack(ModItems.mundaneLengtheningCatalyst), new ItemStack(ModItems.mundaneLengtheningCatalyst), new ItemStack(ModItems.standardBindingAgent)}, 4);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.greaterPowerCatalyst), 30, new ItemStack[]{new ItemStack(ModItems.averagePowerCatalyst), new ItemStack(ModItems.averagePowerCatalyst), new ItemStack(ModItems.incendium)}, 4);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.greaterLengtheningCatalyst), 30, new ItemStack[]{new ItemStack(ModItems.averageLengtheningCatalyst), new ItemStack(ModItems.averageLengtheningCatalyst), new ItemStack(ModItems.aquasalus)}, 4);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.weakFillingAgent), 5, new ItemStack[]{simpleCatalystStack, new ItemStack(Items.nether_wart), redstoneStack, glowstoneDustStack}, 3);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.standardFillingAgent), 10, new ItemStack[]{new ItemStack(ModItems.weakFillingAgent), new ItemStack(ModItems.terrae)}, 3);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.enhancedFillingAgent), 25, new ItemStack[]{new ItemStack(ModItems.standardFillingAgent), new ItemStack(ModItems.aquasalus), new ItemStack(ModItems.magicales)}, 4);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.activationCrystal, 1, 1), 100, new ItemStack[]{new ItemStack(ModItems.activationCrystal, 1, 0), new ItemStack(ModItems.demonBloodShard), incendiumStack, aquasalusStack, aetherStack}, 4);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(ModItems.activationCrystal, 1, 1), 100, new ItemStack[]{new ItemStack(ModItems.activationCrystal, 1, 0), new ItemStack(Items.nether_star), incendiumStack, aquasalusStack, aetherStack}, 4);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.web),2,new ItemStack[]{new ItemStack(Items.string),new ItemStack(Items.string),new ItemStack(Items.string),new ItemStack(Items.string),new ItemStack(Items.string)},1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.gunpowder,2,0), 2, new ItemStack[]{gunpowderStack, new ItemStack(Items.coal), new ItemStack(Blocks.sand)}, 1);
AlchemyRecipeRegistry.registerRecipe(strengthenedCatalystStackCrafted, 10, new ItemStack[]{simpleCatalystStack, simpleCatalystStack, new ItemStack(Items.dye,1,15), new ItemStack(Items.nether_wart)}, 3);
AlchemyRecipeRegistry.registerRecipe(offensaStack,10, new ItemStack[]{strengthenedCatalystStack,incendiumStack, new ItemStack(Items.arrow), new ItemStack(Items.flint), new ItemStack(Items.arrow)},3);
AlchemyRecipeRegistry.registerRecipe(praesidiumStack, 10, new ItemStack[]{strengthenedCatalystStack,tennebraeStack,ironIngotStack,new ItemStack(Blocks.web),redstoneStack}, 3);
AlchemyRecipeRegistry.registerRecipe(orbisTerraeStack, 10, new ItemStack[]{strengthenedCatalystStack,terraeStack, gunpowderStack, new ItemStack(Blocks.netherrack), new ItemStack(Blocks.sand)}, 3);
AlchemyRecipeRegistry.registerRecipe(concentratedCatalystStack,10,new ItemStack[]{strengthenedCatalystStack,fracturedBoneStack,goldNuggetStack},4);
AlchemyRecipeRegistry.registerRecipe(fracturedBoneStackCrafted, 2, new ItemStack[]{new ItemStack(Items.bone), new ItemStack(Items.bone),new ItemStack(Items.bone),new ItemStack(Items.bone), gunpowderStack},1);
AlchemyRecipeRegistry.registerRecipe(virtusStack,20, new ItemStack[]{redstoneStack, new ItemStack(Items.coal),strengthenedCatalystStack,redstoneStack,gunpowderStack}, 3);
AlchemyRecipeRegistry.registerRecipe(reductusStack,20,new ItemStack[]{redstoneStack, goldIngotStack, strengthenedCatalystStack,new ItemStack(Blocks.soul_sand), new ItemStack(Items.carrot)},3);
AlchemyRecipeRegistry.registerRecipe(potentiaStack,20, new ItemStack[]{glowstoneDustStack,strengthenedCatalystStack,lapisStack,lapisStack,new ItemStack(Items.quartz)}, 3);
HomSpellRegistry.registerBasicSpell(new ItemStack(Items.flint_and_steel), new SpellFireBurst());
HomSpellRegistry.registerBasicSpell(new ItemStack(Blocks.ice), new SpellFrozenWater());
HomSpellRegistry.registerBasicSpell(new ItemStack(Blocks.tnt), new SpellExplosions());
HomSpellRegistry.registerBasicSpell(new ItemStack(ModItems.apprenticeBloodOrb), new SpellHolyBlast());
HomSpellRegistry.registerBasicSpell(new ItemStack(Items.ghast_tear), new SpellWindGust());
HomSpellRegistry.registerBasicSpell(new ItemStack(Items.glowstone_dust), new SpellLightningBolt());
HomSpellRegistry.registerBasicSpell(new ItemStack(Items.water_bucket), new SpellWateryGrave());
HomSpellRegistry.registerBasicSpell(new ItemStack(Blocks.obsidian), new SpellEarthBender());
HomSpellRegistry.registerBasicSpell(new ItemStack(Items.ender_pearl), new SpellTeleport());
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityFallenAngelID), new ItemStack[]{sanctusStack, sanctusStack, sanctusStack, aetherStack, tennebraeStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityLowerGuardianID), new ItemStack[]{cobblestoneStack, cobblestoneStack, terraeStack, tennebraeStack, new ItemStack(Items.iron_ingot), new ItemStack(Items.gold_nugget)}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityBileDemonID), new ItemStack[]{new ItemStack(Items.poisonous_potato), tennebraeStack, terraeStack, new ItemStack(Items.porkchop), new ItemStack(Items.egg), new ItemStack(Items.beef)}, new ItemStack[]{crepitousStack, crepitousStack, terraeStack, ironBlockStack, ironBlockStack, diamondStack}, new ItemStack[]{}, 0, 5);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityWingedFireDemonID), new ItemStack[]{aetherStack, incendiumStack, incendiumStack, incendiumStack, tennebraeStack, new ItemStack(Blocks.netherrack)}, new ItemStack[]{diamondStack, new ItemStack(Blocks.gold_block), magicalesStack, magicalesStack, new ItemStack(Items.fire_charge), new ItemStack(Blocks.coal_block)}, new ItemStack[]{}, 0, 5);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entitySmallEarthGolemID), new ItemStack[]{new ItemStack(Items.clay_ball), terraeStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityIceDemonID), new ItemStack[]{crystallosStack, crystallosStack, aquasalusStack, crystallosStack, sanctusStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityBoulderFistID), new ItemStack[]{terraeStack, sanctusStack, tennebraeStack, new ItemStack(Items.bone), new ItemStack(Items.cooked_beef), new ItemStack(Items.cooked_beef)}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityShadeID), new ItemStack[]{tennebraeStack, tennebraeStack, tennebraeStack, aetherStack, glassStack, new ItemStack(Items.glass_bottle)}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityAirElementalID), new ItemStack[]{aetherStack, aetherStack, aetherStack, aetherStack, aetherStack, aetherStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityWaterElementalID), new ItemStack[]{aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack, aquasalusStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityEarthElementalID), new ItemStack[]{terraeStack, terraeStack, terraeStack, terraeStack, terraeStack, terraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityFireElementalID), new ItemStack[]{incendiumStack, incendiumStack, incendiumStack, incendiumStack, incendiumStack, incendiumStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityShadeElementalID), new ItemStack[]{tennebraeStack,tennebraeStack,tennebraeStack,tennebraeStack,tennebraeStack,tennebraeStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
SummoningRegistry.registerSummon(new SummoningHelperAW(this.entityHolyElementalID), new ItemStack[]{sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack, sanctusStack}, new ItemStack[]{}, new ItemStack[]{}, 0, 4);
//Custom mobs
EntityRegistry.registerModEntity(EntityFallenAngel.class, "FallenAngel", this.entityFallenAngelID, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityLowerGuardian.class, "LowerGuardian", this.entityLowerGuardianID, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityBileDemon.class, "BileDemon", this.entityBileDemonID, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityWingedFireDemon.class, "WingedFireDemon", this.entityWingedFireDemonID, this, 80, 3, true);
EntityRegistry.registerModEntity(EntitySmallEarthGolem.class, "SmallEarthGolem", this.entitySmallEarthGolemID, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityIceDemon.class, "IceDemon", this.entityIceDemonID, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityBoulderFist.class, "BoulderFist", this.entityBoulderFistID, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityShade.class, "Shade", this.entityShadeID, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityAirElemental.class, "AirElemental", this.entityAirElementalID, this, 120, 3, true);
EntityRegistry.registerModEntity(EntityWaterElemental.class, "WaterElemental", this.entityWaterElementalID, this, 120, 3, true);
EntityRegistry.registerModEntity(EntityEarthElemental.class, "EarthElemental", this.entityEarthElementalID, this, 120, 3, true);
EntityRegistry.registerModEntity(EntityFireElemental.class, "FireElemental", this.entityFireElementalID, this, 120, 3, true);
EntityRegistry.registerModEntity(EntityShadeElemental.class, "ShadeElemental", this.entityShadeElementalID, this, 120, 3, true);
EntityRegistry.registerModEntity(EntityHolyElemental.class, "HolyElemental", this.entityHolyElementalID, this, 120, 3, true);
//EntityRegistry.addSpawn(EntityFallenAngel.class, 5, 1, 5, EnumCreatureType.creature, BiomeGenBase.biomeList);
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.standardBindingAgent), 1, 3, this.standardBindingAgentDungeonChance));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.mundanePowerCatalyst), 1, 1, this.mundanePowerCatalystDungeonChance));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.mundaneLengtheningCatalyst), 1, 1, this.mundaneLengtheningCatalystDungeonChance));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.averagePowerCatalyst), 1, 1, this.averagePowerCatalystDungeonChance));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.averageLengtheningCatalyst), 1, 1, this.averageLengtheningCatalystDungeonChance));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.greaterPowerCatalyst), 1, 1, this.greaterPowerCatalystDungeonChance));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.greaterLengtheningCatalyst), 1, 1, this.greaterLengtheningCatalystDungeonChance));
//Ore Dictionary Registration
OreDictionary.registerOre("oreCoal", Blocks.coal_ore);
MeteorRegistry.registerMeteorParadigm(diamondStack, diamondMeteorArray, diamondMeteorRadius);
MeteorRegistry.registerMeteorParadigm(stoneStack, this.stoneMeteorArray, this.stoneMeteorRadius);
MeteorRegistry.registerMeteorParadigm(ironBlockStack, this.ironBlockMeteorArray, this.ironBlockMeteorRadius);
MeteorRegistry.registerMeteorParadigm(new ItemStack(Items.nether_star), this.netherStarMeteorArray, this.netherStarMeteorRadius);
//Register spell component recipes
ItemStack complexSpellCrystalStack = new ItemStack(ModItems.itemComplexSpellCrystal);
ItemStack quartzRodStack = new ItemStack(ModItems.baseItems,1,0);
ItemStack emptyCoreStack = new ItemStack(ModItems.baseItems,1,1);
ItemStack magicalesCableStack = new ItemStack(ModItems.baseItems,1,2);
ItemStack woodBraceStack = new ItemStack(ModItems.baseItems,1,3);
ItemStack stoneBraceStack = new ItemStack(ModItems.baseItems,1,4);
ItemStack projectileCoreStack = new ItemStack(ModItems.baseItems,1,5);
ItemStack selfCoreStack = new ItemStack(ModItems.baseItems,1,6);
ItemStack meleeCoreStack = new ItemStack(ModItems.baseItems,1,7);
ItemStack paradigmBackPlateStack = new ItemStack(ModItems.baseItems,1,8);
ItemStack outputCableStack = new ItemStack(ModItems.baseItems,1,9);
ItemStack flameCoreStack = new ItemStack(ModItems.baseItems,1,10);
ItemStack iceCoreStack = new ItemStack(ModItems.baseItems,1,11);
ItemStack windCoreStack = new ItemStack(ModItems.baseItems,1,12);
ItemStack earthCoreStack = new ItemStack(ModItems.baseItems,1,13);
ItemStack inputCableStack = new ItemStack(ModItems.baseItems,1,14);
ItemStack crackedRunicPlateStack = new ItemStack(ModItems.baseItems,1,15);
ItemStack runicPlateStack = new ItemStack(ModItems.baseItems,1,16);
ItemStack imbuedRunicPlateStack = new ItemStack(ModItems.baseItems,1,17);
ItemStack defaultCoreStack = new ItemStack(ModItems.baseItems,1,18);
ItemStack offenseCoreStack = new ItemStack(ModItems.baseItems,1,19);
ItemStack defensiveCoreStack = new ItemStack(ModItems.baseItems,1,20);
ItemStack environmentalCoreStack = new ItemStack(ModItems.baseItems,1,21);
ItemStack powerCoreStack = new ItemStack(ModItems.baseItems,1,22);
ItemStack costCoreStack = new ItemStack(ModItems.baseItems,1,23);
ItemStack potencyCoreStack = new ItemStack(ModItems.baseItems,1,24);
ItemStack obsidianBraceStack = new ItemStack(ModItems.baseItems,1,25);
ItemStack magicalesCraftedCableStack = new ItemStack(ModItems.baseItems,5,2);
ItemStack crackedRunicPlateStackCrafted = new ItemStack(ModItems.baseItems,2,15);
ItemStack runicPlateStackCrafted = new ItemStack(ModItems.baseItems,2,16);
GameRegistry.addRecipe(quartzRodStack, "qqq", 'q', new ItemStack(Items.quartz));
GameRegistry.addRecipe(emptyCoreStack,"gig","nrn","gig",'n',goldIngotStack,'i',ironIngotStack,'g',glassStack,'r',simpleCatalystStack);
GameRegistry.addRecipe(magicalesCraftedCableStack,"sss","mmm","sss",'s',new ItemStack(Items.string),'m',magicalesStack);
GameRegistry.addRecipe(woodBraceStack," il","ili","li ",'l', new ItemStack(Blocks.log,1,craftingConstant),'i',new ItemStack(Items.string));
GameRegistry.addRecipe(stoneBraceStack," is","isi","si ",'i', ironIngotStack,'s',reinforcedSlateStack);
GameRegistry.addRecipe(obsidianBraceStack," is","ibi","si ",'i', obsidianStack,'s',reinforcedSlateStack,'b',stoneBraceStack);
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(projectileCoreStack, "mbm","aca","mom",'c', emptyCoreStack,'b',weakBloodShardStack,'m', magicalesStack,'o', magicianBloodOrbStack,'a',new ItemStack(Items.arrow)));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(selfCoreStack,"sbs","ncn","sos",'c', emptyCoreStack, 's',sanctusStack,'b', weakBloodShardStack,'o', magicianBloodOrbStack,'n',glowstoneDustStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(meleeCoreStack,"sbs","ncn","sos",'c', emptyCoreStack, 's',incendiumStack,'b', weakBloodShardStack,'o', magicianBloodOrbStack,'n',new ItemStack(Items.fire_charge)));
GameRegistry.addRecipe(paradigmBackPlateStack,"isi","rgr","isi",'i',ironIngotStack,'r',stoneStack,'g',goldIngotStack,'s',reinforcedSlateStack);
GameRegistry.addRecipe(outputCableStack, " si","s c"," si",'s',stoneStack,'i',ironIngotStack,'c',simpleCatalystStack);
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(flameCoreStack,"mdm","scs","mom",'m',incendiumStack,'c',emptyCoreStack,'o',magicianBloodOrbStack,'d',diamondStack,'s',weakBloodShardStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(iceCoreStack,"mdm","scs","mom",'m',crystallosStack,'c',emptyCoreStack,'o',magicianBloodOrbStack,'d',diamondStack,'s',weakBloodShardStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(windCoreStack,"mdm","scs","mom",'m',aetherStack,'c',emptyCoreStack,'o',magicianBloodOrbStack,'d',diamondStack,'s',weakBloodShardStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(earthCoreStack,"mdm","scs","mom",'m',terraeStack,'c',emptyCoreStack,'o',magicianBloodOrbStack,'d',diamondStack,'s',weakBloodShardStack));
GameRegistry.addRecipe(inputCableStack, "ws ","rcs","ws ",'w',blankSlateStack,'s',stoneStack,'r',imbuedSlateStack,'c',simpleCatalystStack);
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(defaultCoreStack,"msm","geg","mom",'m', strengthenedCatalystStack,'e', emptyCoreStack, 'o', magicianBloodOrbStack, 's',weakBloodShardStack, 'g', goldIngotStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(offenseCoreStack,"msm","geg","mom",'m', offensaStack,'e', emptyCoreStack, 'o', magicianBloodOrbStack, 's',weakBloodShardStack, 'g', goldIngotStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(defensiveCoreStack,"msm","geg","mom",'m', praesidiumStack,'e', emptyCoreStack, 'o', magicianBloodOrbStack, 's',weakBloodShardStack, 'g', goldIngotStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(environmentalCoreStack,"msm","geg","mom",'m', orbisTerraeStack,'e', emptyCoreStack, 'o', magicianBloodOrbStack, 's',weakBloodShardStack, 'g', goldIngotStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(powerCoreStack,"msm","geg","mom",'m', virtusStack,'e', emptyCoreStack, 'o', masterBloodOrbStack, 's',weakBloodShardStack, 'g', goldIngotStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(costCoreStack,"msm","geg","mom",'m', reductusStack,'e', emptyCoreStack, 'o', masterBloodOrbStack, 's',weakBloodShardStack, 'g', goldIngotStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(potencyCoreStack,"msm","geg","mom",'m', potentiaStack,'e', emptyCoreStack, 'o', masterBloodOrbStack, 's',weakBloodShardStack, 'g', goldIngotStack));
AlchemyRecipeRegistry.registerRecipe(crackedRunicPlateStackCrafted, 10, new ItemStack[]{imbuedSlateStack,imbuedSlateStack,concentratedCatalystStack}, 4);
AlchemyRecipeRegistry.registerRecipe(runicPlateStack, 30, new ItemStack[]{crackedRunicPlateStack,terraeStack}, 5);
AlchemyRecipeRegistry.registerRecipe(imbuedRunicPlateStack, 100, new ItemStack[]{magicalesStack,incendiumStack,runicPlateStack, runicPlateStack,aquasalusStack}, 5);
AlchemyRecipeRegistry.registerRecipe(complexSpellCrystalStack,50,new ItemStack[]{new ItemStack(ModItems.blankSpell), weakBloodShardStack, weakBloodShardStack, diamondStack,goldIngotStack},3);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockConduit,1,0),"q q","ccc","q q",'q', quartzRodStack,'c', magicalesCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellParadigm,1,0),"gb ","pcw","gb ",'p',paradigmBackPlateStack,'c', projectileCoreStack,'g',goldIngotStack,'b',stoneBraceStack,'w',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellParadigm,1,1),"gb ","pcw","gb ",'p',paradigmBackPlateStack,'c', selfCoreStack,'g',goldIngotStack,'b',stoneBraceStack,'w',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellParadigm,1,2),"gb ","pcw","gb ",'p',paradigmBackPlateStack,'c', meleeCoreStack,'g',goldIngotStack,'b',stoneBraceStack,'w',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEffect,1,0),"bgb","ico","bgb",'c',flameCoreStack,'b',stoneBraceStack,'g',goldIngotStack,'i',inputCableStack,'o',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEffect,1,1),"bgb","ico","bgb",'c',iceCoreStack,'b',stoneBraceStack,'g',goldIngotStack,'i',inputCableStack,'o',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEffect,1,2),"bgb","ico","bgb",'c',windCoreStack,'b',stoneBraceStack,'g',goldIngotStack,'i',inputCableStack,'o',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEffect,1,3),"bgb","ico","bgb",'c',earthCoreStack,'b',stoneBraceStack,'g',goldIngotStack,'i',inputCableStack,'o',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellModifier,1,0),"bgb","ico","bgb",'c',defaultCoreStack,'i',inputCableStack,'o',outputCableStack,'b',stoneBraceStack,'g',ironIngotStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellModifier,1,1),"bgb","ico","bgb",'c',offenseCoreStack,'i',inputCableStack,'o',outputCableStack,'b',stoneBraceStack,'g',ironIngotStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellModifier,1,2),"bgb","ico","bgb",'c',defensiveCoreStack,'i',inputCableStack,'o',outputCableStack,'b',stoneBraceStack,'g',ironIngotStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellModifier,1,3),"bgb","ico","bgb",'c',environmentalCoreStack,'i',inputCableStack,'o',outputCableStack,'b',stoneBraceStack,'g',ironIngotStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement,1,0),"bpb","ico","bpb",'c', powerCoreStack,'b',woodBraceStack,'p',crackedRunicPlateStack,'i',inputCableStack,'o',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement,1,1),"bpb","ico","bpb",'c', powerCoreStack,'b',stoneBraceStack,'p',runicPlateStack,'i',inputCableStack,'o',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement,1,2),"bpb","ico","bpb",'c', powerCoreStack,'b',obsidianBraceStack,'p',imbuedRunicPlateStack,'i',inputCableStack,'o',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement,1,5),"bpb","ico","bpb",'c', costCoreStack,'b',woodBraceStack,'p',crackedRunicPlateStack,'i',inputCableStack,'o',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement,1,6),"bpb","ico","bpb",'c', costCoreStack,'b',stoneBraceStack,'p',runicPlateStack,'i',inputCableStack,'o',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement,1,7),"bpb","ico","bpb",'c', costCoreStack,'b',obsidianBraceStack,'p',imbuedRunicPlateStack,'i',inputCableStack,'o',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement,1,10),"bpb","ico","bpb",'c', potencyCoreStack,'b',woodBraceStack,'p',crackedRunicPlateStack,'i',inputCableStack,'o',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement,1,11),"bpb","ico","bpb",'c', potencyCoreStack,'b',stoneBraceStack,'p',runicPlateStack,'i',inputCableStack,'o',outputCableStack);
GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement,1,12),"bpb","ico","bpb",'c', potencyCoreStack,'b',obsidianBraceStack,'p',imbuedRunicPlateStack,'i',inputCableStack,'o',outputCableStack);
GameRegistry.addShapelessRecipe(new ItemStack(Items.dye,5,15),fracturedBoneStack);
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.itemSigilOfSupression),"wtl","wvl","wol",'v',new ItemStack(ModItems.voidSigil),'t',new ItemStack(ModBlocks.blockTeleposer),'o',masterBloodOrbStack,'l',lavaBucketStack,'w',waterBucketStack));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.itemSigilOfEnderSeverance),"ptp","ese","pop",'s',new ItemStack(ModItems.demonicSlate),'t',weakBloodShardStack,'o',masterBloodOrbStack,'e',new ItemStack(Items.ender_eye),'p', new ItemStack(Items.ender_pearl)));
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.flint,2,0), 1, new ItemStack[]{new ItemStack(Blocks.gravel),new ItemStack(Items.flint)}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.grass), 2, new ItemStack[]{new ItemStack(Blocks.dirt),new ItemStack(Items.dye,1,15),new ItemStack(Items.wheat_seeds),new ItemStack(Items.wheat_seeds)}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.leather,3,0), 2, new ItemStack[]{new ItemStack(Items.rotten_flesh),new ItemStack(Items.rotten_flesh),new ItemStack(Items.rotten_flesh),waterBucketStack,new ItemStack(Items.flint)}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.bread), 1, new ItemStack[]{new ItemStack(Items.wheat),new ItemStack(Items.sugar)}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.fire_charge,5,0), 3, new ItemStack[]{new ItemStack(Items.coal),new ItemStack(Items.blaze_powder),gunpowderStack}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.sand,2,0), 1, new ItemStack[]{new ItemStack(Blocks.cobblestone),gunpowderStack}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.clay,4,0), 2, new ItemStack[]{new ItemStack(Blocks.hardened_clay,1,craftingConstant),new ItemStack(Blocks.hardened_clay,1,craftingConstant),new ItemStack(Blocks.hardened_clay,1,craftingConstant),new ItemStack(Blocks.hardened_clay,1,craftingConstant),waterBucketStack}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.string,4,0), 1, new ItemStack[]{new ItemStack(Blocks.wool,1,craftingConstant),new ItemStack(Items.flint)}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.gravel,2,0), 1, new ItemStack[]{new ItemStack(Blocks.stone),gunpowderStack}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.obsidian), 1, new ItemStack[]{waterBucketStack,lavaBucketStack}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Items.paper), 1, new ItemStack[]{new ItemStack(Items.reeds)}, 1);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.soul_sand,3,0), 3, new ItemStack[]{new ItemStack(Blocks.sand),new ItemStack(Blocks.sand),new ItemStack(Blocks.sand),waterBucketStack,weakBloodShardStack}, 3);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.mycelium,1,0), 5, new ItemStack[]{new ItemStack(Blocks.grass),new ItemStack(Blocks.brown_mushroom), new ItemStack(Blocks.red_mushroom)}, 2);
AlchemyRecipeRegistry.registerRecipe(new ItemStack(Blocks.ice), 2, new ItemStack[]{waterBucketStack,new ItemStack(Items.snowball)}, 1);
}
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
//TODO Thaumcraft Integration
if (Loader.isModLoaded("Thaumcraft"))
{
this.isThaumcraftLoaded = true;
try
{
//do stuff
ModItems.sanguineHelmet = new ItemSanguineArmour().setUnlocalizedName("sanguineHelmet");
GameRegistry.registerItem(ModItems.sanguineHelmet, "sanguineHelmet");
ItemStack itemGoggles = ItemApi.getItem("itemGoggles", 0);
if (itemGoggles != null)
{
BindingRegistry.registerRecipe(new ItemStack(ModItems.sanguineHelmet), itemGoggles);
}
//LogHelper.log(Level.INFO, "Loaded RP2 World addon");
} catch (Exception e)
{
//LogHelper.log(Level.SEVERE, "Could not load RP2 World addon");
e.printStackTrace(System.err);
}
} else
{
this.isThaumcraftLoaded = false;
}
if(Loader.isModLoaded("Forestry"))
{
this.isForestryLoaded = true;
// ModItems.itemBloodFrame = new ItemBloodFrame(this.itemBloodFrameItemID).setUnlocalizedName("bloodFrame");
//
// ItemStack provenFrame = GameRegistry.findItemStack("Forestry", "frameImpregnated", 1);
//
// if(provenFrame !=null)
// {
// AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.itemBloodFrame), provenFrame, 3, 30000, 20, 20, false);
// }
}else
{
this.isForestryLoaded = false;
}
}
public static void initAlchemyPotionRecipes()
{
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.ghast_tear), Potion.regeneration.id, 450);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.golden_carrot), Potion.nightVision.id, 2 * 60 * 20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.magma_cream), Potion.fireResistance.id, 2 * 60 * 20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.water_bucket), Potion.waterBreathing.id, 2 * 60 * 20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.sugar), Potion.moveSpeed.id, 2 * 60 * 20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.speckled_melon), Potion.heal.id, 2 * 60 * 20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.spider_eye), Potion.poison.id, 450);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.fermented_spider_eye), Potion.weakness.id, 450);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.blaze_powder), Potion.damageBoost.id, 2 * 60 * 20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(ModItems.aether), Potion.jump.id, 2 * 60 * 20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.clay_ball), Potion.moveSlowdown.id, 450);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.redstone), Potion.digSpeed.id, 2 * 60 * 20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.potionitem, 1, 0), AlchemicalWizardry.customPotionDrowning.id, 450);
//AlchemicalPotionCreationHandler.addPotion(new ItemStack(Item.goldenCarrot),Potion.nightVision.id,2*60*20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.glass_bottle), Potion.invisibility.id, 2 * 60 * 20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.diamond), Potion.resistance.id, 2 * 60 * 20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.poisonous_potato), Potion.field_76443_y.id, 2); //saturation
AlchemicalPotionCreationHandler.addPotion(new ItemStack(ModItems.demonBloodShard), Potion.field_76434_w.id, 4 * 60 * 20); //health boost
AlchemicalPotionCreationHandler.addPotion(new ItemStack(ModItems.weakBloodShard), Potion.field_76444_x.id, 4 * 60 * 20); //Absorption
AlchemicalPotionCreationHandler.addPotion(new ItemStack(ModItems.terrae), AlchemicalWizardry.customPotionBoost.id, 1 * 60 * 20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.feather), AlchemicalWizardry.customPotionFlight.id, 1 * 60 * 20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.arrow), AlchemicalWizardry.customPotionReciprocation.id, 1 * 60 * 20);
AlchemicalPotionCreationHandler.addPotion(new ItemStack(Items.ender_pearl),AlchemicalWizardry.customPotionPlanarBinding.id,1*60*20);
}
public static void initAltarRecipes()
{
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.weakBloodOrb), new ItemStack(Items.diamond),1,2000,2,1,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.apprenticeBloodOrb), new ItemStack(Items.emerald),2,5000,5,5,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.magicianBloodOrb), new ItemStack(Blocks.gold_block),3,25000,20,20,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.masterBloodOrb), new ItemStack(ModItems.weakBloodShard),4,40000,30,50,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.archmageBloodOrb), new ItemStack(ModItems.demonBloodShard),5,75000,50,100,false);
AltarRecipeRegistry.registerAltarOrbRecipe(new ItemStack(ModItems.weakBloodOrb),1,2);
AltarRecipeRegistry.registerAltarOrbRecipe(new ItemStack(ModItems.apprenticeBloodOrb),2,5);
AltarRecipeRegistry.registerAltarOrbRecipe(new ItemStack(ModItems.magicianBloodOrb),3,15);
AltarRecipeRegistry.registerAltarOrbRecipe(new ItemStack(ModItems.masterBloodOrb),4,25);
AltarRecipeRegistry.registerAltarOrbRecipe(new ItemStack(ModItems.archmageBloodOrb),5,50);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.telepositionFocus), new ItemStack(Items.ender_pearl),4,2000,10,10,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.enhancedTelepositionFocus), new ItemStack(ModItems.telepositionFocus),4,10000,25,15,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.demonicSlate), new ItemStack(ModItems.imbuedSlate),4,15000,20,20,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.duskScribeTool), new ItemStack(Blocks.coal_block),4,2000,20,10,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModBlocks.bloodSocket), new ItemStack(ModBlocks.emptySocket),3,30000,40,10,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.earthScribeTool), new ItemStack(Blocks.obsidian),3,1000,5,5,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.waterScribeTool), new ItemStack(Blocks.lapis_block),3,1000,5,5,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blankSpell), new ItemStack(Blocks.glass),2,1000,5,5,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.blankSlate), new ItemStack(Blocks.stone),1,1000,5,5,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.activationCrystal), new ItemStack(ModItems.lavaCrystal),3,10000,20,10,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.fireScribeTool), new ItemStack(Items.magma_cream),3,1000,5,5,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.airScribeTool), new ItemStack(Items.ghast_tear),3,1000,5,5,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.imbuedSlate), new ItemStack(ModItems.reinforcedSlate),3,5000,15,10,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.daggerOfSacrifice), new ItemStack(Items.iron_sword),2,3000,5,5,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.alchemyFlask), new ItemStack(Items.glass_bottle),2,2000,5,5,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.reinforcedSlate), new ItemStack(ModItems.blankSlate),2,2000,5,5,false);
AltarRecipeRegistry.registerAltarRecipe(new ItemStack(ModItems.bucketLife), new ItemStack(Items.bucket),1,1000,5,0,false);
}
public static void initRituals()
{
Rituals.registerRitual("AW001Water", 1, 500, new RitualEffectWater(), "Ritual of the Full Spring");
Rituals.registerRitual("AW002Lava", 1, 10000, new RitualEffectLava(), "Serenade of the Nether");
Rituals.registerRitual("AW003GreenGrove", 1, 1000, new RitualEffectGrowth(), "Ritual of the Green Grove");
Rituals.registerRitual("AW004Interdiction", 1, 1000, new RitualEffectInterdiction(), "Interdiction Ritual");
Rituals.registerRitual("AW005Containment", 1, 2000, new RitualEffectContainment(), "Ritual of Containment");
Rituals.registerRitual("AW006Binding", 1, 5000, new RitualEffectSoulBound(), "Ritual of Binding");
Rituals.registerRitual("AW007Unbinding", 1, 30000, new RitualEffectUnbinding(), "Ritual of Unbinding");
Rituals.registerRitual("AW008HighJump", 1, 1000, new RitualEffectJumping(), "Ritual of the High Jump");
Rituals.registerRitual("AW009Magnetism", 1, 5000, new RitualEffectMagnetic(), "Ritual of Magnetism");
Rituals.registerRitual("AW010Crusher", 1, 2500, new RitualEffectCrushing(), "Ritual of the Crusher");
Rituals.registerRitual("AW011Speed", 1, 1000, new RitualEffectLeap(), "Ritual of Speed");
Rituals.registerRitual("AW012AnimalGrowth", 1, 10000, new RitualEffectAnimalGrowth(), "Ritual of the Shepherd");
Rituals.registerRitual("AW013Suffering", 1, 50000, new RitualEffectWellOfSuffering(), "Well of Suffering");
Rituals.registerRitual("AW014Regen", 1, 25000, new RitualEffectHealing(), "Ritual of Regeneration");
Rituals.registerRitual("AW015FeatheredKnife", 1, 50000, new RitualEffectFeatheredKnife(), "Ritual of the Feathered Knife");
Rituals.registerRitual("AW016FeatheredEarth", 2, 100000, new RitualEffectFeatheredEarth(), "Ritual of the Feathered Earth");
Rituals.registerRitual("AW017Gaia", 2, 1000000, new RitualEffectBiomeChanger(), "Ritual of Gaia's Transformation");
Rituals.registerRitual("AW018Condor", 2, 1000000, new RitualEffectFlight(), "Reverence of the Condor");
Rituals.registerRitual("AW019FallingTower", 2, 1000000, new RitualEffectSummonMeteor(), "Mark of the Falling Tower");
Rituals.registerRitual("AW020BalladOfAlchemy", 1, 20000, new RitualEffectAutoAlchemy(), "Ballad of Alchemy");
Rituals.registerRitual("AW021Expulsion", 1, 1000000, new RitualEffectExpulsion(), "Aura of Expulsion");
Rituals.registerRitual("AW022Supression", 1, 10000, new RitualEffectSupression(), "Dome of Supression");
Rituals.registerRitual("AW023Zephyr", 1, 25000, new RitualEffectItemSuction(),"Call of the Zephyr");
//Rituals.registerRitual(1,100,new RitualEffectApiaryOverclock(),"Apiary Overclock"));
}
public static void initBindingRecipes()
{
BindingRegistry.registerRecipe(new ItemStack(ModItems.boundPickaxe), new ItemStack(Items.diamond_pickaxe));
BindingRegistry.registerRecipe(new ItemStack(ModItems.boundAxe), new ItemStack(Items.diamond_axe));
BindingRegistry.registerRecipe(new ItemStack(ModItems.boundShovel), new ItemStack(Items.diamond_shovel));
BindingRegistry.registerRecipe(new ItemStack(ModItems.energySword), new ItemStack(Items.diamond_sword));
BindingRegistry.registerRecipe(new ItemStack(ModItems.energyBlaster), new ItemStack(ModItems.apprenticeBloodOrb));
}
}

View file

@ -0,0 +1,96 @@
package WayofTime.alchemicalWizardry;
import java.io.File;
import java.util.logging.Level;
import net.minecraftforge.common.config.Configuration;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorParadigm;
import cpw.mods.fml.common.FMLLog;
/**
* Created with IntelliJ IDEA.
* User: Pokefenn
* Date: 17/01/14
* Time: 19:50
*/
public class BloodMagicConfiguration
{
public static Configuration config;
public static final String CATEGORY_GAMEPLAY = "gameplay";
public static void init(File configFile)
{
config = new Configuration(configFile);
try
{
config.load();
AlchemicalWizardry.standardBindingAgentDungeonChance = config.get("Dungeon Loot Chances", "standardBindingAgent", 30).getInt();
AlchemicalWizardry.mundanePowerCatalystDungeonChance = config.get("Dungeon Loot Chances", "mundanePowerCatalyst", 20).getInt();
AlchemicalWizardry.averagePowerCatalystDungeonChance = config.get("Dungeon Loot Chances", "averagePowerCatalyst", 10).getInt();
AlchemicalWizardry.greaterPowerCatalystDungeonChance = config.get("Dungeon Loot Chances", "greaterPowerCatalyst", 05).getInt();
AlchemicalWizardry.mundaneLengtheningCatalystDungeonChance = config.get("Dungeon Loot Chances", "mundaneLengtheningCatalyst", 20).getInt();
AlchemicalWizardry.averageLengtheningCatalystDungeonChance = config.get("Dungeon Loot Chances", "averageLengtheningCatalyst", 10).getInt();
AlchemicalWizardry.greaterLengtheningCatalystDungeonChance = config.get("Dungeon Loot Chances", "greaterLengtheningCatalyst", 05).getInt();
AlchemicalWizardry.customPotionDrowningID = config.get("Potion ID", "Drowning", 100).getInt();
AlchemicalWizardry.customPotionBoostID = config.get("Potion ID", "Boost", 101).getInt();
AlchemicalWizardry.customPotionProjProtID = config.get("Potion ID", "ProjProt", 102).getInt();
AlchemicalWizardry.customPotionInhibitID = config.get("Potion ID", "Inhibit", 103).getInt();
AlchemicalWizardry.customPotionFlightID = config.get("Potion ID", "Flight", 104).getInt();
AlchemicalWizardry.customPotionReciprocationID = config.get("Potion ID", "Reciprocation", 105).getInt();
AlchemicalWizardry.customPotionFlameCloakID = config.get("Potion ID","FlameCloak",106).getInt();
AlchemicalWizardry.customPotionIceCloakID = config.get("Potion ID","IceCloak",107).getInt();
AlchemicalWizardry.customPotionHeavyHeartID = config.get("Potion ID","HeavyHeart",108).getInt();
AlchemicalWizardry.customPotionFireFuseID = config.get("Potion ID","FireFuse",109).getInt();
AlchemicalWizardry.customPotionPlanarBindingID = config.get("Potion ID","PlanarBinding",110).getInt();
MeteorParadigm.maxChance = config.get("meteor", "maxChance", 1000).getInt();
AlchemicalWizardry.doMeteorsDestroyBlocks = config.get("meteor", "doMeteorsDestroyBlocks", true).getBoolean(true);
AlchemicalWizardry.diamondMeteorArray = config.get("meteor", "diamondMeteor", new String[]{"oreDiamond", "100", "oreEmerald", "75", "oreCinnabar", "200", "oreAmber", "200"}).getStringList();
AlchemicalWizardry.diamondMeteorRadius = config.get("meteor", "diamondMeteorRadius", 5).getInt();
AlchemicalWizardry.stoneMeteorArray = config.get("meteor", "stoneBlockMeteor", new String[]{"oreCoal", "150", "oreApatite", "50", "oreIron", "50"}).getStringList();
AlchemicalWizardry.stoneMeteorRadius = config.get("meteor", "stoneMeteorRadius", 16).getInt();
AlchemicalWizardry.ironBlockMeteorArray = config.get("meteor", "ironBlockMeteor", new String[]{"oreIron", "400", "oreGold", "30", "oreCopper", "200", "oreTin", "140", "oreSilver", "70", "oreLead", "80", "oreLapis", "60", "oreRedstone", "100"}).getStringList();
AlchemicalWizardry.ironBlockMeteorRadius = config.get("meteor", "ironBlockMeteorRadius", 7).getInt();
AlchemicalWizardry.netherStarMeteorArray = config.get("meteor", "netherStarMeteor", new String[]{"oreDiamond", "150", "oreEmerald", "100", "oreQuartz", "250", "oreSunstone", "5", "oreMoonstone", "50", "oreIridium", "5", "oreCertusQuartz", "150"}).getStringList();
AlchemicalWizardry.netherStarMeteorRadius = config.get("meteor", "netherStarMeteorRadius", 3).getInt();
AlchemicalWizardry.allowedCrushedOresArray = config.get("oreCrushing", "allowedOres", new String[]{"iron","gold","copper","tin","lead","silver","osmium"}).getStringList();
AlchemicalWizardry.wimpySettings = config.get("WimpySettings","IDontLikeFun",false).getBoolean(false);
} catch (Exception e)
{
//TODO Log
//FMLLog.log(Level.SEVERE, e, "Blood Magic" + " has had a problem loading its configuration, go ask on the forums :p");
} finally
{
config.save();
}
}
public static void set(String categoryName, String propertyName, String newValue)
{
config.load();
if (config.getCategoryNames().contains(categoryName))
{
if (config.getCategory(categoryName).containsKey(propertyName))
{
config.getCategory(categoryName).get(propertyName).set(newValue);
}
}
config.save();
}
}

View file

@ -0,0 +1,162 @@
package WayofTime.alchemicalWizardry;
import net.minecraft.block.Block;
import WayofTime.alchemicalWizardry.common.block.ArmourForge;
import WayofTime.alchemicalWizardry.common.block.BlockAltar;
import WayofTime.alchemicalWizardry.common.block.BlockBloodLightSource;
import WayofTime.alchemicalWizardry.common.block.BlockConduit;
import WayofTime.alchemicalWizardry.common.block.BlockDemonPortal;
import WayofTime.alchemicalWizardry.common.block.BlockHomHeart;
import WayofTime.alchemicalWizardry.common.block.BlockMasterStone;
import WayofTime.alchemicalWizardry.common.block.BlockPedestal;
import WayofTime.alchemicalWizardry.common.block.BlockPlinth;
import WayofTime.alchemicalWizardry.common.block.BlockSchematicSaver;
import WayofTime.alchemicalWizardry.common.block.BlockSocket;
import WayofTime.alchemicalWizardry.common.block.BlockSpectralContainer;
import WayofTime.alchemicalWizardry.common.block.BlockSpellEffect;
import WayofTime.alchemicalWizardry.common.block.BlockSpellEnhancement;
import WayofTime.alchemicalWizardry.common.block.BlockSpellModifier;
import WayofTime.alchemicalWizardry.common.block.BlockSpellParadigm;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
import WayofTime.alchemicalWizardry.common.block.BlockWritingTable;
import WayofTime.alchemicalWizardry.common.block.BloodRune;
import WayofTime.alchemicalWizardry.common.block.BloodStoneBrick;
import WayofTime.alchemicalWizardry.common.block.EfficiencyRune;
import WayofTime.alchemicalWizardry.common.block.EmptySocket;
import WayofTime.alchemicalWizardry.common.block.ImperfectRitualStone;
import WayofTime.alchemicalWizardry.common.block.LargeBloodStoneBrick;
import WayofTime.alchemicalWizardry.common.block.LifeEssenceBlock;
import WayofTime.alchemicalWizardry.common.block.RitualStone;
import WayofTime.alchemicalWizardry.common.block.RuneOfSacrifice;
import WayofTime.alchemicalWizardry.common.block.RuneOfSelfSacrifice;
import WayofTime.alchemicalWizardry.common.block.SpectralBlock;
import WayofTime.alchemicalWizardry.common.block.SpeedRune;
import WayofTime.alchemicalWizardry.common.items.ItemBloodRuneBlock;
import WayofTime.alchemicalWizardry.common.items.ItemSpellEffectBlock;
import WayofTime.alchemicalWizardry.common.items.ItemSpellEnhancementBlock;
import WayofTime.alchemicalWizardry.common.items.ItemSpellModifierBlock;
import WayofTime.alchemicalWizardry.common.items.ItemSpellParadigmBlock;
import cpw.mods.fml.common.registry.GameRegistry;
/**
* Created with IntelliJ IDEA.
* User: Pokefenn
* Date: 17/01/14
* Time: 19:48
*/
public class ModBlocks
{
public static Block testingBlock;
public static Block bloodStoneBrick;
public static Block largeBloodStoneBrick;
// public static Block lifeEssenceStill;
// public static Block lifeEssenceFlowing;
public static BlockAltar blockAltar;
public static BloodRune bloodRune;
public static SpeedRune speedRune;
public static EfficiencyRune efficiencyRune;
public static RuneOfSacrifice runeOfSacrifice;
public static RuneOfSelfSacrifice runeOfSelfSacrifice;
public static Block blockMasterStone;
public static Block ritualStone;
public static Block imperfectRitualStone;
public static Block bloodSocket;
public static Block emptySocket;
public static Block armourForge;
public static Block blockWritingTable;
public static Block blockHomHeart;
public static Block blockPedestal;
public static Block blockPlinth;
public static Block blockLifeEssence;
public static Block blockTeleposer;
public static Block spectralBlock;
public static Block blockConduit;
public static Block blockBloodLight;
public static Block blockSpellEffect;
public static Block blockSpellParadigm;
public static Block blockSpellModifier;
public static Block blockSpellEnhancement;
public static Block blockSpectralContainer;
public static Block blockBuildingSchematicSaver;
public static Block blockDemonPortal;
public static void init()
{
blockAltar = new BlockAltar();
bloodRune = new BloodRune();
speedRune = new SpeedRune();
efficiencyRune = new EfficiencyRune();
runeOfSacrifice = new RuneOfSacrifice();
runeOfSelfSacrifice = new RuneOfSelfSacrifice();
blockTeleposer = new BlockTeleposer();
spectralBlock = new SpectralBlock();
ritualStone = new RitualStone();
blockMasterStone = new BlockMasterStone();
imperfectRitualStone = new ImperfectRitualStone();
bloodSocket = new BlockSocket();
armourForge = new ArmourForge();
emptySocket = new EmptySocket();
largeBloodStoneBrick = new LargeBloodStoneBrick();
bloodStoneBrick = new BloodStoneBrick();
blockWritingTable = new BlockWritingTable();
blockHomHeart = new BlockHomHeart();
blockPedestal = new BlockPedestal();
blockPlinth = new BlockPlinth();
blockConduit = new BlockConduit();
blockBloodLight = new BlockBloodLightSource();
blockSpellEffect = new BlockSpellEffect();
blockSpellParadigm = new BlockSpellParadigm();
blockSpellModifier = new BlockSpellModifier();
blockSpellEnhancement = new BlockSpellEnhancement();
blockSpectralContainer = new BlockSpectralContainer();
blockDemonPortal = new BlockDemonPortal();
blockBuildingSchematicSaver = new BlockSchematicSaver();
blockLifeEssence = new LifeEssenceBlock();
}
public static void registerBlocksInPre()
{
GameRegistry.registerBlock(ModBlocks.blockAltar, "Altar");
GameRegistry.registerBlock(ModBlocks.bloodRune, ItemBloodRuneBlock.class, "AlchemicalWizardry" + (ModBlocks.bloodRune.getUnlocalizedName().substring(5)));
GameRegistry.registerBlock(ModBlocks.blockLifeEssence, "lifeEssence");
GameRegistry.registerBlock(ModBlocks.speedRune, "speedRune");
GameRegistry.registerBlock(ModBlocks.efficiencyRune, "efficiencyRune");
GameRegistry.registerBlock(ModBlocks.runeOfSacrifice, "runeOfSacrifice");
GameRegistry.registerBlock(ModBlocks.runeOfSelfSacrifice, "runeOfSelfSacrifice");
GameRegistry.registerBlock(ModBlocks.ritualStone, "ritualStone");
GameRegistry.registerBlock(ModBlocks.blockMasterStone, "masterStone");
GameRegistry.registerBlock(ModBlocks.bloodSocket, "bloodSocket");
GameRegistry.registerBlock(ModBlocks.imperfectRitualStone, "imperfectRitualStone");
GameRegistry.registerBlock(ModBlocks.armourForge, "armourForge");
GameRegistry.registerBlock(ModBlocks.emptySocket, "emptySocket");
GameRegistry.registerBlock(ModBlocks.bloodStoneBrick, "bloodStoneBrick");
GameRegistry.registerBlock(ModBlocks.largeBloodStoneBrick, "largeBloodStoneBrick");
GameRegistry.registerBlock(ModBlocks.blockWritingTable, "blockWritingTable");
GameRegistry.registerBlock(ModBlocks.blockHomHeart, "blockHomHeart");
GameRegistry.registerBlock(ModBlocks.blockPedestal, "blockPedestal");
GameRegistry.registerBlock(ModBlocks.blockPlinth, "blockPlinth");
GameRegistry.registerBlock(ModBlocks.blockTeleposer, "blockTeleposer");
GameRegistry.registerBlock(ModBlocks.spectralBlock, "spectralBlock");
GameRegistry.registerBlock(ModBlocks.blockBloodLight, "bloodLight");
GameRegistry.registerBlock(ModBlocks.blockConduit,"blockConduit");
GameRegistry.registerBlock(ModBlocks.blockSpellParadigm, ItemSpellParadigmBlock.class, "AlchemicalWizardry" + (ModBlocks.blockSpellParadigm.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpellEnhancement, ItemSpellEnhancementBlock.class,"AlchemicalWizardry" + (ModBlocks.blockSpellEnhancement.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpellModifier, ItemSpellModifierBlock.class,"AlchemicalWizardry" + (ModBlocks.blockSpellModifier.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpellEffect, ItemSpellEffectBlock.class,"AlchemicalWizardry" + (ModBlocks.blockSpellEffect.getUnlocalizedName()));
GameRegistry.registerBlock(ModBlocks.blockSpectralContainer, "spectralContainer");
GameRegistry.registerBlock(ModBlocks.blockDemonPortal, "demonPortalMain");
GameRegistry.registerBlock(ModBlocks.blockBuildingSchematicSaver, "blockSchemSaver");
}
public static void registerBlocksInInit()
{
//GameRegistry.registerBlock(ModBlocks.blockLifeEssence, "lifeEssence");
}
}

View file

@ -0,0 +1,366 @@
package WayofTime.alchemicalWizardry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import WayofTime.alchemicalWizardry.common.items.AWBaseItems;
import WayofTime.alchemicalWizardry.common.items.ActivationCrystal;
import WayofTime.alchemicalWizardry.common.items.AirScribeTool;
import WayofTime.alchemicalWizardry.common.items.ApprenticeBloodOrb;
import WayofTime.alchemicalWizardry.common.items.ArchmageBloodOrb;
import WayofTime.alchemicalWizardry.common.items.ArmourInhibitor;
import WayofTime.alchemicalWizardry.common.items.BlankSpell;
import WayofTime.alchemicalWizardry.common.items.BloodShard;
import WayofTime.alchemicalWizardry.common.items.BoundArmour;
import WayofTime.alchemicalWizardry.common.items.BoundAxe;
import WayofTime.alchemicalWizardry.common.items.BoundPickaxe;
import WayofTime.alchemicalWizardry.common.items.BoundShovel;
import WayofTime.alchemicalWizardry.common.items.CheatyItem;
import WayofTime.alchemicalWizardry.common.items.DaggerOfSacrifice;
import WayofTime.alchemicalWizardry.common.items.DemonPlacer;
import WayofTime.alchemicalWizardry.common.items.DemonicTelepositionFocus;
import WayofTime.alchemicalWizardry.common.items.DuskScribeTool;
import WayofTime.alchemicalWizardry.common.items.EarthScribeTool;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.items.EnergyBazooka;
import WayofTime.alchemicalWizardry.common.items.EnergyBlast;
import WayofTime.alchemicalWizardry.common.items.EnergySword;
import WayofTime.alchemicalWizardry.common.items.EnhancedTelepositionFocus;
import WayofTime.alchemicalWizardry.common.items.FireScribeTool;
import WayofTime.alchemicalWizardry.common.items.ItemAlchemyBase;
import WayofTime.alchemicalWizardry.common.items.ItemComplexSpellCrystal;
import WayofTime.alchemicalWizardry.common.items.ItemComponents;
import WayofTime.alchemicalWizardry.common.items.ItemDiabloKey;
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner;
import WayofTime.alchemicalWizardry.common.items.LavaCrystal;
import WayofTime.alchemicalWizardry.common.items.LifeBucket;
import WayofTime.alchemicalWizardry.common.items.MagicianBloodOrb;
import WayofTime.alchemicalWizardry.common.items.MasterBloodOrb;
import WayofTime.alchemicalWizardry.common.items.ReinforcedTelepositionFocus;
import WayofTime.alchemicalWizardry.common.items.SacrificialDagger;
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
import WayofTime.alchemicalWizardry.common.items.WaterScribeTool;
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask;
import WayofTime.alchemicalWizardry.common.items.potion.AlchemyReagent;
import WayofTime.alchemicalWizardry.common.items.potion.AverageLengtheningCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.AveragePowerCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.EnhancedFillingAgent;
import WayofTime.alchemicalWizardry.common.items.potion.GreaterLengtheningCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.GreaterPowerCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.MundaneLengtheningCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.MundanePowerCatalyst;
import WayofTime.alchemicalWizardry.common.items.potion.StandardBindingAgent;
import WayofTime.alchemicalWizardry.common.items.potion.StandardFillingAgent;
import WayofTime.alchemicalWizardry.common.items.potion.WeakBindingAgent;
import WayofTime.alchemicalWizardry.common.items.potion.WeakFillingAgent;
import WayofTime.alchemicalWizardry.common.items.sigil.AirSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.DivinationSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemBloodLightSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemFluidSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemSeerSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemSigilOfEnderSeverance;
import WayofTime.alchemicalWizardry.common.items.sigil.ItemSigilOfSupression;
import WayofTime.alchemicalWizardry.common.items.sigil.LavaSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfElementalAffinity;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfGrowth;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHaste;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfMagnetism;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfTheBridge;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfTheFastMiner;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfWind;
import WayofTime.alchemicalWizardry.common.items.sigil.VoidSigil;
import WayofTime.alchemicalWizardry.common.items.sigil.WaterSigil;
import WayofTime.alchemicalWizardry.common.items.spell.ItemSpellMultiTool;
import cpw.mods.fml.common.registry.GameRegistry;
/**
* Created with IntelliJ IDEA.
* User: Pokefenn
* Date: 17/01/14
* Time: 19:48
*/
public class ModItems
{
public static Item weakBloodOrb;
public static Item apprenticeBloodOrb;
public static Item magicianBloodOrb;
public static Item energyBlaster;
public static Item energySword;
public static Item lavaCrystal;
public static Item waterSigil;
public static Item lavaSigil;
public static Item voidSigil;
public static Item blankSlate;
public static Item reinforcedSlate;
public static Item sacrificialDagger;
public static Item daggerOfSacrifice;
public static Item airSigil;
public static Item sigilOfTheFastMiner;
public static Item sigilOfElementalAffinity;
public static Item sigilOfHaste;
public static Item sigilOfHolding;
public static Item divinationSigil;
public static Item waterScribeTool;
public static Item fireScribeTool;
public static Item earthScribeTool;
public static Item airScribeTool;
public static Item activationCrystal;
public static Item boundPickaxe;
public static Item boundAxe;
public static Item boundShovel;
public static Item boundHelmet;
public static Item boundPlate;
public static Item boundLeggings;
public static Item boundBoots;
public static Item weakBloodShard;
public static Item growthSigil;
public static Item blankSpell;
public static Item masterBloodOrb;
public static Item alchemyFlask;
public static Item standardBindingAgent;
public static Item mundanePowerCatalyst;
public static Item averagePowerCatalyst;
public static Item greaterPowerCatalyst;
public static Item mundaneLengtheningCatalyst;
public static Item averageLengtheningCatalyst;
public static Item greaterLengtheningCatalyst;
public static Item incendium;
public static Item magicales;
public static Item sanctus;
public static Item aether;
public static Item simpleCatalyst;
public static Item crepitous;
public static Item crystallos;
public static Item terrae;
public static Item aquasalus;
public static Item tennebrae;
public static Item demonBloodShard;
public static Item archmageBloodOrb;
public static Item sigilOfWind;
public static Item telepositionFocus;
public static Item enhancedTelepositionFocus;
public static Item reinforcedTelepositionFocus;
public static Item demonicTelepositionFocus;
public static Item imbuedSlate;
public static Item demonicSlate;
public static Item duskScribeTool;
public static Item sigilOfTheBridge;
public static Item armourInhibitor;
public static Item creativeFiller;
public static Item demonPlacer;
public static Item baseItems;
public static Item baseAlchemyItems;
public static Item weakFillingAgent;
public static Item standardFillingAgent;
public static Item enhancedFillingAgent;
public static Item weakBindingAgent;
public static Item itemRitualDiviner;
public static Item sanguineHelmet;
public static Item focusBloodBlast;
public static Item focusGravityWell;
public static Item sigilOfMagnetism;
public static Item itemKeyOfDiablo;
public static Item energyBazooka;
public static Item itemBloodLightSigil;
public static Item itemComplexSpellCrystal;
public static Item itemBloodFrame;
public static Item itemSigilOfEnderSeverance;
public static Item itemSigilOfSupression;
public static Item itemFluidSigil;
public static Item itemSeerSigil;
public static Item customTool;
public static Item bucketLife;
public static void init()
{
weakBloodOrb = new EnergyBattery(5000).setUnlocalizedName("weakBloodOrb");
apprenticeBloodOrb = new ApprenticeBloodOrb(25000).setUnlocalizedName("apprenticeBloodOrb");
magicianBloodOrb = new MagicianBloodOrb(150000).setUnlocalizedName("magicianBloodOrb");
masterBloodOrb = new MasterBloodOrb(1000000).setUnlocalizedName("masterBloodOrb");
archmageBloodOrb = new ArchmageBloodOrb(10000000).setUnlocalizedName("archmageBloodOrb");
energyBlaster = new EnergyBlast().setUnlocalizedName("energyBlast");
energySword = new EnergySword().setUnlocalizedName("energySword");
lavaCrystal = new LavaCrystal().setUnlocalizedName("lavaCrystal");
waterSigil = new WaterSigil().setUnlocalizedName("waterSigil");
lavaSigil = new LavaSigil().setUnlocalizedName("lavaSigil");
voidSigil = new VoidSigil().setUnlocalizedName("voidSigil");
blankSlate = new AWBaseItems().setUnlocalizedName("blankSlate");
reinforcedSlate = new AWBaseItems().setUnlocalizedName("reinforcedSlate");
sacrificialDagger = new SacrificialDagger().setUnlocalizedName("sacrificialDagger");
daggerOfSacrifice = new DaggerOfSacrifice().setUnlocalizedName("daggerOfSacrifice");
airSigil = new AirSigil().setUnlocalizedName("airSigil");
sigilOfTheFastMiner = new SigilOfTheFastMiner().setUnlocalizedName("sigilOfTheFastMiner");
sigilOfElementalAffinity = new SigilOfElementalAffinity().setUnlocalizedName("sigilOfElementalAffinity");
sigilOfHaste = new SigilOfHaste().setUnlocalizedName("sigilOfHaste");
sigilOfHolding = new SigilOfHolding().setUnlocalizedName("sigilOfHolding");
divinationSigil = new DivinationSigil().setUnlocalizedName("divinationSigil");
waterScribeTool = new WaterScribeTool().setUnlocalizedName("waterScribeTool");
fireScribeTool = new FireScribeTool().setUnlocalizedName("fireScribeTool");
earthScribeTool = new EarthScribeTool().setUnlocalizedName("earthScribeTool");
airScribeTool = new AirScribeTool().setUnlocalizedName("airScribeTool");
activationCrystal = new ActivationCrystal();
boundPickaxe = new BoundPickaxe().setUnlocalizedName("boundPickaxe");
boundAxe = new BoundAxe().setUnlocalizedName("boundAxe");
boundShovel = new BoundShovel().setUnlocalizedName("boundShovel");
boundHelmet = new BoundArmour(0).setUnlocalizedName("boundHelmet");
boundPlate = new BoundArmour(1).setUnlocalizedName("boundPlate");
boundLeggings = new BoundArmour(2).setUnlocalizedName("boundLeggings");
boundBoots = new BoundArmour(3).setUnlocalizedName("boundBoots");
weakBloodShard = new BloodShard().setUnlocalizedName("weakBloodShard");
growthSigil = new SigilOfGrowth().setUnlocalizedName("growthSigil");
blankSpell = new BlankSpell().setUnlocalizedName("blankSpell");
alchemyFlask = new AlchemyFlask().setUnlocalizedName("alchemyFlask");
standardBindingAgent = new StandardBindingAgent().setUnlocalizedName("standardBindingAgent");
mundanePowerCatalyst = new MundanePowerCatalyst().setUnlocalizedName("mundanePowerCatalyst");
averagePowerCatalyst = new AveragePowerCatalyst().setUnlocalizedName("averagePowerCatalyst");
greaterPowerCatalyst = new GreaterPowerCatalyst().setUnlocalizedName("greaterPowerCatalyst");
mundaneLengtheningCatalyst = new MundaneLengtheningCatalyst().setUnlocalizedName("mundaneLengtheningCatalyst");
averageLengtheningCatalyst = new AverageLengtheningCatalyst().setUnlocalizedName("averageLengtheningCatalyst");
greaterLengtheningCatalyst = new GreaterLengtheningCatalyst().setUnlocalizedName("greaterLengtheningCatalyst");
incendium = new AlchemyReagent().setUnlocalizedName("incendium");
magicales = new AlchemyReagent().setUnlocalizedName("magicales");
sanctus = new AlchemyReagent().setUnlocalizedName("sanctus");
aether = new AlchemyReagent().setUnlocalizedName("aether");
simpleCatalyst = new AlchemyReagent().setUnlocalizedName("simpleCatalyst");
crepitous = new AlchemyReagent().setUnlocalizedName("crepitous");
crystallos = new AlchemyReagent().setUnlocalizedName("crystallos");
terrae = new AlchemyReagent().setUnlocalizedName("terrae");
aquasalus = new AlchemyReagent().setUnlocalizedName("aquasalus");
tennebrae = new AlchemyReagent().setUnlocalizedName("tennebrae");
demonBloodShard = new BloodShard().setUnlocalizedName("demonBloodShard");
sigilOfWind = new SigilOfWind().setUnlocalizedName("sigilOfWind");
telepositionFocus = new TelepositionFocus(1).setUnlocalizedName("telepositionFocus");
enhancedTelepositionFocus = new EnhancedTelepositionFocus().setUnlocalizedName("enhancedTelepositionFocus");
reinforcedTelepositionFocus = new ReinforcedTelepositionFocus().setUnlocalizedName("reinforcedTelepositionFocus");
demonicTelepositionFocus = new DemonicTelepositionFocus().setUnlocalizedName("demonicTelepositionFocus");
imbuedSlate = new AWBaseItems().setUnlocalizedName("imbuedSlate");
demonicSlate = new AWBaseItems().setUnlocalizedName("demonicSlate");
duskScribeTool = new DuskScribeTool().setUnlocalizedName("duskScribeTool");
sigilOfTheBridge = new SigilOfTheBridge().setUnlocalizedName("sigilOfTheBridge");
armourInhibitor = new ArmourInhibitor().setUnlocalizedName("armourInhibitor");
creativeFiller = new CheatyItem().setUnlocalizedName("cheatyItem");
demonPlacer = new DemonPlacer().setUnlocalizedName("demonPlacer");
weakFillingAgent = new WeakFillingAgent().setUnlocalizedName("weakFillingAgent");
standardFillingAgent = new StandardFillingAgent().setUnlocalizedName("standardFillingAgent");
enhancedFillingAgent = new EnhancedFillingAgent().setUnlocalizedName("enhancedFillingAgent");
weakBindingAgent = new WeakBindingAgent().setUnlocalizedName("weakBindingAgent");
itemRitualDiviner = new ItemRitualDiviner().setUnlocalizedName("ritualDiviner");
sigilOfMagnetism = new SigilOfMagnetism().setUnlocalizedName("sigilOfMagnetism");
itemKeyOfDiablo = new ItemDiabloKey().setUnlocalizedName("itemDiabloKey");
energyBazooka = new EnergyBazooka().setUnlocalizedName("energyBazooka");
itemBloodLightSigil = new ItemBloodLightSigil().setUnlocalizedName("bloodLightSigil");
itemComplexSpellCrystal = new ItemComplexSpellCrystal().setUnlocalizedName("itemComplexSpellCrystal");
bucketLife = (new LifeBucket(ModBlocks.blockLifeEssence)).setUnlocalizedName("bucketLife").setContainerItem(Items.bucket).setCreativeTab(CreativeTabs.tabMisc);
itemSigilOfEnderSeverance = (new ItemSigilOfEnderSeverance()).setUnlocalizedName("itemSigilOfEnderSeverance");
baseItems = new ItemComponents().setUnlocalizedName("baseItems");
baseAlchemyItems = new ItemAlchemyBase().setUnlocalizedName("baseAlchemyItems");
itemSigilOfSupression = new ItemSigilOfSupression().setUnlocalizedName("itemSigilOfSupression");
itemFluidSigil = new ItemFluidSigil().setUnlocalizedName("itemFluidSigil");
itemSeerSigil = new ItemSeerSigil().setUnlocalizedName("itemSeerSigil");
customTool = new ItemSpellMultiTool().setUnlocalizedName("multiTool");
}
public static void registerItems()
{
GameRegistry.registerItem(ModItems.weakBloodOrb, "weakBloodOrb");
GameRegistry.registerItem(ModItems.apprenticeBloodOrb, "apprenticeBloodOrb");
GameRegistry.registerItem(ModItems.magicianBloodOrb, "magicianBloodOrb");
GameRegistry.registerItem(ModItems.energyBlaster, "energyBlaster");
GameRegistry.registerItem(ModItems.energySword, "energySword");
GameRegistry.registerItem(ModItems.lavaCrystal, "lavaCrystal");
GameRegistry.registerItem(ModItems.waterSigil, "waterSigil");
GameRegistry.registerItem(ModItems.lavaSigil, "lavaSigil");
GameRegistry.registerItem(ModItems.voidSigil, "voidSigil");
GameRegistry.registerItem(ModItems.blankSlate, "blankSlate");
GameRegistry.registerItem(ModItems.reinforcedSlate, "reinforcedSlate");
GameRegistry.registerItem(ModItems.sacrificialDagger, "sacrificialKnife");
GameRegistry.registerItem(ModItems.daggerOfSacrifice, "daggerOfSacrifice");
GameRegistry.registerItem(ModItems.airSigil, "airSigil");
GameRegistry.registerItem(ModItems.sigilOfTheFastMiner, "sigilOfTheFastMiner");
GameRegistry.registerItem(ModItems.sigilOfElementalAffinity, "sigilOfElementalAffinity");
GameRegistry.registerItem(ModItems.sigilOfHaste, "sigilOfHaste");
GameRegistry.registerItem(ModItems.sigilOfHolding, "sigilOfHolding");
GameRegistry.registerItem(ModItems.divinationSigil, "divinationSigil");
GameRegistry.registerItem(ModItems.waterScribeTool, "waterScribeTool");
GameRegistry.registerItem(ModItems.fireScribeTool, "fireScribeTool");
GameRegistry.registerItem(ModItems.earthScribeTool, "earthScribeTool");
GameRegistry.registerItem(ModItems.airScribeTool, "airScribeTool");
GameRegistry.registerItem(ModItems.activationCrystal, "activationCrystal");
GameRegistry.registerItem(ModItems.boundPickaxe, "boundPickaxe");
GameRegistry.registerItem(ModItems.boundAxe, "boundAxe");
GameRegistry.registerItem(ModItems.boundShovel, "boundShovel");
GameRegistry.registerItem(ModItems.boundHelmet, "boundHelmet");
GameRegistry.registerItem(ModItems.boundPlate, "boundPlate");
GameRegistry.registerItem(ModItems.boundLeggings, "boundLeggings");
GameRegistry.registerItem(ModItems.boundBoots, "boundBoots");
GameRegistry.registerItem(ModItems.weakBloodShard, "weakBloodShard");
GameRegistry.registerItem(ModItems.growthSigil, "growthSigil");
GameRegistry.registerItem(ModItems.blankSpell, "blankSpell");
GameRegistry.registerItem(ModItems.masterBloodOrb, "masterBloodOrb");
GameRegistry.registerItem(ModItems.alchemyFlask, "alchemyFlask");
GameRegistry.registerItem(ModItems.standardBindingAgent, "standardBindingAgent");
GameRegistry.registerItem(ModItems.mundanePowerCatalyst, "mundanePowerCatalyst");
GameRegistry.registerItem(ModItems.averagePowerCatalyst, "averagePowerCatalyst");
GameRegistry.registerItem(ModItems.greaterPowerCatalyst, "greaterPowerCatalyst");
GameRegistry.registerItem(ModItems.mundaneLengtheningCatalyst, "mundaneLengtheningCatalyst");
GameRegistry.registerItem(ModItems.averageLengtheningCatalyst, "averageLengtheningCatalyst");
GameRegistry.registerItem(ModItems.greaterLengtheningCatalyst, "greaterLengtheningCatalyst");
GameRegistry.registerItem(ModItems.incendium, "incendium");
GameRegistry.registerItem(ModItems.magicales, "magicales");
GameRegistry.registerItem(ModItems.sanctus, "sanctus");
GameRegistry.registerItem(ModItems.aether, "aether");
GameRegistry.registerItem(ModItems.simpleCatalyst, "simpleCatalyst");
GameRegistry.registerItem(ModItems.crepitous, "crepitous");
GameRegistry.registerItem(ModItems.crystallos, "crystallos");
GameRegistry.registerItem(ModItems.terrae, "terrae");
GameRegistry.registerItem(ModItems.aquasalus, "aquasalus");
GameRegistry.registerItem(ModItems.tennebrae, "tennebrae");
GameRegistry.registerItem(ModItems.demonBloodShard, "demonBloodShard");
GameRegistry.registerItem(ModItems.archmageBloodOrb, "archmageBloodOrb");
GameRegistry.registerItem(ModItems.sigilOfWind, "sigilOfWind");
GameRegistry.registerItem(ModItems.telepositionFocus, "telepositionFocus");
GameRegistry.registerItem(ModItems.enhancedTelepositionFocus, "enhancedTelepositionFocus");
GameRegistry.registerItem(ModItems.reinforcedTelepositionFocus, "reinforcedTelepositionFocus");
GameRegistry.registerItem(ModItems.demonicTelepositionFocus, "demonicTelepositionFocus");
GameRegistry.registerItem(ModItems.imbuedSlate, "imbuedSlate");
GameRegistry.registerItem(ModItems.demonicSlate, "demonicSlate");
GameRegistry.registerItem(ModItems.duskScribeTool, "duskScribeTool");
GameRegistry.registerItem(ModItems.sigilOfTheBridge, "sigilOfTheBridge");
GameRegistry.registerItem(ModItems.armourInhibitor, "armourInhibitor");
GameRegistry.registerItem(ModItems.creativeFiller, "creativeFiller");
GameRegistry.registerItem(ModItems.demonPlacer, "demonPlacer");
GameRegistry.registerItem(ModItems.weakFillingAgent, "weakFillingAgent");
GameRegistry.registerItem(ModItems.standardFillingAgent, "standardFillingAgent");
GameRegistry.registerItem(ModItems.enhancedFillingAgent, "enhancedFillingAgent");
GameRegistry.registerItem(ModItems.weakBindingAgent, "weakBindingAgent");
GameRegistry.registerItem(ModItems.itemRitualDiviner, "itemRitualDiviner");
//GameRegistry.registerItem(ModItems.sanguineHelmet, "sanguineHelmet");
//GameRegistry.registerItem(ModItems.focusBloodBlast, "focusBloodBlast");
//GameRegistry.registerItem(ModItems.focusGravityWell, "focusGravityWell");
GameRegistry.registerItem(ModItems.sigilOfMagnetism, "sigilOfMagnetism");
GameRegistry.registerItem(ModItems.itemKeyOfDiablo, "itemKeyOfDiablo");
GameRegistry.registerItem(ModItems.energyBazooka, "energyBazooka");
GameRegistry.registerItem(ModItems.itemBloodLightSigil, "itemBloodLightSigil");
GameRegistry.registerItem(ModItems.itemComplexSpellCrystal, "itemComplexSpellCrystal");
GameRegistry.registerItem(ModItems.itemSigilOfSupression, "sigilOfSupression");
GameRegistry.registerItem(ModItems.itemSigilOfEnderSeverance, "sigilOfEnderSeverance");
GameRegistry.registerItem(ModItems.itemFluidSigil, "fluidSigil");
GameRegistry.registerItem(ModItems.itemSeerSigil, "seerSigil");
GameRegistry.registerItem(ModItems.customTool, "customTool");
GameRegistry.registerItem(ModItems.bucketLife, "bucketLife");
GameRegistry.registerItem(ModItems.baseItems, "bloodMagicBaseItems");
GameRegistry.registerItem(ModItems.baseAlchemyItems, "bloodMagicBaseAlchemyItems");
//GameRegistry.registerItem(ModItems.itemBloodFrame, "itemBloodFrame");
}
}

View file

@ -0,0 +1,79 @@
package WayofTime.alchemicalWizardry.api.alchemy;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
public class AlchemicalPotionCreationHandler
{
public static ArrayList<AlchemyPotionHandlerComponent> registeredPotionEffects = new ArrayList();
public static void addPotion(ItemStack itemStack, int potionID, int tickDuration)
{
registeredPotionEffects.add(new AlchemyPotionHandlerComponent(itemStack, potionID, tickDuration));
}
public static int getPotionIDForStack(ItemStack itemStack)
{
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
{
if (aphc.compareItemStack(itemStack))
{
return aphc.getPotionID();
}
}
return -1;
}
public static int getPotionTickDurationForStack(ItemStack itemStack)
{
{
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
{
if (aphc.compareItemStack(itemStack))
{
return aphc.getTickDuration();
}
}
return -1;
}
}
public static boolean containsRegisteredPotionIngredient(ItemStack[] stackList)
{
for (ItemStack is : stackList)
{
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
{
if (aphc.compareItemStack(is))
{
return true;
}
}
}
return false;
}
public static int getRegisteredPotionIngredientPosition(ItemStack[] stackList)
{
int i = 0;
for (ItemStack is : stackList)
{
for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects)
{
if (aphc.compareItemStack(is))
{
return i;
}
}
i++;
}
return -1;
}
}

View file

@ -0,0 +1,52 @@
package WayofTime.alchemicalWizardry.api.alchemy;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class AlchemyPotionHandlerComponent
{
private ItemStack itemStack;
private int potionID;
private int tickDuration;
public AlchemyPotionHandlerComponent(ItemStack itemStack, int potionID, int tickDuration)
{
this.itemStack = itemStack;
this.potionID = potionID;
this.tickDuration = tickDuration;
}
public boolean compareItemStack(ItemStack comparedStack)
{
if (comparedStack != null && itemStack != null)
{
if (comparedStack.getItem() instanceof ItemBlock)
{
if (itemStack.getItem() instanceof ItemBlock)
{
return comparedStack.getItem().equals(itemStack.getItem()) && comparedStack.getItemDamage() == itemStack.getItemDamage();
}
} else if (!(itemStack.getItem() instanceof ItemBlock))
{
return comparedStack.getItem().equals(itemStack.getItem()) && comparedStack.getItemDamage() == itemStack.getItemDamage();
}
}
return false;
}
public ItemStack getItemStack()
{
return itemStack;
}
public int getPotionID()
{
return this.potionID;
}
public int getTickDuration()
{
return this.tickDuration;
}
}

View file

@ -0,0 +1,76 @@
package WayofTime.alchemicalWizardry.api.alchemy;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
public class AlchemyPotionHelper
{
private int potionID;
private int tickDuration;
private int concentration;
private int durationFactor;
public AlchemyPotionHelper(int potionID, int tickDuration, int concentration, int durationFactor)
{
this.potionID = potionID;
this.tickDuration = tickDuration;
this.concentration = concentration;
this.durationFactor = durationFactor;
}
public void setConcentration(int concentration)
{
this.concentration = concentration;
}
public void setDurationFactor(int durationFactor)
{
this.durationFactor = durationFactor;
}
public int getPotionID()
{
return this.potionID;
}
public int getTickDuration()
{
return this.tickDuration;
}
public int getConcentration()
{
return this.concentration;
}
public int getdurationFactor()
{
return this.durationFactor;
}
public PotionEffect getPotionEffect()
{
if (potionID == Potion.heal.id || potionID == Potion.harm.id)
{
return (new PotionEffect(potionID, 1, concentration));
}
return (new PotionEffect(potionID, (int) (tickDuration * Math.pow(0.5f, concentration) * Math.pow(8.0f / 3.0f, durationFactor)), concentration));
}
public static AlchemyPotionHelper readEffectFromNBT(NBTTagCompound tagCompound)
{
return new AlchemyPotionHelper(tagCompound.getInteger("potionID"), tagCompound.getInteger("tickDuration"), tagCompound.getInteger("concentration"), tagCompound.getInteger("durationFactor"));
}
public static NBTTagCompound setEffectToNBT(AlchemyPotionHelper aph)
{
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setInteger("potionID", aph.getPotionID());
tagCompound.setInteger("tickDuration", aph.getTickDuration());
tagCompound.setInteger("concentration", aph.getConcentration());
tagCompound.setInteger("durationFactor", aph.getdurationFactor());
return tagCompound;
}
}

View file

@ -0,0 +1,143 @@
package WayofTime.alchemicalWizardry.api.alchemy;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class AlchemyRecipe
{
private ItemStack output;
private ItemStack[] recipe;
private int bloodOrbLevel;
private int amountNeeded;
public AlchemyRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel)
{
this.output = output;
this.recipe = recipe;
this.amountNeeded = amountNeeded;
this.bloodOrbLevel = bloodOrbLevel;
}
public boolean doesRecipeMatch(ItemStack[] items, int slottedBloodOrbLevel)
{
if (slottedBloodOrbLevel < bloodOrbLevel)
{
return false;
}
ItemStack[] recipe = new ItemStack[5];
if (items.length < 5)
{
return false;
}
if (this.recipe.length != 5)
{
ItemStack[] newRecipe = new ItemStack[5];
for (int i = 0; i < 5; i++)
{
if (i + 1 > this.recipe.length)
{
newRecipe[i] = null;
} else
{
newRecipe[i] = this.recipe[i];
}
}
recipe = newRecipe;
} else
{
recipe = this.recipe;
}
boolean[] checkList = new boolean[5];
for (int i = 0; i < 5; i++)
{
checkList[i] = false;
}
for (int i = 0; i < 5; i++)
{
ItemStack recipeItemStack = recipe[i];
if (recipeItemStack == null)
{
continue;
}
boolean test = false;
for (int j = 0; j < 5; j++)
{
if (checkList[j])
{
continue;
}
ItemStack checkedItemStack = items[j];
if (checkedItemStack == null)
{
continue;
}
boolean quickTest = false;
if (recipeItemStack.getItem() instanceof ItemBlock)
{
if (checkedItemStack.getItem() instanceof ItemBlock)
{
quickTest = true;
}
} else if (!(checkedItemStack.getItem() instanceof ItemBlock))
{
quickTest = true;
}
if (!quickTest)
{
continue;
}
if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) && checkedItemStack.getItem()==recipeItemStack.getItem())
{
test = true;
checkList[j] = true;
break;
}
}
if (!test)
{
return false;
}
}
return true;
}
public ItemStack getResult()
{
return output.copy();
}
public int getAmountNeeded()
{
return this.amountNeeded;
}
public ItemStack[] getRecipe()
{
return this.recipe;
}
public int getOrbLevel()
{
return this.bloodOrbLevel;
}
}

View file

@ -0,0 +1,85 @@
package WayofTime.alchemicalWizardry.api.alchemy;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
public class AlchemyRecipeRegistry
{
public static List<AlchemyRecipe> recipes = new ArrayList();
public static void registerRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel)
{
recipes.add(new AlchemyRecipe(output, amountNeeded, recipe, bloodOrbLevel));
}
public static ItemStack getResult(ItemStack[] recipe, ItemStack bloodOrb)
{
if (bloodOrb == null)
{
return null;
}
if (!(bloodOrb.getItem() instanceof IBloodOrb))
{
return null;
}
int bloodOrbLevel = ((IBloodOrb) bloodOrb.getItem()).getOrbLevel();
for (AlchemyRecipe ar : recipes)
{
if (ar.doesRecipeMatch(recipe, bloodOrbLevel))
{
return (ar.getResult());
}
}
return null;
}
public static int getAmountNeeded(ItemStack[] recipe, ItemStack bloodOrb)
{
if (bloodOrb == null)
{
return 0;
}
if (!(bloodOrb.getItem() instanceof IBloodOrb))
{
return 0;
}
int bloodOrbLevel = ((IBloodOrb) bloodOrb.getItem()).getOrbLevel();
for (AlchemyRecipe ar : recipes)
{
if (ar.doesRecipeMatch(recipe, bloodOrbLevel))
{
return (ar.getAmountNeeded());
}
}
return 0;
}
public static ItemStack[] getRecipeForItemStack(ItemStack itemStack)
{
for (AlchemyRecipe ar : recipes)
{
ItemStack result = ar.getResult();
if (result != null)
{
if (result.isItemEqual(itemStack))
{
return ar.getRecipe();
}
}
}
return null;
}
}

View file

@ -0,0 +1,70 @@
package WayofTime.alchemicalWizardry.api.altarRecipeRegistry;
import net.minecraft.item.ItemStack;
public class AltarRecipe
{
public int minTier;
public int liquidRequired;
public boolean canBeFilled; //Tells the system that the item is an orb
public int consumptionRate;
public int drainRate;
public ItemStack requiredItem;
public ItemStack result;
public AltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled)
{
this.result = result;
this.requiredItem = requiredItem;
this.minTier = minTier;
this.liquidRequired = liquidRequired;
this.consumptionRate = consumptionRate;
this.drainRate = drainRate;
this.canBeFilled = canBeFilled;
}
public ItemStack getResult()
{
return this.result;
}
public ItemStack getRequiredItem()
{
return this.requiredItem;
}
public boolean doesRequiredItemMatch(ItemStack comparedStack, int tierCheck)
{
if(comparedStack == null || this.requiredItem == null)
{
return false;
}
return tierCheck>=minTier && this.requiredItem.isItemEqual(comparedStack);
}
public int getMinTier()
{
return this.minTier;
}
public int getLiquidRequired()
{
return this.liquidRequired;
}
public int getConsumptionRate()
{
return this.consumptionRate;
}
public int getDrainRate()
{
return this.drainRate;
}
public boolean getCanBeFilled()
{
return this.canBeFilled;
}
}

View file

@ -0,0 +1,60 @@
package WayofTime.alchemicalWizardry.api.altarRecipeRegistry;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.item.ItemStack;
public class AltarRecipeRegistry
{
public static List<AltarRecipe> altarRecipes = new LinkedList();
public static void registerAltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled)
{
altarRecipes.add(new AltarRecipe(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled));
}
public static void registerAltarOrbRecipe(ItemStack orbStack, int minTier, int consumptionRate)
{
registerAltarRecipe(null, orbStack, minTier, 0, consumptionRate, 0, true);
}
public static boolean isRequiredItemValid(ItemStack testItem, int currentTierAltar)
{
for(AltarRecipe recipe : altarRecipes)
{
if(recipe.doesRequiredItemMatch(testItem, currentTierAltar))
{
return true;
}
}
return false;
}
public static ItemStack getItemForItemAndTier(ItemStack testItem, int currentTierAltar)
{
for(AltarRecipe recipe : altarRecipes)
{
if(recipe.doesRequiredItemMatch(testItem, currentTierAltar))
{
return ItemStack.copyItemStack(recipe.getResult());
}
}
return null;
}
public static AltarRecipe getAltarRecipeForItemAndTier(ItemStack testItem, int currentTierAltar)
{
for(AltarRecipe recipe : altarRecipes)
{
if(recipe.doesRequiredItemMatch(testItem, currentTierAltar))
{
return recipe;
}
}
return null;
}
}

View file

@ -0,0 +1,30 @@
package WayofTime.alchemicalWizardry.api.bindingRegistry;
import net.minecraft.item.ItemStack;
public class BindingRecipe
{
public ItemStack requiredItem;
public ItemStack outputItem;
public BindingRecipe(ItemStack outputItem, ItemStack requiredItem)
{
this.requiredItem = requiredItem;
this.outputItem = outputItem;
}
public boolean doesRequiredItemMatch(ItemStack testStack)
{
if(testStack == null || this.requiredItem == null)
{
return false;
}
return this.requiredItem.isItemEqual(testStack);
}
public ItemStack getResult()
{
return this.outputItem;
}
}

View file

@ -0,0 +1,67 @@
package WayofTime.alchemicalWizardry.api.bindingRegistry;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.item.ItemStack;
public class BindingRegistry
{
public static List<BindingRecipe> bindingRecipes = new LinkedList();
public static void registerRecipe(ItemStack output, ItemStack input)
{
bindingRecipes.add(new BindingRecipe(output, input));
}
public static boolean isRequiredItemValid(ItemStack testItem)
{
for(BindingRecipe recipe : bindingRecipes)
{
if(recipe.doesRequiredItemMatch(testItem))
{
return true;
}
}
return false;
}
public static ItemStack getItemForItemAndTier(ItemStack testItem)
{
for(BindingRecipe recipe : bindingRecipes)
{
if(recipe.doesRequiredItemMatch(testItem))
{
return recipe.getResult().copy();
}
}
return null;
}
public static int getIndexForItem(ItemStack testItem)
{
int i=0;
for(BindingRecipe recipe : bindingRecipes)
{
if(recipe.doesRequiredItemMatch(testItem))
{
return i;
}
i++;
}
return -1;
}
public static ItemStack getOutputForIndex(int index)
{
if(bindingRecipes.size()<=index)
{
return null;
}
return bindingRecipes.get(index).getResult();
}
}

View file

@ -0,0 +1,227 @@
package WayofTime.alchemicalWizardry.api.items;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.block.Block;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
/** Shaped Blood Orb Recipe Handler by joshie **/
public class ShapedBloodOrbRecipe implements IRecipe {
private static final int MAX_CRAFT_GRID_WIDTH = 3;
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
private ItemStack output = null;
private Object[] input = null;
public int width = 0;
public int height = 0;
private boolean mirrored = true;
public ShapedBloodOrbRecipe(Block result, Object... recipe) {
this(new ItemStack(result), recipe);
}
public ShapedBloodOrbRecipe(Item result, Object... recipe) {
this(new ItemStack(result), recipe);
}
public ShapedBloodOrbRecipe(ItemStack result, Object... recipe) {
output = result.copy();
String shape = "";
int idx = 0;
if (recipe[idx] instanceof Boolean) {
mirrored = (Boolean) recipe[idx];
if (recipe[idx + 1] instanceof Object[]) {
recipe = (Object[]) recipe[idx + 1];
} else {
idx = 1;
}
}
if (recipe[idx] instanceof String[]) {
String[] parts = ((String[]) recipe[idx++]);
for (String s : parts) {
width = s.length();
shape += s;
}
height = parts.length;
} else {
while (recipe[idx] instanceof String) {
String s = (String) recipe[idx++];
shape += s;
width = s.length();
height++;
}
}
if (width * height != shape.length()) {
String ret = "Invalid shaped ore recipe: ";
for (Object tmp : recipe) {
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
for (; idx < recipe.length; idx += 2) {
Character chr = (Character) recipe[idx];
Object in = recipe[idx + 1];
if (in instanceof IBloodOrb || (in instanceof ItemStack && ((ItemStack)in).getItem() instanceof IBloodOrb)) { //If the item is an instanceof IBloodOrb then save the level of the orb
if(in instanceof ItemStack) itemMap.put(chr, (Integer)(((IBloodOrb)((ItemStack)in).getItem()).getOrbLevel()));
else itemMap.put(chr, (Integer)(((IBloodOrb)in).getOrbLevel()));
} else if (in instanceof ItemStack) {
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((Block) in, 1, OreDictionary.WILDCARD_VALUE));
} else if (in instanceof String) {
itemMap.put(chr, OreDictionary.getOres((String) in));
} else {
String ret = "Invalid shaped ore recipe: ";
for (Object tmp : recipe) {
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
}
input = new Object[width * height];
int x = 0;
for (char chr : shape.toCharArray()) {
input[x++] = itemMap.get(chr);
}
}
ShapedBloodOrbRecipe(ShapedRecipes recipe, Map<ItemStack, String> replacements) {
output = recipe.getRecipeOutput();
width = recipe.recipeWidth;
height = recipe.recipeHeight;
input = new Object[recipe.recipeItems.length];
for (int i = 0; i < input.length; i++) {
ItemStack ingred = recipe.recipeItems[i];
if (ingred == null)
continue;
input[i] = recipe.recipeItems[i];
for (Entry<ItemStack, String> replace : replacements.entrySet()) {
if (OreDictionary.itemMatches(replace.getKey(), ingred, true)) {
input[i] = OreDictionary.getOres(replace.getValue());
break;
}
}
}
}
@Override
public ItemStack getCraftingResult(InventoryCrafting var1) {
return output.copy();
}
@Override
public int getRecipeSize() {
return input.length;
}
@Override
public ItemStack getRecipeOutput() {
return output;
}
@Override
public boolean matches(InventoryCrafting inv, World world) {
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) {
for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y) {
if (checkMatch(inv, x, y, false)) {
return true;
}
if (mirrored && checkMatch(inv, x, y, true)) {
return true;
}
}
}
return false;
}
@SuppressWarnings("unchecked")
private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror) {
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++) {
for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++) {
int subX = x - startX;
int subY = y - startY;
Object target = null;
if (subX >= 0 && subY >= 0 && subX < width && subY < height) {
if (mirror) {
target = input[width - subX - 1 + subY * width];
} else {
target = input[subX + subY * width];
}
}
ItemStack slot = inv.getStackInRowAndColumn(x, y);
//If target is integer, then we should be check the blood orb value of the item instead
if(target instanceof Integer) {
if(slot != null && slot.getItem() instanceof IBloodOrb) {
IBloodOrb orb = (IBloodOrb) slot.getItem();
if(orb.getOrbLevel() < (Integer)target) {
return false;
}
} else return false;
} else if (target instanceof ItemStack) {
if (!OreDictionary.itemMatches((ItemStack) target, slot, false)) {
return false;
}
} else if (target instanceof ArrayList) {
boolean matched = false;
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) target).iterator();
while (itr.hasNext() && !matched) {
matched = OreDictionary.itemMatches(itr.next(), slot, false);
}
if (!matched) {
return false;
}
} else if (target == null && slot != null) {
return false;
}
}
}
return true;
}
public ShapedBloodOrbRecipe setMirrored(boolean mirror) {
mirrored = mirror;
return this;
}
public Object[] getInput() {
return this.input;
}
}

View file

@ -0,0 +1,140 @@
package WayofTime.alchemicalWizardry.api.items;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.block.Block;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
/** Shapeless Blood Orb Recipe Handler by joshie **/
public class ShapelessBloodOrbRecipe implements IRecipe {
private ItemStack output = null;
private ArrayList<Object> input = new ArrayList<Object>();
public ShapelessBloodOrbRecipe(Block result, Object... recipe) {
this(new ItemStack(result), recipe);
}
public ShapelessBloodOrbRecipe(Item result, Object... recipe) {
this(new ItemStack(result), recipe);
}
public ShapelessBloodOrbRecipe(ItemStack result, Object... recipe) {
output = result.copy();
for (Object in : recipe) {
if (in instanceof ItemStack) {
input.add(((ItemStack) in).copy());
} else if (in instanceof IBloodOrb) { //If the item is an instanceof IBloodOrb then save the level of the orb
input.add((Integer)(((IBloodOrb)in).getOrbLevel()));
} else if (in instanceof Item) {
input.add(new ItemStack((Item) in));
} else if (in instanceof Block) {
input.add(new ItemStack((Block) in));
} else if (in instanceof String) {
input.add(OreDictionary.getOres((String) in));
} else {
String ret = "Invalid shapeless ore recipe: ";
for (Object tmp : recipe) {
ret += tmp + ", ";
}
ret += output;
throw new RuntimeException(ret);
}
}
}
@SuppressWarnings("unchecked")
ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map<ItemStack, String> replacements) {
output = recipe.getRecipeOutput();
for (ItemStack ingred : ((List<ItemStack>) recipe.recipeItems)) {
Object finalObj = ingred;
for (Entry<ItemStack, String> replace : replacements.entrySet()) {
if (OreDictionary.itemMatches(replace.getKey(), ingred, false)) {
finalObj = OreDictionary.getOres(replace.getValue());
break;
}
}
input.add(finalObj);
}
}
@Override
public int getRecipeSize() {
return input.size();
}
@Override
public ItemStack getRecipeOutput() {
return output;
}
@Override
public ItemStack getCraftingResult(InventoryCrafting var1) {
return output.copy();
}
@SuppressWarnings("unchecked")
@Override
public boolean matches(InventoryCrafting var1, World world) {
ArrayList<Object> required = new ArrayList<Object>(input);
for (int x = 0; x < var1.getSizeInventory(); x++) {
ItemStack slot = var1.getStackInSlot(x);
if (slot != null) {
boolean inRecipe = false;
Iterator<Object> req = required.iterator();
while (req.hasNext()) {
boolean match = false;
Object next = req.next();
//If target is integer, then we should be check the blood orb value of the item instead
if(next instanceof Integer) {
if(slot != null && slot.getItem() instanceof IBloodOrb) {
IBloodOrb orb = (IBloodOrb) slot.getItem();
if(orb.getOrbLevel() < (Integer)next) {
return false;
}
} else return false;
} else if (next instanceof ItemStack) {
match = OreDictionary.itemMatches((ItemStack) next, slot, false);
} else if (next instanceof ArrayList) {
Iterator<ItemStack> itr = ((ArrayList<ItemStack>) next).iterator();
while (itr.hasNext() && !match) {
match = OreDictionary.itemMatches(itr.next(), slot, false);
}
}
if (match) {
inRecipe = true;
required.remove(next);
break;
}
}
if (!inRecipe) {
return false;
}
}
}
return required.isEmpty();
}
public ArrayList<Object> getInput() {
return this.input;
}
}

View file

@ -0,0 +1,15 @@
package WayofTime.alchemicalWizardry.api.items.interfaces;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface ArmourUpgrade
{
//Called when the armour ticks
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack);
public boolean isUpgrade();
public int getEnergyForTenSeconds();
}

View file

@ -0,0 +1,5 @@
package WayofTime.alchemicalWizardry.api.items.interfaces;
public interface IBindable
{
}

View file

@ -0,0 +1,8 @@
package WayofTime.alchemicalWizardry.api.items.interfaces;
public interface IBloodOrb
{
public int getMaxEssence();
public int getOrbLevel();
}

View file

@ -0,0 +1,6 @@
package WayofTime.alchemicalWizardry.api.items.interfaces;
public interface IHolding
{
}

View file

@ -0,0 +1,30 @@
package WayofTime.alchemicalWizardry.api.rituals;
import net.minecraft.world.World;
public interface IMasterRitualStone
{
public void performRitual(World world, int x, int y, int z, String ritualID);
public String getOwner();
public void setCooldown(int newCooldown);
public int getCooldown();
public void setVar1(int newVar1);
public int getVar1();
public void setActive(boolean active);
public int getDirection();
public World getWorld();
public int getXCoord();
public int getYCoord();
public int getZCoord();
}

View file

@ -0,0 +1,6 @@
package WayofTime.alchemicalWizardry.api.rituals;
public interface IRitualStone
{
}

View file

@ -0,0 +1,43 @@
package WayofTime.alchemicalWizardry.api.rituals;
public class RitualComponent
{
private int x;
private int y;
private int z;
private int stoneType;
public static final int BLANK = 0;
public static final int WATER = 1;
public static final int FIRE = 2;
public static final int EARTH = 3;
public static final int AIR = 4;
public static final int DUSK = 5;
public RitualComponent(int x, int y, int z, int stoneType)
{
this.x = x;
this.y = y;
this.z = z;
this.stoneType = stoneType;
}
public int getX()
{
return this.x;
}
public int getY()
{
return this.y;
}
public int getZ()
{
return this.z;
}
public int getStoneType()
{
return this.stoneType;
}
}

View file

@ -0,0 +1,17 @@
package WayofTime.alchemicalWizardry.api.rituals;
import java.util.List;
public abstract class RitualEffect
{
public abstract void performEffect(IMasterRitualStone ritualStone);
public abstract int getCostPerRefresh();
public int getInitialCooldown()
{
return 0;
}
public abstract List<RitualComponent> getRitualComponentList();
}

View file

@ -0,0 +1,333 @@
package WayofTime.alchemicalWizardry.api.rituals;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import scala.reflect.internal.Trees.This;
import net.minecraft.block.Block;
import net.minecraft.world.World;
public class Rituals
{
private int crystalLevel;
private int actCost;
private RitualEffect effect;
private String name;
public static Map<String,Rituals> ritualMap = new HashMap();
@Deprecated
public static List<Rituals> ritualList = new LinkedList();
public static List<String> keyList = new LinkedList();
public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name)
{
this.crystalLevel = crystalLevel; //For a test commit
this.actCost = actCost;
this.effect = effect;
this.name = name;
keyList.add(name);
ritualMap.put(name, this);
}
/**
* Static method to register a ritual to the Ritual Registry
* @param key Unique identification key - must be different from all others to properly register
* @param crystalLevel Crystal level required to activate
* @param actCost LP amount required to activate
* @param effect The effect that will be ticked
* @param name The name of the ritual
* @return Returns true if properly registered, or false if the key is already used
*/
public static boolean registerRitual(String key, int crystalLevel, int actCost, RitualEffect effect, String name)
{
if(ritualMap.containsKey(key))
{
return false;
}
else
{
Rituals ritual = new Rituals(crystalLevel, actCost, effect, name);
ritual.removeRitualFromList();
ritualMap.put(key, ritual);
keyList.add(key);
return true;
}
}
public void removeRitualFromList()
{
if(ritualMap.containsValue(this))
{
ritualMap.remove(ritualMap.remove(this.name));
}
if(keyList.contains(this.name))
{
keyList.remove(this.name);
}
}
public static String checkValidRitual(World world, int x, int y, int z)
{
for(String key : ritualMap.keySet())
{
if(checkRitualIsValid(world,x,y,z,key))
{
return key;
}
}
return "";
}
public static boolean canCrystalActivate(String ritualID, int crystalLevel)
{
if(ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if(ritual != null)
{
return ritual.getCrystalLevel() <= crystalLevel;
}
}
return false;
}
public static boolean checkRitualIsValid(World world, int x, int y, int z, String ritualID)
{
int direction = Rituals.getDirectionOfRitual(world, x, y, z, ritualID);
if (direction != -1)
{
return true;
}
return false;
}
/**
* 1 - NORTH
* 2 - EAST
* 3 - SOUTH
* 4 - WEST
*/
public static boolean checkDirectionOfRitualValid(World world, int x, int y, int z, String ritualID, int direction)
{
List<RitualComponent> ritual = Rituals.getRitualList(ritualID);
if (ritual == null)
{
return false;
}
Block test = null;
switch (direction)
{
case 1:
for (RitualComponent rc : ritual)
{
test = world.getBlock(x + rc.getX(), y + rc.getY(), z + rc.getZ());
if (!(test instanceof IRitualStone))
{
return false;
}
if (world.getBlockMetadata(x + rc.getX(), y + rc.getY(), z + rc.getZ()) != rc.getStoneType())
{
return false;
}
}
return true;
case 2:
for (RitualComponent rc : ritual)
{
test = world.getBlock(x - rc.getZ(), y + rc.getY(), z + rc.getX());
if (!(test instanceof IRitualStone))
{
return false;
}
if (world.getBlockMetadata(x - rc.getZ(), y + rc.getY(), z + rc.getX()) != rc.getStoneType())
{
return false;
}
}
return true;
case 3:
for (RitualComponent rc : ritual)
{
test = world.getBlock(x - rc.getX(), y + rc.getY(), z - rc.getZ());
if (!(test instanceof IRitualStone))
{
return false;
}
if (world.getBlockMetadata(x - rc.getX(), y + rc.getY(), z - rc.getZ()) != rc.getStoneType())
{
return false;
}
}
return true;
case 4:
for (RitualComponent rc : ritual)
{
test = world.getBlock(x + rc.getZ(), y + rc.getY(), z - rc.getX());
if (!(test instanceof IRitualStone))
{
return false;
}
if (world.getBlockMetadata(x + rc.getZ(), y + rc.getY(), z - rc.getX()) != rc.getStoneType())
{
return false;
}
}
return true;
}
return false;
}
public static int getDirectionOfRitual(World world, int x, int y, int z, String ritualID)
{
for (int i = 1; i <= 4; i++)
{
if (Rituals.checkDirectionOfRitualValid(world, x, y, z, ritualID, i))
{
return i;
}
}
return -1;
}
public static int getCostForActivation(String ritualID)
{
if(ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if(ritual != null)
{
return ritual.actCost;
}
}
return 0;
}
public static int getInitialCooldown(String ritualID)
{
if(ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if(ritual != null && ritual.effect != null)
{
return ritual.effect.getInitialCooldown();
}
}
return 0;
}
public static List<RitualComponent> getRitualList(String ritualID)
{
if(ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if(ritual != null)
{
return ritual.obtainComponents();
}else
{
return null;
}
}else
{
return null;
}
}
private List<RitualComponent> obtainComponents()
{
return this.effect.getRitualComponentList();
}
private int getCrystalLevel()
{
return this.crystalLevel;
}
public static void performEffect(IMasterRitualStone ritualStone, String ritualID)
{
if(ritualMap.containsKey(ritualID))
{
Rituals ritual = ritualMap.get(ritualID);
if(ritual != null && ritual.effect != null)
{
ritual.effect.performEffect(ritualStone);
}
}
}
public static int getNumberOfRituals()
{
return ritualMap.size();
}
public String getRitualName()
{
return this.name;
}
public static String getNameOfRitual(String id)
{
if(ritualMap.containsKey(id))
{
Rituals ritual = ritualMap.get(id);
if(ritual != null)
{
return ritual.getRitualName();
}
}
return "";
}
public static String getNextRitualKey(String key)
{
boolean hasSpotted = false;
String firstKey = "";
for(String str : keyList)
{
if(firstKey.equals(""))
{
firstKey = str;
}
if(hasSpotted)
{
return str;
}
if(str.equals(key))
{
hasSpotted = true;
}
}
return firstKey;
}
}

View file

@ -0,0 +1,26 @@
package WayofTime.alchemicalWizardry.api.soulNetwork;
import net.minecraft.nbt.NBTTagCompound;
public class LifeEssenceNetwork extends net.minecraft.world.WorldSavedData
{
public int currentEssence;
public LifeEssenceNetwork(String par1Str)
{
super(par1Str);
currentEssence = 0;
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound)
{
currentEssence = nbttagcompound.getInteger("currentEssence");
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound)
{
nbttagcompound.setInteger("currentEssence", currentEssence);
}
}

View file

@ -0,0 +1,228 @@
package WayofTime.alchemicalWizardry.api.soulNetwork;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class SoulNetworkHandler
{
public static int syphonFromNetwork(ItemStack ist, int damageToBeDone)
{
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
{
String ownerName = ist.getTagCompound().getString("ownerName");
if (MinecraftServer.getServer() == null)
{
return 0;
}
World world = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
if (data == null)
{
data = new LifeEssenceNetwork(ownerName);
world.setItemData(ownerName, data);
}
if (data.currentEssence >= damageToBeDone)
{
data.currentEssence -= damageToBeDone;
data.markDirty();
return damageToBeDone;
}
}
return 0;
}
/**
* Master method used to syphon from the player's network, and will damage them accordingly if they do not have enough LP.
* Does not drain on the client side.
*
* @param ist Owned itemStack
* @param player Player using the item
* @param damageToBeDone
* @return True if server-sided, false if client-sided
*/
public static boolean syphonAndDamageFromNetwork(ItemStack ist, EntityPlayer player, int damageToBeDone)
{
if(player.worldObj.isRemote)
{
return false;
}
int amount = SoulNetworkHandler.syphonFromNetwork(ist, damageToBeDone);
hurtPlayer(player, damageToBeDone-amount);
return true;
}
public static boolean canSyphonFromOnlyNetwork(ItemStack ist, int damageToBeDone)
{
if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals("")))
{
String ownerName = ist.getTagCompound().getString("ownerName");
if (MinecraftServer.getServer() == null)
{
return false;
}
World world = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
if (data == null)
{
data = new LifeEssenceNetwork(ownerName);
world.setItemData(ownerName, data);
}
return data.currentEssence >= damageToBeDone;
}
return false;
}
public static int getCurrentEssence(String ownerName)
{
if (MinecraftServer.getServer() == null)
{
return 0;
}
World world = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
if (data == null)
{
data = new LifeEssenceNetwork(ownerName);
world.setItemData(ownerName, data);
}
return data.currentEssence;
}
public static void setCurrentEssence(String ownerName, int essence)
{
if (MinecraftServer.getServer() == null)
{
return;
}
World world = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
if (data == null)
{
data = new LifeEssenceNetwork(ownerName);
world.setItemData(ownerName, data);
}
data.currentEssence = essence;
data.markDirty();
}
/**
* A method to add to an owner's network up to a maximum value.
*
* @param ownerName
* @param addedEssence
* @param maximum
* @return amount added to the network
*/
public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum)
{
if (MinecraftServer.getServer() == null)
{
return 0;
}
World world = MinecraftServer.getServer().worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
if (data == null)
{
data = new LifeEssenceNetwork(ownerName);
world.setItemData(ownerName, data);
}
int currEss = data.currentEssence;
if(currEss>=maximum)
{
return 0;
}
int newEss = Math.min(maximum, currEss+addedEssence);
data.currentEssence = newEss;
return newEss-currEss;
}
public static void hurtPlayer(EntityPlayer user, int energySyphoned)
{
if (energySyphoned < 100 && energySyphoned > 0)
{
if (!user.capabilities.isCreativeMode)
{
user.setHealth((user.getHealth() - 1));
if (user.getHealth() <= 0.0005f)
{
user.onDeath(DamageSource.generic);
}
}
} else if (energySyphoned >= 100)
{
if (!user.capabilities.isCreativeMode)
{
for (int i = 0; i < ((energySyphoned + 99) / 100); i++)
{
user.setHealth((user.getHealth() - 1));
if (user.getHealth() <= 0.0005f)
{
user.onDeath(DamageSource.generic);
break;
}
}
}
}
}
public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player)
{
if (item.stackTagCompound == null)
{
item.setTagCompound(new NBTTagCompound());
}
if (item.stackTagCompound.getString("ownerName").equals(""))
{
item.stackTagCompound.setString("ownerName", SoulNetworkHandler.getUsername(player));
}
}
public static void checkAndSetItemOwner(ItemStack item, String ownerName)
{
if (item.stackTagCompound == null)
{
item.setTagCompound(new NBTTagCompound());
}
if (item.stackTagCompound.getString("ownerName").equals(""))
{
item.stackTagCompound.setString("ownerName", ownerName);
}
}
public static String getUsername(EntityPlayer player)
{
return player.getDisplayName();
}
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.api.summoningRegistry;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.World;
public abstract class SummoningHelper
{
protected int id;
public SummoningHelper(int id)
{
this.id = id;
}
public abstract EntityLivingBase getEntity(World worldObj);
public int getSummoningHelperID()
{
return id;
}
}

View file

@ -0,0 +1,70 @@
package WayofTime.alchemicalWizardry.api.summoningRegistry;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class SummoningRegistry
{
public static List<SummoningRegistryComponent> summoningList = new ArrayList();
public static void registerSummon(SummoningHelper s, ItemStack[] ring1, ItemStack[] ring2, ItemStack[] ring3, int amountUsed, int bloodOrbLevel)
{
summoningList.add(new SummoningRegistryComponent(s, ring1, ring2, ring3, amountUsed, bloodOrbLevel));
}
public static boolean isRecipeValid(int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3)
{
for (SummoningRegistryComponent src : summoningList)
{
if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3))
{
return true;
}
}
return false;
}
public static SummoningRegistryComponent getRegistryComponent(int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3)
{
for (SummoningRegistryComponent src : summoningList)
{
if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3))
{
return src;
}
}
return null;
}
public static EntityLivingBase getEntity(World worldObj, int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3)
{
for (SummoningRegistryComponent src : summoningList)
{
if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3))
{
return src.getEntity(worldObj);
}
}
return null;
}
public static EntityLivingBase getEntityWithID(World worldObj, int id)
{
for (SummoningRegistryComponent src : summoningList)
{
if (src.getSummoningHelperID() == id)
{
return src.getEntity(worldObj);
}
}
return null;
}
}

View file

@ -0,0 +1,231 @@
package WayofTime.alchemicalWizardry.api.summoningRegistry;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
public class SummoningRegistryComponent
{
public ItemStack[] ring1 = new ItemStack[6];
public ItemStack[] ring2 = new ItemStack[6];
public ItemStack[] ring3 = new ItemStack[6];
public SummoningHelper summoningHelper;
public int summoningCost;
public int bloodOrbLevel;
public SummoningRegistryComponent(SummoningHelper s, ItemStack[] newRing1, ItemStack[] newRing2, ItemStack[] newRing3, int amount, int bloodOrbLevel)
{
this.summoningHelper = s;
this.ring1 = newRing1;
this.ring2 = newRing2;
this.ring3 = newRing3;
this.summoningCost = amount;
this.bloodOrbLevel = bloodOrbLevel;
if (this.ring1.length != 6)
{
ItemStack[] newRecipe = new ItemStack[6];
for (int i = 0; i < 6; i++)
{
if (i + 1 > this.ring1.length)
{
newRecipe[i] = null;
} else
{
newRecipe[i] = this.ring1[i];
}
}
this.ring1 = newRecipe;
}
if (this.ring2.length != 6)
{
ItemStack[] newRecipe = new ItemStack[6];
for (int i = 0; i < 6; i++)
{
if (i + 1 > this.ring2.length)
{
newRecipe[i] = null;
} else
{
newRecipe[i] = this.ring2[i];
}
}
this.ring2 = newRecipe;
}
if (this.ring3.length != 6)
{
ItemStack[] newRecipe = new ItemStack[6];
for (int i = 0; i < 6; i++)
{
if (i + 1 > this.ring3.length)
{
newRecipe[i] = null;
} else
{
newRecipe[i] = this.ring3[i];
}
}
this.ring3 = newRecipe;
}
}
public boolean compareRing(int ring, ItemStack[] checkedRingRecipe)
{
ItemStack[] recipe;
if (checkedRingRecipe.length < 6)
{
return false;
}
switch (ring)
{
case 1:
recipe = ring1;
break;
case 2:
recipe = ring2;
break;
case 3:
recipe = ring3;
break;
default:
recipe = ring1;
}
if (recipe.length != 6)
{
ItemStack[] newRecipe = new ItemStack[6];
for (int i = 0; i < 6; i++)
{
if (i + 1 > recipe.length)
{
newRecipe[i] = null;
} else
{
newRecipe[i] = recipe[i];
}
}
recipe = newRecipe;
}
boolean[] checkList = new boolean[6];
for (int i = 0; i < 6; i++)
{
checkList[i] = false;
}
for (int i = 0; i < 6; i++)
{
ItemStack recipeItemStack = recipe[i];
if (recipeItemStack == null)
{
continue;
}
boolean test = false;
for (int j = 0; j < 6; j++)
{
if (checkList[j])
{
continue;
}
ItemStack checkedItemStack = checkedRingRecipe[j];
if (checkedItemStack == null)
{
continue;
}
boolean quickTest = false;
if (recipeItemStack.getItem() instanceof ItemBlock)
{
if (checkedItemStack.getItem() instanceof ItemBlock)
{
quickTest = true;
}
} else if (!(checkedItemStack.getItem() instanceof ItemBlock))
{
quickTest = true;
}
if (!quickTest)
{
continue;
}
if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) && checkedItemStack.getItem() == recipeItemStack.getItem())
{
test = true;
checkList[j] = true;
break;
}
}
if (!test)
{
return false;
}
}
return true;
}
public int getSummoningCost()
{
return summoningCost;
}
public EntityLivingBase getEntity(World world)
{
return this.summoningHelper.getEntity(world);
}
public int getBloodOrbLevel()
{
return this.bloodOrbLevel;
}
public ItemStack[] getRingRecipeForRing(int ring)
{
switch (ring)
{
case 1:
return ring1;
case 2:
return ring2;
case 3:
return ring3;
default:
return null;
}
}
public int getSummoningHelperID()
{
return this.summoningHelper.getSummoningHelperID();
}
}

View file

@ -0,0 +1,26 @@
package WayofTime.alchemicalWizardry.api.tile;
/**
* Created by Pokefenn.
*/
public interface IBloodAltar
{
public int getCapacity();
public int getCurrentBlood();
public int getTier();
public int getProgress();
public float getSacrificeMultiplier();
public float getSelfSacrificeMultiplier();
public float getOrbMultiplier();
public float getDislocationMultiplier();
public int getBufferCapacity();
}

View file

@ -0,0 +1,150 @@
package WayofTime.alchemicalWizardry.client;
import net.minecraft.item.ItemBlock;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.CommonProxy;
import WayofTime.alchemicalWizardry.common.EntityAirElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBileDemon;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBoulderFist;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityEarthElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityFallenAngel;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityFireElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityHolyElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityIceDemon;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityLowerGuardian;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityShade;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityShadeElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntitySmallEarthGolem;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWaterElemental;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityWingedFireDemon;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaMainProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityMeteor;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderConduit;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderPedestal;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderPlinth;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellEffectBlock;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellEnhancementBlock;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellModifierBlock;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderSpellParadigmBlock;
import WayofTime.alchemicalWizardry.common.renderer.block.RenderWritingTable;
import WayofTime.alchemicalWizardry.common.renderer.block.TEAltarRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEAltarItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TEConduitItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TESpellEffectBlockItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TESpellEnhancementBlockItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TESpellModifierBlockItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.block.itemRender.TESpellParadigmBlockItemRenderer;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderBileDemon;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderBoulderFist;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderElemental;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderFallenAngel;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderIceDemon;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderLowerGuardian;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderShade;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderSmallEarthGolem;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderWingedFireDemon;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelBileDemon;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelBoulderFist;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelElemental;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelFallenAngel;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelIceDemon;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelLowerGuardian;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelShade;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelSmallEarthGolem;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelWingedFireDemon;
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBazookaMainProjectile;
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBlastProjectile;
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderMeteor;
import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class ClientProxy extends CommonProxy
{
public static int renderPass;
public static int altarRenderType;
@Override
public void registerRenderers()
{
//altarRenderType = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerEntityRenderingHandler(EnergyBlastProjectile.class, new RenderEnergyBlastProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntityEnergyBazookaMainProjectile.class, new RenderEnergyBazookaMainProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntitySpellProjectile.class, new RenderEnergyBlastProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntityMeteor.class, new RenderMeteor());
//EntityRegistry.registerGlobalEntityID(EntityFallenAngel.class, "AlchemicalWizardry.FallenAngel", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityFallenAngel.class, new RenderFallenAngel(new ModelFallenAngel(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityLowerGuardian.class, "AlchemicalWizardry.LowerGuardian", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityLowerGuardian.class, new RenderLowerGuardian(new ModelLowerGuardian(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityBileDemon.class, "AlchemicalWizardry.BileDemon", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityBileDemon.class, new RenderBileDemon(new ModelBileDemon(), 1.5F));
//EntityRegistry.registerGlobalEntityID(EntityWingedFireDemon.class, "AlchemicalWizardry.WingedFireDemon", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityWingedFireDemon.class, new RenderWingedFireDemon(new ModelWingedFireDemon(), 1.0F));
//EntityRegistry.registerGlobalEntityID(EntitySmallEarthGolem.class, "AlchemicalWizardry.SmallEarthGolem", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntitySmallEarthGolem.class, new RenderSmallEarthGolem(new ModelSmallEarthGolem(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityIceDemon.class, "AlchemicalWizardry.IceDemon", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityIceDemon.class, new RenderIceDemon(new ModelIceDemon(), 0.5F));
// EntityRegistry.registerGlobalEntityID(EntityBoulderFist.class, "AlchemicalWizardry.BoulderFist", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityBoulderFist.class, new RenderBoulderFist(new ModelBoulderFist(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityShade.class, "AlchemicalWizardry.Shade", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityShade.class, new RenderShade(new ModelShade(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityAirElemental.class, "AlchemicalWizardry.AirElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityAirElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityWaterElemental.class, "AlchemicalWizardry.WaterElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityWaterElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityEarthElemental.class, "AlchemicalWizardry.EarthElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityEarthElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityFireElemental.class, "AlchemicalWizardry.FireElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityFireElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityShadeElemental.class, "AlchemicalWizardry.ShadeElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityShadeElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
//EntityRegistry.registerGlobalEntityID(EntityHolyElemental.class, "AlchemicalWizardry.HolyElemental", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityHolyElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
ClientRegistry.bindTileEntitySpecialRenderer(TEAltar.class, new TEAltarRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TEPedestal.class, new RenderPedestal());
ClientRegistry.bindTileEntitySpecialRenderer(TEPlinth.class, new RenderPlinth());
ClientRegistry.bindTileEntitySpecialRenderer(TEWritingTable.class, new RenderWritingTable());
ClientRegistry.bindTileEntitySpecialRenderer(TEConduit.class, new RenderConduit());
ClientRegistry.bindTileEntitySpecialRenderer(TESpellEffectBlock.class, new RenderSpellEffectBlock());
ClientRegistry.bindTileEntitySpecialRenderer(TESpellEnhancementBlock.class, new RenderSpellEnhancementBlock());
ClientRegistry.bindTileEntitySpecialRenderer(TESpellParadigmBlock.class, new RenderSpellParadigmBlock());
ClientRegistry.bindTileEntitySpecialRenderer(TESpellModifierBlock.class, new RenderSpellModifierBlock());
//Item Renderer stuff
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockConduit), new TEConduitItemRenderer());
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellEffect), new TESpellEffectBlockItemRenderer());
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellEnhancement), new TESpellEnhancementBlockItemRenderer());
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellParadigm), new TESpellParadigmBlockItemRenderer());
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockSpellModifier), new TESpellModifierBlockItemRenderer());
//RenderingRegistry.registerEntityRenderingHandler(FireProjectile.class, new RenderFireProjectile());
//RenderingRegistry.registerBlockHandler(new AltarRenderer());
}
@Override
public World getClientWorld()
{
return FMLClientHandler.instance().getClient().theWorld;
}
@Override
public void InitRendering()
{
MinecraftForgeClient.registerItemRenderer(ItemBlock.getItemFromBlock(ModBlocks.blockAltar), new TEAltarItemRenderer());
//MinecraftForgeClient.registerItemRenderer(AlchemicalWizardry.blockWritingTable.blockID, new TEWritingTableItemRenderer());
}
}

View file

@ -0,0 +1,341 @@
package WayofTime.alchemicalWizardry.common;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerCapabilities;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.potion.Potion;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Vec3;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Type;
import cpw.mods.fml.relauncher.ReflectionHelper;
public class AlchemicalWizardryEventHooks
{
public static Map<String,Boolean> playerFlightBuff = new HashMap();
public static Map<String,Boolean> playerBoostStepHeight = new HashMap();
public static List<String> playersWith1Step = new ArrayList();
@SubscribeEvent
public void onLivingJumpEvent(LivingJumpEvent event)
{
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionBoost))
{
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier();
event.entityLiving.motionY += (0.1f) * (2 + i);
}
if(event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart))
{
event.entityLiving.motionY = 0;
}
}
@SubscribeEvent
public void onEndermanTeleportEvent(EnderTeleportEvent event)
{
if(event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionPlanarBinding) && event.isCancelable())
{
event.setCanceled(true);
}
}
@SubscribeEvent
public void onEntityDamaged(LivingAttackEvent event)
{
EntityLivingBase entityAttacked = event.entityLiving;
if (entityAttacked.isPotionActive(AlchemicalWizardry.customPotionReciprocation))
{
Entity entityAttacking = event.source.getSourceOfDamage();
if (entityAttacking != null && entityAttacking instanceof EntityLivingBase)
{
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionReciprocation).getAmplifier();
float damageRecieve = event.ammount / 2 * (i + 1);
((EntityLivingBase) entityAttacking).attackEntityFrom(DamageSource.generic, damageRecieve);
}
}
if(entityAttacked.isPotionActive(AlchemicalWizardry.customPotionFlameCloak))
{
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier();
Entity entityAttacking = event.source.getSourceOfDamage();
if(entityAttacking != null && entityAttacking instanceof EntityLivingBase && !entityAttacking.isImmuneToFire() && !((EntityLivingBase)entityAttacking).isPotionActive(Potion.fireResistance))
{
entityAttacking.attackEntityFrom(DamageSource.inFire, 2*i+2);
entityAttacking.setFire(3);
}
}
}
// @ForgeSubscribe
// public void onFOVUpdate(FOVUpdateEvent event)
// {
// event.setResult(Result.DEFAULT);
// }
// @SubscribeEvent
// public void onPlayerTickEnd(PlayerTickEvent event)
// {
// if(event.type.equals(Type.PLAYER) && event.phase.equals(TickEvent.Phase.END))
// {
// ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, event.player.capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"});
// }
// }
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event)
{
EntityLivingBase entityLiving = event.entityLiving;
double x = entityLiving.posX;
double y = entityLiving.posY;
double z = entityLiving.posZ;
Vec3 blockVector = SpellHelper.getEntityBlockVector(entityLiving);
int xPos = (int)(blockVector.xCoord);
int yPos = (int)(blockVector.yCoord);
int zPos = (int)(blockVector.zCoord);
if(entityLiving instanceof EntityPlayer)
{
ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, ((EntityPlayer)event.entityLiving).capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"});
}
if (entityLiving instanceof EntityPlayer && entityLiving.worldObj.isRemote)
{
EntityPlayer entityPlayer = (EntityPlayer) entityLiving;
boolean highStepListed = playersWith1Step.contains(entityPlayer.getDisplayName());
boolean hasHighStep = entityPlayer.isPotionActive(AlchemicalWizardry.customPotionBoost);
if (hasHighStep && !highStepListed)
{
playersWith1Step.add(SpellHelper.getUsername(entityPlayer));
}
if (!hasHighStep && highStepListed)
{
playersWith1Step.remove(SpellHelper.getUsername(entityPlayer));
entityPlayer.stepHeight = 0.5F;
}
}
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionDrowning))
{
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionDrowning).getAmplifier();
if (event.entityLiving.worldObj.getWorldTime() % ((int) (20 / (i + 1))) == 0)
{
event.entityLiving.attackEntityFrom(DamageSource.drown, 2);
event.entityLiving.hurtResistantTime = Math.min(event.entityLiving.hurtResistantTime, 20 / (i + 1));
}
}
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionBoost))
{
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier();
EntityLivingBase entity = event.entityLiving;
//if(!entity.isSneaking())
{
float percentIncrease = (i + 1) * 0.05f;
if (event.entityLiving instanceof EntityPlayer)
{
EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving;
entityPlayer.stepHeight = 1.0f;
if((entityPlayer.onGround || entityPlayer.capabilities.isFlying) && entityPlayer.moveForward > 0F)
entityPlayer.moveFlying(0F, 1F, entityPlayer.capabilities.isFlying ? (percentIncrease/2.0f) : percentIncrease);
}
}
}
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionProjProt))
{
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionProjProt).getAmplifier();
EntityLivingBase entity = event.entityLiving;
int posX = (int) Math.round(entity.posX - 0.5f);
int posY = (int) Math.round(entity.posY);
int posZ = (int) Math.round(entity.posZ - 0.5f);
int d0 = i;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5).expand(d0, d0, d0);
List list = event.entityLiving.worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityLivingBase livingEntity;
while (iterator.hasNext())
{
Entity projectile = (Entity) iterator.next();
if (projectile == null)
{
continue;
}
if (!(projectile instanceof IProjectile))
{
continue;
}
if (projectile instanceof EntityArrow)
{
if (((EntityArrow) projectile).shootingEntity == null)
{
} else if (!(((EntityArrow) projectile).shootingEntity == null) && ((EntityArrow) projectile).shootingEntity.equals(entity))
{
break;
}
} else if (projectile instanceof EnergyBlastProjectile)
{
if (!(((EnergyBlastProjectile) projectile).shootingEntity == null) && ((EnergyBlastProjectile) projectile).shootingEntity.equals(entity))
{
break;
}
}
double delX = projectile.posX - entity.posX;
double delY = projectile.posY - entity.posY;
double delZ = projectile.posZ - entity.posZ;
double curVel = Math.sqrt(delX * delX + delY * delY + delZ * delZ);
//NOTE: It appears that it constantly reverses the direction.
//Any way to do it only once? Or find the shooting entity?
delX /= curVel;
delY /= curVel;
delZ /= curVel;
double newVel = Math.sqrt(projectile.motionX * projectile.motionX + projectile.motionY * projectile.motionY + projectile.motionZ * projectile.motionZ);
projectile.motionX = newVel * delX;
projectile.motionY = newVel * delY;
projectile.motionZ = newVel * delZ;
//TODO make this not affect player's projectiles
}
}
if (event.entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlight))
{
if (event.entityLiving instanceof EntityPlayer)
{
EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving;
String ownerName = SpellHelper.getUsername(entityPlayer);
playerFlightBuff.put(ownerName, true);
entityPlayer.capabilities.allowFlying = true;
//entityPlayer.sendPlayerAbilities();
}
} else
{
if (event.entityLiving instanceof EntityPlayer)
{
EntityPlayer entityPlayer = (EntityPlayer) event.entityLiving;
String ownerName = SpellHelper.getUsername(entityPlayer);
if (!playerFlightBuff.containsKey(ownerName))
{
playerFlightBuff.put(ownerName, false);
}
if (playerFlightBuff.get(ownerName))
{
playerFlightBuff.put(ownerName, false);
if (!entityPlayer.capabilities.isCreativeMode)
{
entityPlayer.capabilities.allowFlying = false;
entityPlayer.capabilities.isFlying = false;
entityPlayer.sendPlayerAbilities();
}
}
}
}
if(entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlameCloak))
{
entityLiving.worldObj.spawnParticle("flame", x+SpellHelper.gaussian(1),y-1.3+SpellHelper.gaussian(0.3),z+SpellHelper.gaussian(1), 0, 0.06d, 0);
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier();
double range = i*0.5;
List<Entity> entities = SpellHelper.getEntitiesInRange(entityLiving.worldObj, x, y, z, range, range);
if(entities!=null)
{
for(Entity entity : entities)
{
if(!entity.equals(entityLiving)&&!entity.isImmuneToFire()&&!(entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.fireResistance)))
{
entity.setFire(3);
}
}
}
}
if(entityLiving.isPotionActive(AlchemicalWizardry.customPotionIceCloak))
{
if(entityLiving.worldObj.getWorldTime()%2==0)
entityLiving.worldObj.spawnParticle("reddust", x+SpellHelper.gaussian(1),y-1.3+SpellHelper.gaussian(0.3),z+SpellHelper.gaussian(1), 0x74,0xbb,0xfb);
int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionIceCloak).getAmplifier();
int horizRange = r+1;
int vertRange = 1;
if(!entityLiving.worldObj.isRemote)
{
for(int i=-horizRange; i<=horizRange;i++)
{
for(int k=-horizRange; k<=horizRange;k++)
{
for(int j=-vertRange-1; j<=vertRange-1; j++)
{
SpellHelper.freezeWaterBlock(entityLiving.worldObj, xPos+i, yPos+j, zPos+k);
}
}
}
}
}
if(entityLiving.isPotionActive(AlchemicalWizardry.customPotionHeavyHeart))
{
entityLiving.worldObj.spawnParticle("flame", x+SpellHelper.gaussian(1),y-1.3+SpellHelper.gaussian(0.3),z+SpellHelper.gaussian(1), 0, 0.06d, 0);
int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionHeavyHeart).getAmplifier();
double decrease = 0.025*(i+1);
if(entityLiving.motionY>-0.9)
{
entityLiving.motionY-=decrease;
}
}
if(entityLiving.isPotionActive(AlchemicalWizardry.customPotionFireFuse))
{
entityLiving.worldObj.spawnParticle("flame", x+SpellHelper.gaussian(1),y-1.3+SpellHelper.gaussian(0.3),z+SpellHelper.gaussian(1), 0, 0.06d, 0);
int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getAmplifier();
int radius = r+1;
if(entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getDuration()<=2)
{
entityLiving.worldObj.createExplosion(null, x, y, z, radius, false);
}
}
}
}

View file

@ -0,0 +1,72 @@
package WayofTime.alchemicalWizardry.common;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.items.LavaCrystal;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.common.IFuelHandler;
public class AlchemicalWizardryFuelHandler implements IFuelHandler
{
@Override
public int getBurnTime(ItemStack fuel)
{
ItemStack itemStack = fuel;
if(itemStack == null)
{
return 0;
}
Item fuelItem = itemStack.getItem();
if (fuelItem.equals(ModItems.lavaCrystal))
{
/*ItemStack newItem = new ItemStack(AlchemicalWizardry.lavaCrystal);
newItem.getItem().setDamage(newItem, 50);
fuel.getItem().setContainerItem(((LavaCrystal)newItem.getItem()).change());
*/
LavaCrystal item = (LavaCrystal) fuel.getItem();
if (item.hasEnoughEssence(fuel))
{
return 200;
} else
{
NBTTagCompound tag = itemStack.stackTagCompound;
if (tag == null)
{
return 0;
}
if (MinecraftServer.getServer() == null)
{
return 0;
}
if (MinecraftServer.getServer().getConfigurationManager() == null)
{
return 0;
}
EntityPlayer owner = SpellHelper.getPlayerForUsername(tag.getString("ownerName"));
if (owner == null)
{
return 0;
}
owner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
return 0;
}
}
return 0;
}
}

View file

@ -0,0 +1,47 @@
package WayofTime.alchemicalWizardry.common;
import java.util.EnumSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerCapabilities;
import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
@Deprecated
public class AlchemicalWizardryTickHandler //implements ITickHandler
{
// public void tickStart(EnumSet<TickType> type, Object... tickData)
// {
// }
//
// public EnumSet<TickType> ticks()
// {
// return EnumSet.of(TickType.PLAYER);
// }
//
// public String getLabel()
// {
// return "BloodMagic";
// }
//
// public void tickEnd(EnumSet<TickType> type, Object... tickData)
// {
// String[] usernames = MinecraftServer.getServer().getAllUsernames();
//
// if (usernames == null)
// {
// return;
// }
//
// for (String userName : usernames)
// {
// EntityPlayer entityPlayer = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(userName);
//
// if (entityPlayer != null)
// {
// ObfuscationReflectionHelper.setPrivateValue(PlayerCapabilities.class, entityPlayer.capabilities, Float.valueOf(0.1f), new String[]{"walkSpeed", "g", "field_75097_g"});
// //entityPlayer.sendPlayerAbilities();
// }
// }
// }
}

View file

@ -0,0 +1,23 @@
package WayofTime.alchemicalWizardry.common;
public class ArmourComponent
{
private int xOff;
private int zOff;
public ArmourComponent(int xOff, int zOff)
{
this.xOff = xOff;
this.zOff = zOff;
}
public int getXOff()
{
return xOff;
}
public int getZOff()
{
return zOff;
}
}

View file

@ -0,0 +1,91 @@
package WayofTime.alchemicalWizardry.common;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityBloodLightProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaMainProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaSecondaryProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.EntityMeteor;
import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.LightningBoltProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.MudProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.TeleportProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.WaterProjectile;
import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
public class CommonProxy
{
public static String ITEMS_PNG = "/WayofTime/alchemicalWizardry/items.png";
public static String BLOCK_PNG = "/WayofTime/alchemicalWizardry/block.png";
// Client stuff
public void registerRenderers()
{
// Nothing here as the server doesn't render graphics!
}
public void registerEntities()
{
}
public World getClientWorld()
{
return null;
}
public void registerActions()
{
}
public void registerEvents()
{
}
public void registerSoundHandler()
{
// Nothing here as this is a server side proxy
}
public void registerTileEntities()
{
GameRegistry.registerTileEntity(TEAltar.class, "containerAltar");
GameRegistry.registerTileEntity(TEMasterStone.class, "containerMasterStone");
}
public void registerEntityTrackers()
{
EntityRegistry.registerModEntity(EnergyBlastProjectile.class, "energyBlastProjectile", 0, AlchemicalWizardry.instance, 128, 5, true);
EntityRegistry.registerModEntity(FireProjectile.class, "fireProjectile", 1, AlchemicalWizardry.instance, 128, 5, true);
EntityRegistry.registerModEntity(IceProjectile.class, "iceProjectile", 2, AlchemicalWizardry.instance, 128, 5, true);
EntityRegistry.registerModEntity(ExplosionProjectile.class, "explosionProjectile", 3, AlchemicalWizardry.instance, 128, 5, true);
EntityRegistry.registerModEntity(HolyProjectile.class, "holyProjectile", 4, AlchemicalWizardry.instance, 128, 5, true);
EntityRegistry.registerModEntity(WindGustProjectile.class, "windGustProjectile", 5, AlchemicalWizardry.instance, 128, 5, true);
EntityRegistry.registerModEntity(LightningBoltProjectile.class, "lightningBoltProjectile", 6, AlchemicalWizardry.instance, 128, 5, true);
EntityRegistry.registerModEntity(WaterProjectile.class, "waterProjectile", 7, AlchemicalWizardry.instance, 128, 5, true);
EntityRegistry.registerModEntity(MudProjectile.class, "mudProjectile", 8, AlchemicalWizardry.instance, 128, 5, true);
EntityRegistry.registerModEntity(TeleportProjectile.class, "teleportProjectile", 9, AlchemicalWizardry.instance, 128, 5, true);
EntityRegistry.registerModEntity(EntityEnergyBazookaMainProjectile.class, "energyBazookaMain", 10, AlchemicalWizardry.instance, 128, 3, true);
EntityRegistry.registerModEntity(EntityEnergyBazookaSecondaryProjectile.class, "energyBazookaSecondary", 11, AlchemicalWizardry.instance, 128, 3, true);
EntityRegistry.registerModEntity(EntityBloodLightProjectile.class, "bloodLightProjectile", 12, AlchemicalWizardry.instance, 128, 3, true);
EntityRegistry.registerModEntity(EntityMeteor.class, "meteor", 13, AlchemicalWizardry.instance, 120, 3, true);
EntityRegistry.registerModEntity(EntitySpellProjectile.class, "spellProjectile", 14, AlchemicalWizardry.instance, 128, 3, true);
}
public void registerTickHandlers()
{
}
public void InitRendering()
{
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,5 @@
package WayofTime.alchemicalWizardry.common;
public class EntityAIFly
{
}

View file

@ -0,0 +1,24 @@
package WayofTime.alchemicalWizardry.common;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
public class EntityAITargetAggro extends EntityAINearestAttackableTarget
{
private EntityDemon theCreature;
public EntityAITargetAggro(EntityDemon par1EntityDemon, Class par2Class, int par3, boolean par4)
{
super(par1EntityDemon, par2Class, par3, par4);
this.theCreature = par1EntityDemon;
}
/**
* Returns whether the EntityAIBase should begin execution.
*/
@Override
public boolean shouldExecute()
{
return theCreature.isAggro() && super.shouldExecute();
}
}

View file

@ -0,0 +1,33 @@
package WayofTime.alchemicalWizardry.common;
import ibxm.Player;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityElemental;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class EntityAirElemental extends EntityElemental implements IMob
{
public EntityAirElemental(World world)
{
super(world, AlchemicalWizardry.entityAirElementalID);
}
public void inflictEffectOnEntity(Entity target)
{
if (target instanceof EntityPlayer)
{
SpellHelper.setPlayerSpeedFromServer((EntityPlayer)target, target.motionX, target.motionY + 3, target.motionZ);
((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
} else if (target instanceof EntityLivingBase)
{
((EntityLivingBase) target).motionY += 3.0D;
((EntityLivingBase) target).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionInhibit.id, 150, 0));
}
}
}

View file

@ -0,0 +1,6 @@
package WayofTime.alchemicalWizardry.common;
public interface IBindingAgent
{
public abstract float getSuccessRateForPotionNumber(int potionEffects);
}

View file

@ -0,0 +1,8 @@
package WayofTime.alchemicalWizardry.common;
public interface ICatalyst
{
public abstract int getCatalystLevel();
public abstract boolean isConcentration();
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common;
public interface IDemon
{
public abstract void setSummonedConditions();
public boolean isAggro();
public void setAggro(boolean aggro);
}

View file

@ -0,0 +1,6 @@
package WayofTime.alchemicalWizardry.common;
public interface IFillingAgent
{
public abstract int getFilledAmountForPotionNumber(int potionEffects);
}

View file

@ -0,0 +1,16 @@
package WayofTime.alchemicalWizardry.common;
public class Int3
{
public int xCoord;
public int yCoord;
public int zCoord;
public Int3(int xCoord, int yCoord, int zCoord)
{
this.xCoord = xCoord;
this.yCoord = yCoord;
this.zCoord = zCoord;
}
}

View file

@ -0,0 +1,42 @@
package WayofTime.alchemicalWizardry.common;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.FillBucketEvent;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.ModItems;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class LifeBucketHandler
{
@SubscribeEvent
public void onBucketFill(FillBucketEvent event)
{
ItemStack result = fillCustomBucket(event.world, event.target);
if (result == null)
{
return;
}
event.result = result;
event.setResult(Result.ALLOW);
}
public ItemStack fillCustomBucket(World world, MovingObjectPosition pos)
{
Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
if (block!=null && (block.equals(ModBlocks.blockLifeEssence)) && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0)
{
world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
return new ItemStack(ModItems.bucketLife);
} else
{
return null;
}
}
}

View file

@ -0,0 +1,28 @@
package WayofTime.alchemicalWizardry.common;
import net.minecraftforge.fluids.Fluid;
public class LifeEssence extends Fluid
{
public LifeEssence(String fluidName)
{
super(fluidName);
//setUnlocalizedName("lifeEssence");
//setBlockID(id);
this.setDensity(2000);
this.setViscosity(2000);
//this.setFlowingIcon(flowingIcon)
}
@Override
public int getColor()
{
return 0xEEEEEE;
}
@Override
public String getLocalizedName()
{
return "Life Essence";
}
}

View file

@ -0,0 +1,36 @@
package WayofTime.alchemicalWizardry.common;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import WayofTime.alchemicalWizardry.ModItems;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class ModLivingDropsEvent
{
public static double rand;
@SubscribeEvent
public void onEntityDrop(LivingDropsEvent event)
{
if (event.source.getDamageType().equals("player"))
{
rand = Math.random();
if (!(event.entityLiving instanceof EntityAnimal))
{
PotionEffect effect = event.entityLiving.getActivePotionEffect(Potion.weakness);
if (effect != null)
{
if (effect.getAmplifier() >= 2)
if (rand < 0.50d)
{
event.entityLiving.dropItem(ModItems.weakBloodShard, 1);
}
}
}
}
}
}

View file

@ -0,0 +1,809 @@
package WayofTime.alchemicalWizardry.common;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import java.util.EnumMap;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
import cpw.mods.fml.common.network.FMLOutboundHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Handles the packet wrangling for IronChest
* @author cpw
*
*/
public enum NewPacketHandler
{
INSTANCE;
/**
* Our channel "pair" from {@link NetworkRegistry}
*/
private EnumMap<Side, FMLEmbeddedChannel> channels;
/**
* Make our packet handler, and add an {@link IronChestCodec} always
*/
private NewPacketHandler()
{
// request a channel pair for IronChest from the network registry
// Add the IronChestCodec as a member of both channel pipelines
this.channels = NetworkRegistry.INSTANCE.newChannel("BloodMagic", new TEAltarCodec());
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
{
addClientHandler();
}
}
/**
* This is only called on the client side - it adds an
* {@link IronChestMessageHandler} to the client side pipeline, since the
* only place we expect to <em>handle</em> messages is on the client.
*/
@SideOnly(Side.CLIENT)
private void addClientHandler()
{
FMLEmbeddedChannel clientChannel = this.channels.get(Side.CLIENT);
String tileAltarCodec = clientChannel.findChannelHandlerNameForType(TEAltarCodec.class);
clientChannel.pipeline().addAfter(tileAltarCodec, "TEAltarHandler", new TEAltarMessageHandler());
clientChannel.pipeline().addAfter(tileAltarCodec, "TEOrientableHandler", new TEOrientableMessageHandler());
clientChannel.pipeline().addAfter(tileAltarCodec, "TEPedestalHandler", new TEPedestalMessageHandler());
clientChannel.pipeline().addAfter(tileAltarCodec, "TEPlinthHandler", new TEPlinthMessageHandler());
clientChannel.pipeline().addAfter(tileAltarCodec, "TESocketHandler", new TESocketMessageHandler());
clientChannel.pipeline().addAfter(tileAltarCodec, "TETeleposerHandler", new TETeleposerMessageHandler());
clientChannel.pipeline().addAfter(tileAltarCodec, "TEWritingTableHandler", new TEWritingTableMessageHandler());
clientChannel.pipeline().addAfter(tileAltarCodec, "ParticleHandler", new ParticleMessageHandler());
clientChannel.pipeline().addAfter(tileAltarCodec, "VelocityHandler", new VelocityMessageHandler());
}
/**
* This class simply handles the {@link IronChestMessage} when it's received
* at the client side It can contain client only code, because it's only run
* on the client.
*
* @author cpw
*
*/
private static class TEAltarMessageHandler extends SimpleChannelInboundHandler<TEAltarMessage>
{
@Override
protected void channelRead0(ChannelHandlerContext ctx, TEAltarMessage msg) throws Exception
{
World world = AlchemicalWizardry.proxy.getClientWorld();
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
if (te instanceof TEAltar)
{
TEAltar altar = (TEAltar) te;
altar.handlePacketData(msg.items, msg.fluids, msg.capacity);
}
}
}
private static class TEOrientableMessageHandler extends SimpleChannelInboundHandler<TEOrientableMessage>
{
@Override
protected void channelRead0(ChannelHandlerContext ctx, TEOrientableMessage msg) throws Exception
{
World world = AlchemicalWizardry.proxy.getClientWorld();
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
if (te instanceof TEOrientable)
{
TEOrientable tile = (TEOrientable)te;
((TEOrientable) te).setInputDirection(ForgeDirection.getOrientation(msg.input));
((TEOrientable) te).setOutputDirection(ForgeDirection.getOrientation(msg.output));
}
}
}
private static class TEPedestalMessageHandler extends SimpleChannelInboundHandler<TEPedestalMessage>
{
@Override
protected void channelRead0(ChannelHandlerContext ctx, TEPedestalMessage msg) throws Exception
{
World world = AlchemicalWizardry.proxy.getClientWorld();
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
if (te instanceof TEPedestal)
{
TEPedestal pedestal = (TEPedestal) te;
pedestal.handlePacketData(msg.items);
}
}
}
private static class TEPlinthMessageHandler extends SimpleChannelInboundHandler<TEPlinthMessage>
{
@Override
protected void channelRead0(ChannelHandlerContext ctx, TEPlinthMessage msg) throws Exception
{
World world = AlchemicalWizardry.proxy.getClientWorld();
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
if (te instanceof TEPlinth)
{
TEPlinth Plinth = (TEPlinth) te;
Plinth.handlePacketData(msg.items);
}
}
}
private static class TESocketMessageHandler extends SimpleChannelInboundHandler<TESocketMessage>
{
@Override
protected void channelRead0(ChannelHandlerContext ctx, TESocketMessage msg) throws Exception
{
World world = AlchemicalWizardry.proxy.getClientWorld();
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
if (te instanceof TESocket)
{
TESocket Socket = (TESocket) te;
Socket.handlePacketData(msg.items);
}
}
}
private static class TETeleposerMessageHandler extends SimpleChannelInboundHandler<TETeleposerMessage>
{
@Override
protected void channelRead0(ChannelHandlerContext ctx, TETeleposerMessage msg) throws Exception
{
World world = AlchemicalWizardry.proxy.getClientWorld();
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
if (te instanceof TETeleposer)
{
TETeleposer Teleposer = (TETeleposer) te;
Teleposer.handlePacketData(msg.items);
}
}
}
private static class TEWritingTableMessageHandler extends SimpleChannelInboundHandler<TEWritingTableMessage>
{
@Override
protected void channelRead0(ChannelHandlerContext ctx, TEWritingTableMessage msg) throws Exception
{
World world = AlchemicalWizardry.proxy.getClientWorld();
TileEntity te = world.getTileEntity(msg.x, msg.y, msg.z);
if (te instanceof TEWritingTable)
{
TEWritingTable WritingTable = (TEWritingTable) te;
WritingTable.handlePacketData(msg.items);
}
}
}
private static class ParticleMessageHandler extends SimpleChannelInboundHandler<ParticleMessage>
{
@Override
protected void channelRead0(ChannelHandlerContext ctx, ParticleMessage msg) throws Exception
{
World world = AlchemicalWizardry.proxy.getClientWorld();
world.spawnParticle(msg.particle, msg.xCoord, msg.yCoord, msg.zCoord, msg.xVel, msg.yVel, msg.zVel);
}
}
private static class VelocityMessageHandler extends SimpleChannelInboundHandler<VelocityMessage>
{
@Override
protected void channelRead0(ChannelHandlerContext ctx, VelocityMessage msg) throws Exception
{
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if(player!=null)
{
player.motionX = msg.xVel;
player.motionY = msg.yVel;
player.motionZ = msg.zVel;
}
}
}
public static class BMMessage
{
int index;
}
public static class TEAltarMessage extends BMMessage
{
int x;
int y;
int z;
int[] items;
int[] fluids;
int capacity;
}
public static class TEOrientableMessage extends BMMessage
{
int x;
int y;
int z;
int input;
int output;
}
public static class TEPedestalMessage extends BMMessage
{
int x;
int y;
int z;
int[] items;
}
public static class TEPlinthMessage extends BMMessage
{
int x;
int y;
int z;
int[] items;
}
public static class TESocketMessage extends BMMessage
{
int x;
int y;
int z;
int[] items;
}
public static class TETeleposerMessage extends BMMessage
{
int x;
int y;
int z;
int[] items;
}
public static class TEWritingTableMessage extends BMMessage
{
int x;
int y;
int z;
int[] items;
}
public static class ParticleMessage extends BMMessage
{
String particle;
double xCoord;
double yCoord;
double zCoord;
double xVel;
double yVel;
double zVel;
}
public static class VelocityMessage extends BMMessage
{
double xVel;
double yVel;
double zVel;
}
private class TEAltarCodec extends FMLIndexedMessageToMessageCodec<BMMessage>
{
public TEAltarCodec()
{
addDiscriminator(0, TEAltarMessage.class);
addDiscriminator(1, TEOrientableMessage.class);
addDiscriminator(2, TEPedestalMessage.class);
addDiscriminator(3, TEPlinthMessage.class);
addDiscriminator(4, TESocketMessage.class);
addDiscriminator(5, TETeleposerMessage.class);
addDiscriminator(6, TEWritingTableMessage.class);
addDiscriminator(7, ParticleMessage.class);
addDiscriminator(8, VelocityMessage.class);
}
@Override
public void encodeInto(ChannelHandlerContext ctx, BMMessage msg, ByteBuf target) throws Exception
{
target.writeInt(msg.index);
switch(msg.index)
{
case 0:
target.writeInt(((TEAltarMessage)msg).x);
target.writeInt(((TEAltarMessage)msg).y);
target.writeInt(((TEAltarMessage)msg).z);
target.writeBoolean(((TEAltarMessage)msg).items != null);
if (((TEAltarMessage)msg).items != null)
{
int[] items = ((TEAltarMessage)msg).items;
for (int j = 0; j < items.length; j++)
{
int i = items[j];
target.writeInt(i);
}
}
target.writeBoolean(((TEAltarMessage)msg).fluids != null);
if(((TEAltarMessage)msg).fluids != null)
{
int[] fluids = ((TEAltarMessage)msg).fluids;
for (int j = 0; j < fluids.length; j++)
{
int i = fluids[j];
target.writeInt(i);
}
}
target.writeInt(((TEAltarMessage)msg).capacity);
break;
case 1:
target.writeInt(((TEOrientableMessage)msg).x);
target.writeInt(((TEOrientableMessage)msg).y);
target.writeInt(((TEOrientableMessage)msg).z);
target.writeInt(((TEOrientableMessage)msg).input);
target.writeInt(((TEOrientableMessage)msg).output);
break;
case 2:
target.writeInt(((TEPedestalMessage)msg).x);
target.writeInt(((TEPedestalMessage)msg).y);
target.writeInt(((TEPedestalMessage)msg).z);
target.writeBoolean(((TEPedestalMessage)msg).items != null);
if (((TEPedestalMessage)msg).items != null)
{
int[] items = ((TEPedestalMessage)msg).items;
for (int j = 0; j < items.length; j++)
{
int i = items[j];
target.writeInt(i);
}
}
break;
case 3:
target.writeInt(((TEPlinthMessage)msg).x);
target.writeInt(((TEPlinthMessage)msg).y);
target.writeInt(((TEPlinthMessage)msg).z);
target.writeBoolean(((TEPlinthMessage)msg).items != null);
if (((TEPlinthMessage)msg).items != null)
{
int[] items = ((TEPlinthMessage)msg).items;
for (int j = 0; j < items.length; j++)
{
int i = items[j];
target.writeInt(i);
}
}
break;
case 4:
target.writeInt(((TESocketMessage)msg).x);
target.writeInt(((TESocketMessage)msg).y);
target.writeInt(((TESocketMessage)msg).z);
target.writeBoolean(((TESocketMessage)msg).items != null);
if (((TESocketMessage)msg).items != null)
{
int[] items = ((TESocketMessage)msg).items;
for (int j = 0; j < items.length; j++)
{
int i = items[j];
target.writeInt(i);
}
}
break;
case 5:
target.writeInt(((TETeleposerMessage)msg).x);
target.writeInt(((TETeleposerMessage)msg).y);
target.writeInt(((TETeleposerMessage)msg).z);
target.writeBoolean(((TETeleposerMessage)msg).items != null);
if (((TETeleposerMessage)msg).items != null)
{
int[] items = ((TETeleposerMessage)msg).items;
for (int j = 0; j < items.length; j++)
{
int i = items[j];
target.writeInt(i);
}
}
break;
case 6:
target.writeInt(((TEWritingTableMessage)msg).x);
target.writeInt(((TEWritingTableMessage)msg).y);
target.writeInt(((TEWritingTableMessage)msg).z);
target.writeBoolean(((TEWritingTableMessage)msg).items != null);
if (((TEWritingTableMessage)msg).items != null)
{
int[] items = ((TEWritingTableMessage)msg).items;
for (int j = 0; j < items.length; j++)
{
int i = items[j];
target.writeInt(i);
}
}
break;
case 7:
String str = ((ParticleMessage)msg).particle;
target.writeInt(str.length());
for(int i=0; i<str.length(); i++)
{
target.writeChar(str.charAt(i));
}
target.writeDouble(((ParticleMessage)msg).xCoord);
target.writeDouble(((ParticleMessage)msg).yCoord);
target.writeDouble(((ParticleMessage)msg).zCoord);
target.writeDouble(((ParticleMessage)msg).xVel);
target.writeDouble(((ParticleMessage)msg).yVel);
target.writeDouble(((ParticleMessage)msg).zVel);
break;
case 8:
target.writeDouble(((VelocityMessage)msg).xVel);
target.writeDouble(((VelocityMessage)msg).yVel);
target.writeDouble(((VelocityMessage)msg).zVel);
break;
}
}
@Override
public void decodeInto(ChannelHandlerContext ctx, ByteBuf dat, BMMessage msg)
{
int index = dat.readInt();
switch(index)
{
case 0:
((TEAltarMessage)msg).x = dat.readInt();
((TEAltarMessage)msg).y = dat.readInt();
((TEAltarMessage)msg).z = dat.readInt();
boolean hasStacks = dat.readBoolean();
((TEAltarMessage)msg).items = new int[TEAltar.sizeInv*3];
if (hasStacks)
{
((TEAltarMessage)msg).items = new int[TEAltar.sizeInv*3];
for (int i = 0; i < ((TEAltarMessage)msg).items.length; i++)
{
((TEAltarMessage)msg).items[i] = dat.readInt();
}
}
boolean hasFluids = dat.readBoolean();
((TEAltarMessage)msg).fluids = new int[6];
if(hasFluids)
for (int i = 0; i < ((TEAltarMessage)msg).fluids.length; i++)
{
((TEAltarMessage)msg).fluids[i] = dat.readInt();
}
((TEAltarMessage)msg).capacity = dat.readInt();
break;
case 1:
((TEOrientableMessage)msg).x = dat.readInt();
((TEOrientableMessage)msg).y = dat.readInt();
((TEOrientableMessage)msg).z = dat.readInt();
((TEOrientableMessage)msg).input = dat.readInt();
((TEOrientableMessage)msg).output = dat.readInt();
break;
case 2:
((TEPedestalMessage)msg).x = dat.readInt();
((TEPedestalMessage)msg).y = dat.readInt();
((TEPedestalMessage)msg).z = dat.readInt();
boolean hasStacks1 = dat.readBoolean();
((TEPedestalMessage)msg).items = new int[TEPedestal.sizeInv*3];
if (hasStacks1)
{
((TEPedestalMessage)msg).items = new int[TEPedestal.sizeInv*3];
for (int i = 0; i < ((TEPedestalMessage)msg).items.length; i++)
{
((TEPedestalMessage)msg).items[i] = dat.readInt();
}
}
break;
case 3:
((TEPlinthMessage)msg).x = dat.readInt();
((TEPlinthMessage)msg).y = dat.readInt();
((TEPlinthMessage)msg).z = dat.readInt();
boolean hasStacks2 = dat.readBoolean();
((TEPlinthMessage)msg).items = new int[TEPlinth.sizeInv*3];
if (hasStacks2)
{
((TEPlinthMessage)msg).items = new int[TEPlinth.sizeInv*3];
for (int i = 0; i < ((TEPlinthMessage)msg).items.length; i++)
{
((TEPlinthMessage)msg).items[i] = dat.readInt();
}
}
break;
case 4:
((TESocketMessage)msg).x = dat.readInt();
((TESocketMessage)msg).y = dat.readInt();
((TESocketMessage)msg).z = dat.readInt();
boolean hasStacks3 = dat.readBoolean();
((TESocketMessage)msg).items = new int[TESocket.sizeInv*3];
if (hasStacks3)
{
((TESocketMessage)msg).items = new int[TESocket.sizeInv*3];
for (int i = 0; i < ((TESocketMessage)msg).items.length; i++)
{
((TESocketMessage)msg).items[i] = dat.readInt();
}
}
break;
case 5:
((TETeleposerMessage)msg).x = dat.readInt();
((TETeleposerMessage)msg).y = dat.readInt();
((TETeleposerMessage)msg).z = dat.readInt();
boolean hasStacks4 = dat.readBoolean();
((TETeleposerMessage)msg).items = new int[TETeleposer.sizeInv*3];
if (hasStacks4)
{
((TETeleposerMessage)msg).items = new int[TETeleposer.sizeInv*3];
for (int i = 0; i < ((TETeleposerMessage)msg).items.length; i++)
{
((TETeleposerMessage)msg).items[i] = dat.readInt();
}
}
break;
case 6:
((TEWritingTableMessage)msg).x = dat.readInt();
((TEWritingTableMessage)msg).y = dat.readInt();
((TEWritingTableMessage)msg).z = dat.readInt();
boolean hasStacks5 = dat.readBoolean();
((TEWritingTableMessage)msg).items = new int[TEWritingTable.sizeInv*3];
if (hasStacks5)
{
((TEWritingTableMessage)msg).items = new int[TEWritingTable.sizeInv*3];
for (int i = 0; i < ((TEWritingTableMessage)msg).items.length; i++)
{
((TEWritingTableMessage)msg).items[i] = dat.readInt();
}
}
break;
case 7:
int size = dat.readInt();
String str = "";
for (int i = 0; i < size; i++)
{
str = str + dat.readChar();
}
((ParticleMessage)msg).particle = str;
((ParticleMessage)msg).xCoord = dat.readDouble();
((ParticleMessage)msg).yCoord = dat.readDouble();
((ParticleMessage)msg).zCoord = dat.readDouble();
((ParticleMessage)msg).xVel = dat.readDouble();
((ParticleMessage)msg).yVel = dat.readDouble();
((ParticleMessage)msg).zVel = dat.readDouble();
break;
case 8:
((VelocityMessage)msg).xVel = dat.readDouble();
((VelocityMessage)msg).yVel = dat.readDouble();
((VelocityMessage)msg).zVel = dat.readDouble();
break;
}
}
}
//Packets to be obtained
public static Packet getPacket(TEAltar tileAltar)
{
TEAltarMessage msg = new TEAltarMessage();
msg.index = 0;
msg.x = tileAltar.xCoord;
msg.y = tileAltar.yCoord;
msg.z = tileAltar.zCoord;
msg.items = tileAltar.buildIntDataList();
msg.fluids = tileAltar.buildFluidList();
msg.capacity = tileAltar.getCapacity();
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
}
public static Packet getPacket(TEOrientable tileOrientable)
{
TEOrientableMessage msg = new TEOrientableMessage();
msg.index = 1;
msg.x = tileOrientable.xCoord;
msg.y = tileOrientable.yCoord;
msg.z = tileOrientable.zCoord;
msg.input = tileOrientable.getIntForForgeDirection(tileOrientable.getInputDirection());
msg.output = tileOrientable.getIntForForgeDirection(tileOrientable.getOutputDirection());
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
}
public static Packet getPacket(TEPedestal tilePedestal)
{
TEPedestalMessage msg = new TEPedestalMessage();
msg.index = 2;
msg.x = tilePedestal.xCoord;
msg.y = tilePedestal.yCoord;
msg.z = tilePedestal.zCoord;
msg.items = tilePedestal.buildIntDataList();
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
}
public static Packet getPacket(TEPlinth tilePlinth)
{
TEPlinthMessage msg = new TEPlinthMessage();
msg.index = 3;
msg.x = tilePlinth.xCoord;
msg.y = tilePlinth.yCoord;
msg.z = tilePlinth.zCoord;
msg.items = tilePlinth.buildIntDataList();
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
}
public static Packet getPacket(TESocket tileSocket)
{
TESocketMessage msg = new TESocketMessage();
msg.index = 4;
msg.x = tileSocket.xCoord;
msg.y = tileSocket.yCoord;
msg.z = tileSocket.zCoord;
msg.items = tileSocket.buildIntDataList();
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
}
public static Packet getPacket(TETeleposer tileTeleposer)
{
TETeleposerMessage msg = new TETeleposerMessage();
msg.index = 5;
msg.x = tileTeleposer.xCoord;
msg.y = tileTeleposer.yCoord;
msg.z = tileTeleposer.zCoord;
msg.items = tileTeleposer.buildIntDataList();
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
}
public static Packet getPacket(TEWritingTable tileWritingTable)
{
TEWritingTableMessage msg = new TEWritingTableMessage();
msg.index = 6;
msg.x = tileWritingTable.xCoord;
msg.y = tileWritingTable.yCoord;
msg.z = tileWritingTable.zCoord;
msg.items = tileWritingTable.buildIntDataList();
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
}
public static Packet getParticlePacket(String str, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel)
{
ParticleMessage msg = new ParticleMessage();
msg.index = 7;
msg.particle = str;
msg.xCoord = xCoord;
msg.yCoord = yCoord;
msg.zCoord = zCoord;
msg.xVel = xVel;
msg.yVel = yVel;
msg.zVel = zVel;
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
}
public static Packet getVelSettingPacket(double xVel, double yVel, double zVel)
{
VelocityMessage msg = new VelocityMessage();
msg.index = 8;
msg.xVel = xVel;
msg.yVel = yVel;
msg.zVel = zVel;
return INSTANCE.channels.get(Side.SERVER).generatePacketFrom(msg);
}
public void sendTo(Packet message, EntityPlayerMP player)
{
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
this.channels.get(Side.SERVER).writeAndFlush(message);
}
public void sendToAll(Packet message)
{
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
this.channels.get(Side.SERVER).writeAndFlush(message);
}
public void sendToAllAround(Packet message, NetworkRegistry.TargetPoint point)
{
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
this.channels.get(Side.SERVER).writeAndFlush(message);
}
}

View file

@ -0,0 +1,966 @@
package WayofTime.alchemicalWizardry.common;
import ibxm.Player;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Random;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;
import com.jcraft.jogg.Packet;
public class PacketHandler //implements IPacketHandler
{
// @Override
// public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
// {
// if (packet.channel.equals("BloodAltar"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// boolean hasStacks = dat.readByte() != 0;
// int[] items = new int[0];
//
// if (hasStacks)
// {
// items = new int[1 * 3];
//
// for (int i = 0; i < items.length; i++)
// {
// items[i] = dat.readInt();
// }
// }
//
// int fluidIDMain = dat.readInt();
// int fluidAmountMain = dat.readInt();
// int fluidIDOutput = dat.readInt();
// int fluidAmountOutput = dat.readInt();
// int fluidIDInput = dat.readInt();
// int fluidAmountInput = dat.readInt();
// int capacity = dat.readInt();
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TEAltar)
// {
// TEAltar tileEntityAltar = (TEAltar) tileEntity;
// FluidStack flMain = new FluidStack(fluidIDMain, fluidAmountMain);
// FluidStack flOutput = new FluidStack(fluidIDOutput, fluidAmountOutput);
// FluidStack flInput = new FluidStack(fluidIDInput, fluidAmountInput);
// tileEntityAltar.handlePacketData(items, flMain, flOutput, flInput, capacity);
// }
// } else if (packet.channel.equals("FallReset"))
// {
// if (player instanceof EntityPlayer)
// {
// ((EntityPlayer) player).fallDistance = 0;
// }
// } else if (packet.channel.equals("particle"))
// {
// ByteArrayInputStream bin = new ByteArrayInputStream(packet.data);
// DataInputStream din = new DataInputStream(bin);
// Random rand = new Random();
//
// try
// {
// double x = din.readDouble();
// double y = din.readDouble();
// double z = din.readDouble();
// short particleType = din.readShort();
// World world = ((EntityPlayer) player).worldObj;
//
// if (particleType == 1)
// {
// world.spawnParticle("mobSpell", x + 0.5D + rand.nextGaussian() / 8, y + 1.1D, z + 0.5D + rand.nextGaussian() / 8, 0.5117D, 0.0117D, 0.0117D);
// }
//
// if (particleType == 2)
// {
// world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 1.1D, z + 0.5D + rand.nextGaussian() / 8, 0.82D, 0.941D, 0.91D);
// }
//
// if (particleType == 3)
// {
// world.spawnParticle("mobSpell", x + 0.5D + rand.nextGaussian() / 8, y + 1.1D, z + 0.5D + rand.nextGaussian() / 8, 1.0D, 0.371D, 0.371D);
// }
//
// if (particleType == 4)
// {
// float f = (float) 1.0F;
// float f1 = f * 0.6F + 0.4F;
// float f2 = f * f * 0.7F - 0.5F;
// float f3 = f * f * 0.6F - 0.7F;
//
// for (int l = 0; l < 8; ++l)
// {
// world.spawnParticle("reddust", x + Math.random() - Math.random(), y + Math.random() - Math.random(), z + Math.random() - Math.random(), f1, f2, f3);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// } else if (packet.channel.equals("CustomParticle"))
// {
// ByteArrayInputStream bin = new ByteArrayInputStream(packet.data);
// DataInputStream din = new DataInputStream(bin);
// Random rand = new Random();
//
// try
// {
// World world = ((EntityPlayer) player).worldObj;
// int size = din.readInt();
// String str = "";
//
// for (int i = 0; i < size; i++)
// {
// str = str + din.readChar();
// }
//
// double x = din.readDouble();
// double y = din.readDouble();
// double z = din.readDouble();
// double xVel = din.readDouble();
// double yVel = din.readDouble();
// double zVel = din.readDouble();
// world.spawnParticle(str, x, y, z, xVel, yVel, zVel);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// } else if (packet.channel.equals("SetLifeEssence")) //Sets the data for the character
// {
// ByteArrayInputStream bin = new ByteArrayInputStream(packet.data);
// DataInputStream din = new DataInputStream(bin);
//
// try
// {
// EntityPlayer user = (EntityPlayer) player;
// int length = din.readInt();
// String ownerName = "";
//
// for (int i = 0; i < length; i++)
// {
// ownerName = ownerName + din.readChar();
// }
//
// int addedEssence = din.readInt();
// int maxEssence = din.readInt();
// World world = MinecraftServer.getServer().worldServers[0];
// LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
//
// if (data == null)
// {
// data = new LifeEssenceNetwork(ownerName);
// world.setItemData(ownerName, data);
// }
//
// if (addedEssence > 0)
// {
// if (data.currentEssence < maxEssence)
// {
// data.currentEssence = Math.min(maxEssence, data.currentEssence + addedEssence);
// data.markDirty();
// }
//
// if (!user.capabilities.isCreativeMode)
// {
// for (int i = 0; i < ((addedEssence + 99) / 100); i++)
// {
// //player.setEntityHealth((player.getHealth()-1));
// user.setHealth((user.getHealth() - 1));
//
// if (user.getHealth() <= 0.5f)
// {
// //user.inventory.dropAllItems();
// user.onDeath(DamageSource.generic);
// return;
// }
// }
// }
// } else
// {
// int removedEssence = -addedEssence;
//
// if ((data.currentEssence - removedEssence) >= 0)
// {
// data.currentEssence -= removedEssence;
// data.markDirty();
// } else
// {
// if (removedEssence >= 100)
// {
// for (int i = 0; i < ((removedEssence + 99) / 100); i++)
// {
// //player.setEntityHealth((player.getHealth()-1));
// user.setHealth((user.getHealth() - 1));
//
// if (user.getHealth() <= 0.5f)
// {
// //user.inventory.dropAllItems();
// user.onDeath(DamageSource.generic);
// return;
// }
// }
// } else
// {
// if (user.worldObj.rand.nextInt(100) <= removedEssence)
// {
// user.setHealth((user.getHealth() - 1));
//
// if (user.getHealth() <= 0.5f)
// {
// //user.inventory.dropAllItems();
// user.onDeath(DamageSource.generic);
// return;
// }
// }
// }
// }
// }
//
// //PacketDispatcher.sendPacketToPlayer(PacketHandler.getPacket(ownerName), (Player)user);
//// data.currentEssence = addedEssence;
//// data.markDirty();
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// } else if (packet.channel.equals("InfiniteLPPath"))
// {
// ByteArrayInputStream bin = new ByteArrayInputStream(packet.data);
// DataInputStream din = new DataInputStream(bin);
//
// try
// {
// EntityPlayer user = (EntityPlayer) player;
// int length = din.readInt();
// String ownerName = "";
//
// for (int i = 0; i < length; i++)
// {
// ownerName = ownerName + din.readChar();
// }
//
// boolean fill = din.readBoolean();
// World world = MinecraftServer.getServer().worldServers[0];
// LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
//
// if (data == null)
// {
// data = new LifeEssenceNetwork(ownerName);
// world.setItemData(ownerName, data);
// }
//
// if (fill)
// {
// data.currentEssence += 1000000;
// data.markDirty();
// } else
// {
// data.currentEssence = 0;
// data.markDirty();
// }
//
// //PacketDispatcher.sendPacketToPlayer(PacketHandler.getPacket(ownerName), (Player)user);
//// data.currentEssence = addedEssence;
//// data.markDirty();
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// } else if (packet.channel.equals("GetLifeEssence"))
// {
// ByteArrayInputStream bin = new ByteArrayInputStream(packet.data);
// DataInputStream din = new DataInputStream(bin);
//
// try
// {
// int length = din.readInt();
// String ownerName = "";
//
// for (int i = 0; i < length; i++)
// {
// ownerName = ownerName + din.readChar();
// }
//
// World world = MinecraftServer.getServer().worldServers[0];
// LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);
//
// if (data == null)
// {
// data = new LifeEssenceNetwork(ownerName);
// world.setItemData(ownerName, data);
// }
//
// if (player instanceof EntityPlayer)
// {
// EntityPlayer owner = (EntityPlayer) player;
// ChatMessageComponent chatmessagecomponent = new ChatMessageComponent();
// //chatmessagecomponent.func_111072_b("Current Essence: " + data.currentEssence + "LP");
// chatmessagecomponent.addText("Current Essence: " + data.currentEssence + "LP");
// owner.sendChatToPlayer(chatmessagecomponent);
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// } else if (packet.channel.equals("GetAltarEssence"))
// {
// ByteArrayInputStream bin = new ByteArrayInputStream(packet.data);
// DataInputStream din = new DataInputStream(bin);
//
// try
// {
// int x = din.readInt();
// int y = din.readInt();
// int z = din.readInt();
//
// if (player instanceof EntityPlayer)
// {
// EntityPlayer owner = (EntityPlayer) player;
// World world = owner.worldObj;
// TEAltar tileEntity = (TEAltar) world.getBlockTileEntity(x, y, z);
//
// if (tileEntity != null)
// {
// int level = UpgradedAltars.isAltarValid(world, x, y, z);
// ChatMessageComponent chatmessagecomponent = new ChatMessageComponent();
// chatmessagecomponent.addText("Altar's Current Essence: " + tileEntity.getFluidAmount() + "LP" + "\n" + "Altar's Current Tier: " + level + "\nCapacity: " + tileEntity.getCapacity() + "LP");
// //chatmessagecomponent.addText();
// owner.sendChatToPlayer(chatmessagecomponent);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
// } else if (packet.channel.equals("TESocket"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// boolean hasStacks = dat.readByte() != 0;
// int[] items = new int[0];
//
// if (hasStacks)
// {
// items = new int[1 * 3];
//
// for (int i = 0; i < items.length; i++)
// {
// items[i] = dat.readInt();
// }
// }
//
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TESocket)
// {
// TESocket tileEntityAltar = (TESocket) tileEntity;
// tileEntityAltar.handlePacketData(items);
// }
// } else if (packet.channel.equals("TEWritingTable"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// boolean hasStacks = dat.readByte() != 0;
// int[] items = new int[0];
//
// if (hasStacks)
// {
// items = new int[7 * 3];
//
// for (int i = 0; i < items.length; i++)
// {
// items[i] = dat.readInt();
// }
// }
//
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TEWritingTable)
// {
// TEWritingTable tileEntityAltar = (TEWritingTable) tileEntity;
// tileEntityAltar.handlePacketData(items);
// }
// } else if (packet.channel.equals("TEOrientor"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TEOrientable)
// {
// TEOrientable tileEntityOrientable = (TEOrientable) tileEntity;
// tileEntityOrientable.setInputDirection(ForgeDirection.getOrientation(dat.readInt()));
// tileEntityOrientable.setOutputDirection(ForgeDirection.getOrientation(dat.readInt()));
// world.markBlockForRenderUpdate(x, y, z);
// }
// } else if (packet.channel.equals("TEPedestal"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// boolean hasStacks = dat.readByte() != 0;
// int[] items = new int[0];
//
// if (hasStacks)
// {
// items = new int[1 * 3];
//
// for (int i = 0; i < items.length; i++)
// {
// items[i] = dat.readInt();
// }
// }
//
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TEPedestal)
// {
// TEPedestal tileEntityAltar = (TEPedestal) tileEntity;
// tileEntityAltar.handlePacketData(items);
// }
// } else if (packet.channel.equals("TEPlinth"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// boolean hasStacks = dat.readByte() != 0;
// int[] items = new int[0];
//
// if (hasStacks)
// {
// items = new int[1 * 3];
//
// for (int i = 0; i < items.length; i++)
// {
// items[i] = dat.readInt();
// }
// }
//
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TEPlinth)
// {
// TEPlinth tileEntityAltar = (TEPlinth) tileEntity;
// tileEntityAltar.handlePacketData(items);
// }
// } else if (packet.channel.equals("TETeleposer"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// int x = dat.readInt();
// int y = dat.readInt();
// int z = dat.readInt();
// boolean hasStacks = dat.readByte() != 0;
// int[] items = new int[0];
//
// if (hasStacks)
// {
// items = new int[1 * 3];
//
// for (int i = 0; i < items.length; i++)
// {
// items[i] = dat.readInt();
// }
// }
//
// World world = AlchemicalWizardry.proxy.getClientWorld();
// TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//
// if (tileEntity instanceof TETeleposer)
// {
// TETeleposer tileEntityAltar = (TETeleposer) tileEntity;
// tileEntityAltar.handlePacketData(items);
// }
// } else if (packet.channel.equals("SetPlayerVel"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// double xVel = dat.readDouble();
// double yVel = dat.readDouble();
// double zVel = dat.readDouble();
// ((EntityPlayer) player).setVelocity(xVel, yVel, zVel);
// } else if (packet.channel.equals("SetPlayerPos"))
// {
// ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
// double xVel = dat.readDouble();
// double yVel = dat.readDouble();
// double zVel = dat.readDouble();
// ((EntityPlayer) player).setPosition(xVel, yVel, zVel);
// }
// }
//
// public static Packet getPacket(TEAltar tileEntity)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
// int[] items = tileEntity.buildIntDataList();
// boolean hasStacks = (items != null);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeByte(hasStacks ? 1 : 0);
//
// if (hasStacks)
// {
// for (int i = 0; i < 3; i++)
// {
// dos.writeInt(items[i]);
// }
// }
//
// FluidStack flMain = tileEntity.getFluid();
//
// if (flMain == null)
// {
// dos.writeInt(AlchemicalWizardry.lifeEssenceFluid.getBlockID());
// dos.writeInt(0);
// } else
// {
// dos.writeInt(flMain.fluidID);
// dos.writeInt(flMain.amount);
// }
//
// FluidStack flOut = tileEntity.getOutputFluid();
//
// if (flOut == null)
// {
// dos.writeInt(AlchemicalWizardry.lifeEssenceFluid.getBlockID());
// dos.writeInt(0);
// } else
// {
// dos.writeInt(flOut.fluidID);
// dos.writeInt(flOut.amount);
// }
//
// FluidStack flIn = tileEntity.getInputFluid();
//
// if (flIn == null)
// {
// dos.writeInt(AlchemicalWizardry.lifeEssenceFluid.getBlockID());
// dos.writeInt(0);
// } else
// {
// dos.writeInt(flIn.fluidID);
// dos.writeInt(flIn.amount);
// }
//
// dos.writeInt(tileEntity.capacity);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "BloodAltar";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(TESocket tileEntity)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
// int[] items = tileEntity.buildIntDataList();
// boolean hasStacks = (items != null);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeByte(hasStacks ? 1 : 0);
//
// if (hasStacks)
// {
// for (int i = 0; i < 3; i++)
// {
// dos.writeInt(items[i]);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "TESocket";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(String ownerName, int addedEssence, int maxEssence)
// //Packet to be sent to server to change essence
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeInt(ownerName.length());
// dos.writeChars(ownerName);
// dos.writeInt(addedEssence);
// dos.writeInt(maxEssence); //Used for Blood Orbs, but does nothing for other items
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "SetLifeEssence";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// //pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(String ownerName) //stores the current essence in the player's NBT
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeInt(ownerName.length());
// dos.writeChars(ownerName);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "GetLifeEssence";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// //pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getAltarPacket(int x, int y, int z)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeInt(x);
// dos.writeInt(y);
// dos.writeInt(z);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "GetAltarEssence";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// //pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(TEWritingTable tileEntity)
// {
// // TODO Auto-generated method stub
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
// int[] items = tileEntity.buildIntDataList();
// boolean hasStacks = (items != null);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeByte(hasStacks ? 1 : 0);
//
// if (hasStacks)
// {
// for (int i = 0; i < 3 * 7; i++)
// {
// dos.writeInt(items[i]);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "TEWritingTable";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(TEPedestal tileEntity)
// {
// // TODO Auto-generated method stub
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
// int[] items = tileEntity.buildIntDataList();
// boolean hasStacks = (items != null);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeByte(hasStacks ? 1 : 0);
//
// if (hasStacks)
// {
// for (int i = 0; i < 3 * 1; i++)
// {
// dos.writeInt(items[i]);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "TEPedestal";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(TEPlinth tileEntity)
// {
// // TODO Auto-generated method stub
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
// int[] items = tileEntity.buildIntDataList();
// boolean hasStacks = (items != null);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeByte(hasStacks ? 1 : 0);
//
// if (hasStacks)
// {
// for (int i = 0; i < 3 * 1; i++)
// {
// dos.writeInt(items[i]);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "TEPlinth";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getPacket(TETeleposer tileEntity)
// {
// // TODO Auto-generated method stub
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
// int[] items = tileEntity.buildIntDataList();
// boolean hasStacks = (items != null);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeByte(hasStacks ? 1 : 0);
//
// if (hasStacks)
// {
// for (int i = 0; i < 3 * 1; i++)
// {
// dos.writeInt(items[i]);
// }
// }
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "TETeleposer";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
//
// public static Packet getCustomParticlePacket(String str, double x, double y, double z, double xVel, double yVel, double zVel)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeInt(str.length());
// dos.writeChars(str);
// dos.writeDouble(x);
// dos.writeDouble(y);
// dos.writeDouble(z);
// dos.writeDouble(xVel);
// dos.writeDouble(yVel);
// dos.writeDouble(zVel);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "CustomParticle";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = false;
// return pkt;
// }
//
// public static Packet getPlayerVelocitySettingPacket(double xVel, double yVel, double zVel)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeDouble(xVel);
// dos.writeDouble(yVel);
// dos.writeDouble(zVel);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "SetPlayerVel";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = false;
// return pkt;
// }
//
// public static Packet getPlayerPositionSettingPacket(double xVel, double yVel, double zVel)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeDouble(xVel);
// dos.writeDouble(yVel);
// dos.writeDouble(zVel);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "SetPlayerPos";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = false;
// return pkt;
// }
//
// public static Packet getCreativeCheatPacket(String ownerName, boolean isFill)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeInt(ownerName.length());
// dos.writeChars(ownerName);
// dos.writeBoolean(isFill);
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "InfiniteLPPath";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = false;
// return pkt;
// }
//
// public static Packet getBlockOrientationPacket(TEOrientable tileEntity)
// {
// ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
// DataOutputStream dos = new DataOutputStream(bos);
//
// try
// {
// dos.writeInt(tileEntity.xCoord);
// dos.writeInt(tileEntity.yCoord);
// dos.writeInt(tileEntity.zCoord);
// dos.writeInt(tileEntity.getIntForForgeDirection(tileEntity.getInputDirection()));
// dos.writeInt(tileEntity.getIntForForgeDirection(tileEntity.getOutputDirection()));
// } catch (IOException e)
// {
// e.printStackTrace();
// }
//
// Packet250CustomPayload pkt = new Packet250CustomPayload();
// pkt.channel = "TEOrientor";
// pkt.data = bos.toByteArray();
// pkt.length = bos.size();
// pkt.isChunkDataPacket = true;
// return pkt;
// }
}

View file

@ -0,0 +1,37 @@
package WayofTime.alchemicalWizardry.common;
public class PlinthComponent
{
public int xOffset;
public int yOffset;
public int zOffset;
public int ring;
public PlinthComponent(int xOffset, int yOffset, int zOffset, int ring)
{
this.xOffset = xOffset;
this.yOffset = yOffset;
this.zOffset = zOffset;
this.ring = ring;
}
public int getXOffset()
{
return xOffset;
}
public int getYOffset()
{
return yOffset;
}
public int getZOffset()
{
return zOffset;
}
public int getRing()
{
return ring;
}
}

View file

@ -0,0 +1,336 @@
package WayofTime.alchemicalWizardry.common.block;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
import WayofTime.alchemicalWizardry.common.ArmourComponent;
import WayofTime.alchemicalWizardry.common.items.BoundArmour;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ArmourForge extends Block
{
public static List<ArmourComponent> helmetList = new ArrayList();
public static List<ArmourComponent> plateList = new ArrayList();
public static List<ArmourComponent> leggingsList = new ArrayList();
public static List<ArmourComponent> bootsList = new ArrayList();
public ArmourForge()
{
super(Material.iron);
setHardness(2.0F);
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("armourForge");
//setUnlocalizedName("armourForge");
// TODO Auto-generated constructor stub
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister)
{
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SoulForge");
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
{
if (world.isRemote)
{
return false;
}
int armourType = getArmourType(world, x, y, z);
if (armourType == -1)
{
return false;
}
int direction = getDirectionForArmourType(world, x, y, z, armourType);
if (!isParadigmValid(armourType, direction, world, x, y, z))
{
return false;
}
List<ArmourComponent> list = null;
ItemStack armourPiece = null;
switch (armourType)
{
case 0:
list = plateList;
armourPiece = new ItemStack(ModItems.boundPlate, 1, 0);
break;
case 1:
list = leggingsList;
armourPiece = new ItemStack(ModItems.boundLeggings, 1, 0);
break;
case 2:
list = helmetList;
armourPiece = new ItemStack(ModItems.boundHelmet, 1, 0);
break;
case 3:
list = bootsList;
armourPiece = new ItemStack(ModItems.boundBoots, 1, 0);
break;
}
if (list == null)
{
return false;
}
if (armourPiece == null)
{
return false;
}
if (armourPiece.stackTagCompound == null)
{
armourPiece.setTagCompound(new NBTTagCompound());
}
for (ArmourComponent ac : list)
{
int xOff = ac.getXOff();
int zOff = ac.getZOff();
TileEntity tileEntity;
switch (direction)
{
case 1:
tileEntity = world.getTileEntity(x + xOff, y, z - zOff);
break;
case 2:
tileEntity = world.getTileEntity(x + zOff, y, z + xOff);
break;
case 3:
tileEntity = world.getTileEntity(x - xOff, y, z + zOff);
break;
case 4:
tileEntity = world.getTileEntity(x - zOff, y, z - xOff);
break;
case 5:
tileEntity = world.getTileEntity(x + xOff, y + zOff, z);
break;
case 6:
tileEntity = world.getTileEntity(x, y + zOff, z + xOff);
break;
default:
tileEntity = null;
}
if (tileEntity instanceof TESocket)
{
ItemStack itemStack = ((TESocket) tileEntity).getStackInSlot(0);
int xCoord = tileEntity.xCoord;
int yCoord = tileEntity.yCoord;
int zCoord = tileEntity.zCoord;
((TESocket) tileEntity).setInventorySlotContents(0, null);
world.setBlockToAir(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
for (int i = 0; i < 8; i++)
{
//PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 20, world.provider.dimensionId, TEAltar.getParticlePacket(xCoord, yCoord, zCoord, (short) 1));
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, world.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (itemStack != null)
{
Item item = itemStack.getItem();
if (item instanceof ArmourUpgrade)
{
((BoundArmour) armourPiece.getItem()).hasAddedToInventory(armourPiece, itemStack.copy());
((TESocket) tileEntity).setInventorySlotContents(0, null);
}
}
}
}
if (armourPiece != null)
{
int xOff = (world.rand.nextInt(11) - 5);
int zOff = (int) (Math.sqrt(25 - xOff * xOff) * (world.rand.nextInt(2) - 0.5) * 2);
world.addWeatherEffect(new EntityLightningBolt(world, x + xOff, y + 5, z + zOff));
world.spawnEntityInWorld(new EntityItem(world, x, y + 1, z, armourPiece));
}
return true;
}
//0 for plate, 1 for leggings, 2 for helmet, 3 for boots
public int getArmourType(World world, int x, int y, int z)
{
for (int i = 0; i <= 3; i++)
{
if (getDirectionForArmourType(world, x, y, z, i) != -1)
{
return i;
}
}
return -1;
}
public int getDirectionForArmourType(World world, int x, int y, int z, int armourType)
{
for (int i = 1; i <= 6; i++)
{
if (isParadigmValid(armourType, i, world, x, y, z))
{
return i;
}
}
return -1;
}
public boolean isParadigmValid(int armourType, int direction, World world, int x, int y, int z)
{
List<ArmourComponent> list = null;
switch (armourType)
{
case 0:
list = plateList;
break;
case 1:
list = leggingsList;
break;
case 2:
list = helmetList;
break;
case 3:
list = bootsList;
break;
}
if (list == null)
{
return false;
}
for (ArmourComponent ac : list)
{
int xOff = ac.getXOff();
int zOff = ac.getZOff();
switch (direction)
{
case 1:
if (!(world.getTileEntity(x + xOff, y, z - zOff) instanceof TESocket))
{
return false;
}
break;
case 2:
if (!(world.getTileEntity(x + zOff, y, z + xOff) instanceof TESocket))
{
return false;
}
break;
case 3:
if (!(world.getTileEntity(x - xOff, y, z + zOff) instanceof TESocket))
{
return false;
}
break;
case 4:
if (!(world.getTileEntity(x - zOff, y, z - xOff) instanceof TESocket))
{
return false;
}
break;
case 5:
if (!(world.getTileEntity(x + xOff, y + zOff, z) instanceof TESocket))
{
return false;
}
break;
case 6:
if (!(world.getTileEntity(x, y + zOff, z + xOff) instanceof TESocket))
{
return false;
}
break;
default:
return false;
}
}
return true;
}
public static void initializeRecipes()
{
helmetList.add(new ArmourComponent(-1, 1));
helmetList.add(new ArmourComponent(0, 1));
helmetList.add(new ArmourComponent(1, 1));
helmetList.add(new ArmourComponent(-1, 0));
helmetList.add(new ArmourComponent(1, 0));
bootsList.add(new ArmourComponent(-1, 1));
bootsList.add(new ArmourComponent(1, 1));
bootsList.add(new ArmourComponent(-1, 0));
bootsList.add(new ArmourComponent(1, 0));
plateList.add(new ArmourComponent(-1, 0));
plateList.add(new ArmourComponent(1, 0));
plateList.add(new ArmourComponent(-1, -1));
plateList.add(new ArmourComponent(0, -1));
plateList.add(new ArmourComponent(1, -1));
plateList.add(new ArmourComponent(-1, -2));
plateList.add(new ArmourComponent(0, -2));
plateList.add(new ArmourComponent(1, -2));
leggingsList.add(new ArmourComponent(-1, 1));
leggingsList.add(new ArmourComponent(0, 1));
leggingsList.add(new ArmourComponent(1, 1));
leggingsList.add(new ArmourComponent(-1, 0));
leggingsList.add(new ArmourComponent(1, 0));
leggingsList.add(new ArmourComponent(-1, -1));
leggingsList.add(new ArmourComponent(1, -1));
}
}

View file

@ -0,0 +1,311 @@
package WayofTime.alchemicalWizardry.common.block;
import java.util.Random;
import javax.swing.Icon;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockAltar extends BlockContainer
{
@SideOnly(Side.CLIENT)
private static IIcon topIcon;
@SideOnly(Side.CLIENT)
private static IIcon sideIcon1;
@SideOnly(Side.CLIENT)
private static IIcon sideIcon2;
@SideOnly(Side.CLIENT)
private static IIcon bottomIcon;
public BlockAltar()
{
super(Material.rock);
setHardness(2.0F);
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("bloodAltar");
//setUnlocalizedName("blockAltar");
//func_111022_d("AlchemicalWizardry:blocks");
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister)
{
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Top");
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType1");
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
switch (side)
{
case 0:
return bottomIcon;
case 1:
return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default:
return sideIcon2;
}
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
{
TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z);
// world.scheduleBlockUpdate(x, y, z, this.blockID, 0);
if (tileEntity == null || player.isSneaking())
{
return false;
}
ItemStack playerItem = player.getCurrentEquippedItem();
if (playerItem != null)
{
if (playerItem.getItem().equals(ModItems.divinationSigil))
{
if (player.worldObj.isRemote)
{
world.markBlockForUpdate(x, y, z);
}else
{
tileEntity.sendChatInfoToPlayer(player);
}
return true;
}
else if(playerItem.getItem().equals(ModItems.itemSeerSigil))
{
if (player.worldObj.isRemote)
{
world.markBlockForUpdate(x, y, z);
}else
{
tileEntity.sendMoreChatInfoToPlayer(player);
}
return true;
}
else if (playerItem.getItem().equals(ModItems.sigilOfHolding))
{
ItemStack item = ((SigilOfHolding) playerItem.getItem()).getCurrentItem(playerItem);
if (item != null && item.getItem().equals(ModItems.divinationSigil))
{
if (player.worldObj.isRemote)
{
world.markBlockForUpdate(x, y, z);
}else
{
tileEntity.sendChatInfoToPlayer(player);
}
return true;
}
else if(item !=null && item.getItem().equals(ModItems.itemSeerSigil))
{
if (player.worldObj.isRemote)
{
world.markBlockForUpdate(x, y, z);
}else
{
tileEntity.sendMoreChatInfoToPlayer(player);
}
return true;
}
}
}
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
{
ItemStack newItem = playerItem.copy();
newItem.stackSize = 1;
// if(newItem.getMaxDamage()==0)
// {
// newItem.setItemDamage(0);
// }
--playerItem.stackSize;
tileEntity.setInventorySlotContents(0, newItem);
tileEntity.startCycle();
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
{
/**stub method
* Add the item that is in the slot to the player's inventory, and
* then set the slot to null.
*/
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
tileEntity.setInventorySlotContents(0, null);
tileEntity.setActive();
}
world.markBlockForUpdate(x, y, z);
//player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
//PacketDispatcher.sendPacketToServer(tileEntity.getDescriptionPacket());
return true;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
{
dropItems(world, x, y, z);
super.breakBlock(world, x, y, z, par5, par6);
}
private void dropItems(World world, int x, int y, int z)
{
Random rand = new Random();
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (!(tileEntity instanceof IInventory))
{
return;
}
IInventory inventory = (IInventory) tileEntity;
for (int i = 0; i < inventory.getSizeInventory(); i++)
{
ItemStack item = inventory.getStackInSlot(i);
if (item != null && item.stackSize > 0)
{
float rx = rand.nextFloat() * 0.8F + 0.1F;
float ry = rand.nextFloat() * 0.8F + 0.1F;
float rz = rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem = new EntityItem(world,
x + rx, y + ry, z + rz,
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
if (item.hasTagCompound())
{
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
}
float factor = 0.05F;
entityItem.motionX = rand.nextGaussian() * factor;
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
entityItem.motionZ = rand.nextGaussian() * factor;
world.spawnEntityInWorld(entityItem);
item.stackSize = 0;
}
}
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public int getRenderType()
{
return -1;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean hasTileEntity()
{
return true;
}
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z);
if (!tileEntity.isActive())
{
return;
}
if (rand.nextInt(3) != 0)
{
return;
}
}
// @Override
// public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
// {
// return 1;
// }
@Override
public boolean canProvidePower()
{
return true;
}
@Override
public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
TileEntity tile = par1IBlockAccess.getTileEntity(par2, par3, par4);
if (tile instanceof TEAltar)
{
// if(tile.worldObj.isRemote)
// {
// return 0;
// }
ItemStack stack = ((TEAltar) tile).getStackInSlot(0);
if (stack != null && stack.getItem() instanceof EnergyBattery)
{
EnergyBattery bloodOrb = (EnergyBattery) stack.getItem();
int maxEssence = bloodOrb.getMaxEssence();
int currentEssence = bloodOrb.getCurrentEssence(stack);
int level = currentEssence * 15 / maxEssence;
return ((int) (Math.min(15, level))) % 16;
}
}
return 0;
}
@Override
public TileEntity createNewTileEntity(World var1, int var2)
{
return new TEAltar();
}
}

View file

@ -0,0 +1,75 @@
package WayofTime.alchemicalWizardry.common.block;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBloodLightSource extends Block
{
public BlockBloodLightSource()
{
super(Material.cloth);
//setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("blockBloodLightSource");
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister)
{
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlockBloodLight");
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
return 15;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
if (rand.nextInt(3) != 0)
{
float f = (float) 1.0F;
float f1 = f * 0.6F + 0.4F;
float f2 = f * f * 0.7F - 0.5F;
float f3 = f * f * 0.6F - 0.7F;
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.5D, z + 0.5D + rand.nextGaussian() / 8, f1, f2, f3);
}
}
@Override
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
{
this.setBlockBounds(0.40F, 0.40F, 0.40F, 0.60F, 0.60F, 0.60F);
//super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
}
public int quantityDropped(Random par1Random)
{
return 0;
}
}

View file

@ -0,0 +1,101 @@
package WayofTime.alchemicalWizardry.common.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockConduit extends BlockOrientable
{
@SideOnly(Side.CLIENT)
private static IIcon topIcon;
@SideOnly(Side.CLIENT)
private static IIcon sideIcon1;
@SideOnly(Side.CLIENT)
private static IIcon sideIcon2;
@SideOnly(Side.CLIENT)
private static IIcon bottomIcon;
public BlockConduit()
{
super();
setHardness(2.0F);
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("blockConduit");
//func_111022_d("AlchemicalWizardry:blocks");
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister)
{
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Top");
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType1");
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
switch (side)
{
case 0:
return bottomIcon;
case 1:
return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default:
return sideIcon2;
}
}
@Override
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
{
//dropItems(world, x, y, z);
super.breakBlock(world, x, y, z, par5, par6);
}
@Override
public TileEntity createNewTileEntity(World world, int noClue)
{
return new TEConduit();
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public int getRenderType()
{
return -1;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean hasTileEntity()
{
return true;
}
}

View file

@ -0,0 +1,43 @@
package WayofTime.alchemicalWizardry.common.block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEDemonPortal;
public class BlockDemonPortal extends BlockContainer
{
public BlockDemonPortal()
{
super(Material.rock);
setHardness(2.0F);
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("demonPortal");
}
@Override
public TileEntity createNewTileEntity(World var1, int var2)
{
return new TEDemonPortal();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
{
if(world.isRemote)
{
return false;
}
TEDemonPortal tileEntity = (TEDemonPortal) world.getTileEntity(x, y, z);
tileEntity.rightClickBlock(player, side);
return false;
}
}

View file

@ -0,0 +1,101 @@
package WayofTime.alchemicalWizardry.common.block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.items.BlankSpell;
import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockHomHeart extends BlockContainer
{
public IIcon bottomIcon;
public IIcon topIcon;
public IIcon sideIcon;
public BlockHomHeart()
{
super(Material.rock);
setHardness(2.0F);
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("blockHomHeart");
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister)
{
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_top");
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_bottom");
this.sideIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_side");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
switch (side)
{
case 0:
return bottomIcon;
case 1:
return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default:
return sideIcon;
}
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
{
TEHomHeart tileEntity = (TEHomHeart) world.getTileEntity(x, y, z);
if (tileEntity == null || player.isSneaking())
{
return false;
}
ItemStack playerItem = player.getCurrentEquippedItem();
if (playerItem != null)
{
if (playerItem.getItem() instanceof BlankSpell)
{
if (playerItem.stackTagCompound == null)
{
playerItem.setTagCompound(new NBTTagCompound());
}
NBTTagCompound itemTag = playerItem.stackTagCompound;
itemTag.setInteger("xCoord", x);
itemTag.setInteger("yCoord", y);
itemTag.setInteger("zCoord", z);
itemTag.setInteger("dimensionId", world.provider.dimensionId);
return true;
}
}
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int metaMaybe)
{
return new TEHomHeart();
}
}

Some files were not shown because too many files have changed in this diff Show more