Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi

 

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));
			}else{
			}

		}
	}
}

 

 

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 12.16.1.1887 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.

  • Author

Thank you that was helpful indeed.

 

Sincerely -pick

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.

  • Author

Thank you that was helpful indeed.

 

Sincerely -pick

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.

Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.