Posted February 5, 201312 yr Using code from EntitySkeleton, I made my mob apply a potion effect on collision with the player; however, now it doesn't have the normal damaging effect caused by EntityAIAttackOnCollide. How should I go about fixing this? This is the attackEntityAsMob code in my Entity's file. public boolean attackEntityAsMob(Entity par1Entity) { ((EntityLiving)par1Entity).addPotionEffect(new PotionEffect(Potion.wither.id, 200)); return true; } Thanks
February 5, 201312 yr add a super method to it public boolean attackEntityAsMob(Entity par1Entity) { super(par1Entity) ((EntityLiving)par1Entity).addPotionEffect(new PotionEffect(Potion.wither.id, 200)); return true; }
February 5, 201312 yr Author It gives me an error on the super(par1Entity) line; saying that the constructor call must be the first statement in the constructor.
February 5, 201312 yr Author Well- now the entity doesn't spawn (and can't be spawned with its egg) at all. public class EntityExample extends EntityMob { public EntityExample(World par1World, Entity par1Entity) { super(par1World); super.attackEntityAsMob(par1Entity); I thought that you meant to put it at the top. Is this correct placement?
February 5, 201312 yr didn't work as I thought. just find where that method is in the other entities and copy it into your file. then it should work
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.