I'm trying to create a potion effect so it will give any mob which is attacking the player, damage, however the player remains unharmed from the attack.
I've tried a few different ways of doing so, and none have worked so far.. I've tried to use getsourceof damage, but it refuses to recognise the e.source...
Newest method I've tried
else if(e.entityLiving.worldObj.rand.nextInt(30) == 0){
if (e.entity instanceof EntityPlayer){
EntityPlayer player = (EntityPlayer) e.entity;
if (e.source.getSourceOfDamage() != null && e.source.getSourceOfDamage() instanceof EntityMob);
{
EntityMob mob = (EntityMob) e.source.getSourceOfDamage();