BloodMagic/BM_src/WayofTime/alchemicalWizardry/common/spell/simple/HomSpellRegistry.java
Fenn e3644f2d2b Massive rework of configs, items and blocks.
I redone where the items/blocsks are stored and how the configs are
handled to clean up it and give space. You can change the config line to
AWWayofTime if you want to keep the compatibility with old configs. Now
you reference the blocks from the ModBlocks and Items from the ModItems.
2014-01-17 21:05:38 +00:00

54 lines
1.4 KiB
Java

package WayofTime.alchemicalWizardry.common.spell.simple;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.List;
public class HomSpellRegistry {
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)
{
if (testItem.getItem() instanceof ItemBlock)
{
if (testItem.itemID == item.itemID)
{
return hsc.getSpell();
}
}
} else
{
if (!(testItem.getItem() instanceof ItemBlock))
{
if (testItem.itemID == item.itemID)
{
return hsc.getSpell();
}
}
}
}
}
return null;
}
}