Jump to content

How to make an entity invlunerable and unable to be pushed?


Recommended Posts

Posted

I am currently making a mod wherein I need an entity that A: should not be able to be damaged and B: should not be able to move.

How can I do this? I can't find anything along the lines of get/set Invulnerable and canBePushed and canBeCollided with arent working!

Thanks in advance

Posted

For making an entity invulnerable:

If it is a custom entity override the method isEntityInvulnerable(DamageSource). Otherwise, use the LivingHurtEvent and cancel it if necessary.

catch(Exception e)

{

 

}

Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).

Posted

Hm, what version of mc are you using? The method is about three quarters way down the class Entity in 1.8

catch(Exception e)

{

 

}

Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).

Posted

I am using forge 1.8 11.14.3.1450, since when I tried following the instructions to update forge on the latest it didnt work (I assume because of the new Mdk thingamadoodle)

I updated that from the latest 1.7.10, since I was originally following pahimar's LMR series, but then switched to another tutorial that is for 1.8

Posted

I believe that I may have found it, desguised as func_180431_b(DamageSource p_180431_1_). Is this what should be inside of it (in the Entity class)

public boolean func_180431_b(DamageSource p_180431_1_)
    {
        return this.invulnerable && p_180431_1_ != DamageSource.outOfWorld && !p_180431_1_.func_180136_u();
    }

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.