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.

[1.12.2] getEntitiesWithinAABBExcludingEntity() no longer detects EntityItem? Alternative?

Featured Replies

Posted

I have concept in my modification built off of the PetBats mod where when you drop a certain item on top of another item, something happens. Worked perfectly fine in 1.11.2.

 

Now in 1.12.2, the same section of code doesn't work. Below is that particular section of code:

	public void revivePoketamable(ItemTossEvent event, TamablePokemon poketamable, EntityItem itemDropped)
	{
		final List nearEnts = event.getEntityItem().world.getEntitiesWithinAABBExcludingEntity(itemDropped, itemDropped.getEntityBoundingBox().expand(8D, 8D, 8D));

		for (Object o : nearEnts)
		{	
			if (o instanceof EntityItem)
			{
				EntityItem foundItem;

				foundItem = (EntityItem) o;
				
				if (foundItem.getItem().getItem() == KindredLegacyItems.revive_seed)
				{
					poketamable.setPosition(itemDropped.posX, itemDropped.posY, itemDropped.posZ);
					itemDropped.world.spawnEntity(poketamable);
					poketamable.setHealth(poketamable.getMaxHealth()); // set full entity health
					event.setCanceled(true);
					foundItem.getItem().shrink(1); // Decrease itemStack by 1

					break;
				}
			}
		}
	}

 

After various testing, I realized that getEntitiesWithinAABBExcludingEntity() no longer returns EntityItems like it did in 1.11.2. It does detect the player from the event so it is working at all.

 

Is there a way to fix this so it does detect EntityItems again? Or some alternative?

 

I've seen some user complaints on the PetBats mod for 1.12 that seem similar to the problem I am experiencing so I doubt the mod actually works as it was intended for this reason.

 

2 hours ago, desht said:

This may or may not be relevant: https://www.reddit.com/r/feedthebeast/comments/6yi8l0/psa_modders_axisalignedbb_method_renames_causing/

 

The .expand() method doesn't do what it used to. 

Thanks for that. Checking my code I had 1 instance of "expand" that was improper.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.