hello everyone, I am currently workin on an entity that spawns approximately 3 mobs each time it's hurt, however my code makes it spawn them non-stop as long as it's health is lower than the max health.
I know why this happens I just don't know how to make it do as I stated before; spawn 3 mobs each time it's hurt.
this is my current code for the spawning feature:
[embed=425,349]
public void onEntityUpdate() {
super.onEntityUpdate();
int i = (int) posX;
int j = (int) posY;
int k = (int) posZ;
int h = (int) this.getHealth();
int m = (int) this.getMaxHealth();
if (true) {
Entity sentity = EntityList.createEntityByID(54, worldObj);
if(h < m) {
sentity.setLocationAndAngles(i, j, k, worldObj.rand.nextFloat() * 360F, 0.0F);
worldObj.spawnEntityInWorld(sentity);
((EntityLiving) sentity).playLivingSound();
}
return;
}
[/embed]
I would appreciate your help.
-Prometheanrazer.