BloodMagic/BM_src/WayofTime/alchemicalWizardry/common/spell/simple/HomSpellRegistry.java

56 lines
1.4 KiB
Java
Raw Normal View History

2014-01-17 19:12:49 +00:00
package WayofTime.alchemicalWizardry.common.spell.simple;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.List;
2014-01-17 21:43:13 +00:00
public class HomSpellRegistry
{
2014-01-17 19:12:49 +00:00
public static List<HomSpellComponent> spellList = new ArrayList();
public static void registerBasicSpell(ItemStack item, HomSpell spell)
{
spellList.add(new HomSpellComponent(item, spell));
}
public static HomSpell getSpellForItemStack(ItemStack testItem)
{
if (testItem == null)
{
return null;
}
for (HomSpellComponent hsc : spellList)
{
ItemStack item = hsc.getItemStack();
if (item != null)
{
if (item.getItem() instanceof ItemBlock)
2014-01-17 19:12:49 +00:00
{
if (testItem.getItem() instanceof ItemBlock)
{
if (testItem.itemID == item.itemID)
{
return hsc.getSpell();
}
}
} else
2014-01-17 19:12:49 +00:00
{
if (!(testItem.getItem() instanceof ItemBlock))
{
if (testItem.itemID == item.itemID)
{
return hsc.getSpell();
}
}
}
}
}
return null;
}
}