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;
}
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;
}
Aggregations