Jump to content

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


Recommended Posts

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.

 

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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