Search in sources :

Example 1 with IReagentManipulator

use of WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator in project BloodMagic by WayofTime.

the class BlockAlchemicCalcinator method onBlockActivated.

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) {
    TEAlchemicCalcinator tileEntity = (TEAlchemicCalcinator) world.getTileEntity(x, y, z);
    if (tileEntity == null || player.isSneaking()) {
        return false;
    }
    ItemStack playerItem = player.getCurrentEquippedItem();
    if (playerItem != null) {
        if (playerItem.getItem() instanceof IReagentManipulator) {
            return false;
        }
        if (playerItem.getItem() instanceof IBloodOrb) {
            if (tileEntity.getStackInSlot(0) == null) {
                ItemStack newItem = playerItem.copy();
                newItem.stackSize = 1;
                --playerItem.stackSize;
                tileEntity.setInventorySlotContents(0, newItem);
            }
        } else if (tileEntity.getStackInSlot(1) == null) {
            ItemStack newItem = playerItem.copy();
            newItem.stackSize = 1;
            --playerItem.stackSize;
            tileEntity.setInventorySlotContents(1, newItem);
        }
    } else {
        if (tileEntity.getStackInSlot(1) != null) {
            player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(1));
            tileEntity.setInventorySlotContents(1, null);
        } else if (tileEntity.getStackInSlot(0) != null) {
            player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
            tileEntity.setInventorySlotContents(0, null);
        }
    }
    tileEntity.getWorldObj().markBlockForUpdate(x, y, z);
    return true;
}
Also used : TEAlchemicCalcinator(WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator) IBloodOrb(WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb) IReagentManipulator(WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator) ItemStack(net.minecraft.item.ItemStack)

Example 2 with IReagentManipulator

use of WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator in project BloodMagic by WayofTime.

the class SpellHelper method canPlayerSeeAlchemy.

public static boolean canPlayerSeeAlchemy(EntityPlayer player) {
    if (player != null) {
        ItemStack stack = player.getCurrentArmor(3);
        if (stack != null) {
            Item item = stack.getItem();
            if (item instanceof IAlchemyGoggles && ((IAlchemyGoggles) item).showIngameHUD(player.worldObj, stack, player)) {
                return true;
            }
        }
        ItemStack heldStack = player.getHeldItem();
        if (heldStack != null && heldStack.getItem() instanceof IReagentManipulator) {
            return true;
        }
    }
    return false;
}
Also used : Item(net.minecraft.item.Item) EntityItem(net.minecraft.entity.item.EntityItem) IAlchemyGoggles(WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles) IReagentManipulator(WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator) ItemStack(net.minecraft.item.ItemStack)

Aggregations

IReagentManipulator (WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator)2 ItemStack (net.minecraft.item.ItemStack)2 IAlchemyGoggles (WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles)1 IBloodOrb (WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb)1 TEAlchemicCalcinator (WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator)1 EntityItem (net.minecraft.entity.item.EntityItem)1 Item (net.minecraft.item.Item)1