How to create a baby for my breedable entity? #2030
-
I made my entity breedable, however when I breed them an adult entity spawns. This is the part of the entity code where the breeding code is. @Override
public DotnecEntity createChild(ServerWorld world, PassiveEntity entity) {
DotnecEntity dotentity = (DotnecEntity)BackroomsSMP.DOTNEC.create(world);
UUID uUID = this.getOwnerUuid();
if (uUID != null) {
dotentity.setOwnerUuid(uUID);
dotentity.setTamed(true);
}
return dotentity;
}
public boolean canBreedWith(AnimalEntity other) {
if (other == this) {
return false;
} else if (!this.isTamed()) {
return false;
} else if (!(other instanceof DotnecEntity)) {
return false;
} else {
DotnecEntity dotentity = (DotnecEntity)other;
if (!dotentity.isTamed()) {
return false;
} else if (dotentity.isInSittingPose()) {
return false;
} else {
return this.isInLove() && dotentity.isInLove();
}
}
} If you need me to show something more, you can ask anytime. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
In general there is no one way to make a baby entity. I assume from the names of the methods you show that when you say you made your entity "breedable" you mean you implemented I suspect if you try to implement breeding yourself without reference to the
To see how to use the |
Beta Was this translation helpful? Give feedback.
-
Please stop taking this attitude. It is your responsibility to properly research a question and provide relevant information. If somebody has to guess or play https://en.wikipedia.org/wiki/Twenty_questions I know I feel that way with many of your questions. |
Beta Was this translation helpful? Give feedback.
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 thesetBaby(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;