Posted February 13, 201411 yr Hello, I want to find an Entity at a set of coordinates specified. I need will need to access the fields of that Entity class. I am already using World.getClosestPlayer(X,Y,Z,4.0), but I don't want to access an Entity standing behind me. I have code written to try to figure out if that Entity is standing in view by comparing it to my look vector, but I don't think that the look vector would work completely. Is there some world function that finds the Entity at XYZ Coordinates and returns a reference to that Entity?
February 13, 201411 yr player.getLookVec()? 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.
February 13, 201411 yr Hi You can get all entities within a certain x,y,z range by defining an AxisAlignedBoundingBox and calling the function below Snippet taken from EntityLiving.onLivingUpdate:: List list = this.worldObj.getEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(1.0D, 0.0D, 1.0D)); You can tell if an entity is behind the player by: 1) calculating the direction vector from the player to the entity 2) calculating the dot product of this vector with the player's look vector 3) if the dot product is negative, the entity is behind the player. Let us know if you need more help? -TGG
February 13, 201411 yr You can offset AABBs by the look vector so that the AABB is only in front of the player. It's like f*cking magic. 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.