Posted February 29, 20169 yr Hello! My name is speedspencer and I am developing my first ever mod, but I am having some trouble trying to figure one part out. My mod is a bow aim assist of sorts-- it uses vectors by getting pitch, yaw, x, y, and z to calculate a shot from one player to another (or that is the goal, at least). EDIT: Can someone please just tell me the method (blank.blank.getPos.Player.etc) for the coordinates of the nearest player in minecraft (that isn't you) and for the user player? It needs to include pitch and yaw PLEASE.
February 29, 20169 yr Author Is this a custom class, or you are inheriting from another class? This is the only class I have, if that is what you are asking. I made this class from scratch so yes it is custom. @Cerandior Bump!
March 1, 20169 yr Author Entity (which EntityPlayer inherits from) has fields pos{XYZ}, rotationYaw and rotationPitch. That is exactly what I do not know how to do. I am relatively new (as in brand new) to player API with Forge. I don't know how to call Entity player or what the proper imports (or really anything are). I just need to know what imports I need (and where I can find them within the forge documentation) along with the format of finding the cords for the player. What would I use for the nearest player that isn't the user?
March 1, 20169 yr Author Nearest player to what? You need to think in terms of a server. There is no main player, there might not be any players at all. No... this is a client. I just want to know how to find the USER coordinates, along with the yaw and pitch (which I do not know how to do) along with how to find the NEAREST player to the USER's coordinates (which I have not even the slightest clue how to do). @diesieben07
March 1, 20169 yr uichh sometimes qe get little complicated you need something like public void corregirAim(Entity entidadA, Entity entidadB) { if (entidadA != null & entidadB != null) { double xA = entidadA.posX; double yA = entidadA.posY; double zA = entidadA.posZ; float yawA = entidadA.getRotationYawHead(); // shtA.rotationYaw; float pitchA = entidadA.rotationPitch; double xB = entidadB.posX; double yB = entidadB.posY; double zB = entidadB.posZ; float yawB = entidadB.getRotationYawHead(); // shtB.rotationYaw; float pitchB = entidadB.rotationPitch; //doo your things //here and then entidadA.setPositionAndRotation(xA, yA, zA, yawA, pitchA); }}
March 2, 20169 yr Author Bump. The original post has been edited to better suit what I am looking for.
March 2, 20169 yr Author There is always a server, also in singleplayer. If you are truly concerned about client only (which limits what you can do here), then Minecraft#thePlayer is the clientside "user" player. You can get the closest player to it by checking world.playerEntities. You cannot just use world.getClosestPlayer, since that would just give you the player itself. This is a server mod, but it is also used client side (ex: new blocks for only 1 player, not all players in the world). Can you please help?
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.