Jump to content

[1.7.10]Mobs/Entities and Spawning!


Recommended Posts

Okay, I'm new the the forums and i don't expect any help right away but thanks for any i get.

So my question is or starting statement, I have a entity i made, His name is bob, he extends EntityTamable, and all that fun stuff, but i want to make it so:

A) he re-spawns when he is killed IF he is tamed by a player

B) he has a Chest GUI When u click him with an Open hand and Shift click makes him "sit"

C)i almost forgot, owner shouldnt beable to hit him

Link to comment
Share on other sites

Whenever you want to do something, take a moment to think if there is anything in Vanilla Minecraft that does something similar and then take a look at that.


A) override #setDead in your entity class, check if it's tamed, and if so, do something like set its HP back to max and teleport it somewhere random.


B) sitting: not too complicated - take a look at EntityWolf for the interaction and the wolf's Model / Render class for rendering stuff


B) Chest GUI: quite a lot more complicated than either of the above - take a look at EntityHorse, plus the related Gui, Container, and IInventory (or whatever that has become if you are in 1.9) classes. If you are new to Java / modding, you might want to wait until you are more experienced to tackle this one.


C) Override #attackEntityFrom in your entity class - the DamageSource#getEntity() method returns the entity that caused the damage, so you can check there if it is the owner and then return false rather than allowing any damage to occur.

Link to comment
Share on other sites

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.

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.


  • Create New...

Important Information

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