Search in sources :

Example 1 with ItemStaff

use of com.teamwizardry.wizardry.common.item.ItemStaff in project Wizardry by TeamWizardry.

the class RecipePearl method getCraftingResult.

@Nonnull
@Override
public ItemStack getCraftingResult(@Nonnull InventoryCrafting inv) {
    ItemStack pearl = ItemStack.EMPTY;
    ItemStack baseItem = ItemStack.EMPTY;
    for (int i = 0; i < inv.getSizeInventory(); i++) {
        ItemStack stack = inv.getStackInSlot(i);
        if (stack.getItem() instanceof ItemRing || stack.getItem() instanceof ItemStaff) {
            if (stack.getItemDamage() == 0)
                baseItem = stack;
        }
        if (stack.getItem() instanceof IInfusable)
            pearl = stack;
    }
    ItemStack baseItemCopy = baseItem.copy();
    baseItemCopy.setItemDamage(1);
    if (pearl.hasTagCompound())
        baseItemCopy.setTagCompound(pearl.getTagCompound());
    return baseItemCopy;
}
Also used : ItemStaff(com.teamwizardry.wizardry.common.item.ItemStaff) IInfusable(com.teamwizardry.wizardry.api.item.IInfusable) ItemRing(com.teamwizardry.wizardry.common.item.ItemRing) ItemStack(net.minecraft.item.ItemStack) Nonnull(javax.annotation.Nonnull)

Example 2 with ItemStaff

use of com.teamwizardry.wizardry.common.item.ItemStaff in project Wizardry by TeamWizardry.

the class RecipePearl method matches.

@Override
public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) {
    boolean foundBaseItem = false;
    boolean foundPearl = false;
    for (int i = 0; i < inv.getSizeInventory(); i++) {
        ItemStack stack = inv.getStackInSlot(i);
        if (stack.getItem() instanceof ItemRing || stack.getItem() instanceof ItemStaff) {
            if (stack.getItemDamage() == 0)
                foundBaseItem = true;
        }
        if (stack.getItem() instanceof ItemNacrePearl)
            foundPearl = true;
    }
    return foundBaseItem && foundPearl;
}
Also used : ItemStaff(com.teamwizardry.wizardry.common.item.ItemStaff) ItemRing(com.teamwizardry.wizardry.common.item.ItemRing) ItemNacrePearl(com.teamwizardry.wizardry.common.item.ItemNacrePearl) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ItemRing (com.teamwizardry.wizardry.common.item.ItemRing)2 ItemStaff (com.teamwizardry.wizardry.common.item.ItemStaff)2 ItemStack (net.minecraft.item.ItemStack)2 IInfusable (com.teamwizardry.wizardry.api.item.IInfusable)1 ItemNacrePearl (com.teamwizardry.wizardry.common.item.ItemNacrePearl)1 Nonnull (javax.annotation.Nonnull)1