Nasch Posted April 28, 2021 Posted April 28, 2021 I was wondering how I could check for a radius around the player, so that I can sort any living entities into a list? The concept is I want any living entities that come in a specific radius of the player to be set on fire. Quote
poopoodice Posted April 28, 2021 Posted April 28, 2021 Get the player's bounding box, make it bigger (grow, expand), and there are a couple methods in World called getEntitiesWithinAABB or something similar where returns a collection of entities that meets the conditions. If you want it to be more accurate (bounding box is a cube), you can also check the distance between two entities by Vector3d#distanceTo. Quote
Nasch Posted April 28, 2021 Author Posted April 28, 2021 Hmm, I'm guessing getEntitiesWithinAABB doesn't exist in the 1.16 version because I can't seem to find the method? Quote
ChampionAsh5357 Posted April 29, 2021 Posted April 29, 2021 It's probably called something else in mojmap compared to the mcp name provided. A quick search using the forge bot lands us with World#getEntities. Quote
Nasch Posted April 30, 2021 Author Posted April 30, 2021 Ok, so I did find this method called getNearbyEntities and started playing around with it, but I'm having trouble figuring out what to put in the place of some of these parameters getNearbyEntities(Class<? extends T> p_217374_1_, EntityPredicate p_217374_2_, LivingEntity p_217374_3_, AxisAlignedBB p_217374_4_) I had already gotten that AxisAlignedBB is just the bounding box aka the radius to check and I just assume EntityPredicate could just be the default, but the other two I'm unsure about if anyone could explain? Quote
Nasch Posted May 1, 2021 Author Posted May 1, 2021 Appreciate all of the help, got what I needed working. Quote
Recommended Posts
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.