Skip to content

How to create a baby for my breedable entity? #2030

Answered by warjort
Uskoe asked this question in Mod Dev Support
Discussion options

You must be logged in to vote

In general there is no one way to make a baby entity.
Zombie, Villager and Animal babies behave/spawn in different ways.

I assume from the names of the methods you show that when you say you made your entity "breedable" you mean you implemented PassiveEntity?
If you look at its subclass AnimalEntity this has a lot of the code for breeding, including a breed method that does the setBaby(true) which is the direct answer to your question.

I suspect if you try to implement breeding yourself without reference to the AnimalEntity you are going to miss lots of things like;

  • spawning heart particles
  • breeding cooldown
  • xp for breeding
  • stats for bred animals
  • achievement handling
  • sending entity statu…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Uskoe
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants