Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Is there any way to add/remove health after an entity has been created? For example, I'd like to have a X mob regenerate Y "hearts" when Z happens. Thanks for any help in advance.

share|improve this question
Why the -1? Modding is on-topic and this is a good question. –  Anko Feb 23 '13 at 3:20

2 Answers 2

up vote 6 down vote accepted

There are two ways. Using MCP obfuscation mappings, the first and proper way to do so is with:

EntityLiving.attackEntityFrom(DamageSource, damageDealt);

You need to specify where the damage came from in the first parameter though, so the simpler one is to simply use:


Use this with getHealth so you can do stuff like entity.setEntityHealth(entity.getHealth() - 1);

share|improve this answer

Use MCedit to give mobs more/less heath. Or you could give it something like 5 seconds before it gets a regeneration effect. If you havn't got MCEdit look it up on youtube and download it :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.