Jump to content

[1.9][Closed] EntityAnimal child constructing


Recommended Posts



I am tinkering around with custom entity attributes (I know I have to use the new forge caps) upon breeding animals.


My strategy was to find out on how to determine an entity is a newly spawned child, created by breeding (since baby-animals may also spawn in creative mode differently). The problem is: I did not find a dedicated event for this, so I thought I have to use LivingEvent.EntityConstructing, which I registered successfully.


This is the code for my event handler:


public void onEntityConstructing(EntityEvent.EntityConstructing event) {
	Entity entity = event.getEntity();
	if (entity != null && entity.worldObj != null && !entity.worldObj.isRemote) {
		// only serverside
		if (entity instanceof EntityAnimal) {
			Polycraft.LOG.debug("Ageable constructing");
			EntityAnimal animal = (EntityAnimal) entity;
			int growingAge = animal.getGrowingAge();
			int age = animal.getAge();
			boolean child = animal.isChild();
			Polycraft.LOG.debug("gAge: "+growingAge+", age: "+age+", child:"+child);
			if (animal.getGrowingAge() <= -23000) {//-24000 is set during createBaby
				BlockPos p = animal.getPosition();
				Polycraft.LOG.debug("A baby is born at " + PseudoLogger.toStringNullSafe(p));




The issue is now, that I got the feeling that this event is not fired during spawing the baby-animal.


I'm using forge version and looking forward to get some hints on how to solve this.


Sincerely -pick


PS: The overall goal of my attempt is to check upon birth if the parents (nearest two adult animals, I guess) do have some attributes (capabilities) and apply these to the child.

Since English is not my mother tongue, my sentences may are confusing.


I'm coding java for a long time now - just MC and forge stop me sometimes.

Link to comment
Share on other sites

This topic is now closed to further replies.


  • Create New...

Important Information

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