I want to protect my custom entity but everyone can kill it. I tried to loop setting health to max, I tried to protect it with events but it could still die.

How to protect it? Or is there any built-in-minecraft method which makes the entity unkillable?​

  • How are people killing it? Are they hitting it until it dies, are they in creative, or are they using a command? – SirBenet Nov 14 '15 at 22:41
  • They are in survival and they are hitting it – Woulfiee Nov 14 '15 at 22:43
  • What kind of entity are you trying to make unkillable? – Jason_ Feb 17 '16 at 8:27

Use the Invulnerable tag. Spawn the Entity with the extra tag {Invulnerable:1}.

Another choice is the resistance potion effect:

/effect <Target> minecraft:resistance 1000000 255 true

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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