use of com.bewitchment.common.entity.EntitySpellCarrier in project Bewitchment by Um-Mitternacht.
the class ItemSpellPage method onItemUseFinish.
@Override
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) {
ISpell spell = getSpellFromItemStack(stack);
if (spell != null && !worldIn.isRemote) {
// }
if (spell.getType() == EnumSpellType.INSTANT)
spell.performEffect(new RayTraceResult(Type.MISS, entityLiving.getLookVec(), EnumFacing.UP, entityLiving.getPosition()), entityLiving, worldIn);
else {
EntitySpellCarrier car = new EntitySpellCarrier(worldIn, entityLiving.posX + entityLiving.getLookVec().x, entityLiving.posY + entityLiving.getEyeHeight() + entityLiving.getLookVec().y, entityLiving.posZ + entityLiving.getLookVec().z);
car.setSpell(spell);
car.setCaster(entityLiving);
car.shoot(entityLiving, entityLiving.rotationPitch, entityLiving.rotationYaw, 0, 2f, 0);
worldIn.spawnEntity(car);
}
}
if (entityLiving instanceof EntityPlayer && ((EntityPlayer) entityLiving).isCreative())
return stack;
return ItemStack.EMPTY;
}
Aggregations