yaw и pitch майнкрафт
Minecraft Forums
Need to set the yaw and pitch of the player from server-side [SOLVED]
I am teleporting a player to a location and I need to set the yaw and pitch of the player as they arrive.
Currently I am using
I have tried other fuctions that would seem to work but do nothing. I suspect sending some kind of packet to the client is needed but I don’t really have a clue what or how to do this.
1 = 0
If you are just using setPositionAndUpdate, the angles should not change once you set them; however, you need to set the values on the client for the player’s view to render accordingly.
I’ve personally used rotationYaw/Pitch on the client side to change the player’s view, so I know it works.
That is good to know.
So far this mod is server side only. So the cleints do not need to have it to use it on a server. I am very much hoping to keep it that way if possible.
I have thought about having it client side as well. My mod works great teleporting them as needed without the yaw and pitch. So this is one of the very last things I want to get fixed. I still am hoping for some code to just tell the client what yaw and pitch.
I seem to recall reading something about someone setting the coordinates and yaw and pitch then sending a packet. something about a look12 packet or similar name. The packet was sent to the client to update it.
Does anyone know about this sort of thing? Im still trying to set the yaw and pitch of the player with server-side mod code.
Yeah, teleport doesn’t have that feature in 1.6.4
Anyways, I suggest that you update to 1.7.2. It will be a pain in the butt, but it does have the yaw and pitch teleportation that you need. I suggest that you do so. If you know what the main changes were between 1.6.4 and 1.7.2 it shouldn’t be too hard to figure out.
1 = 0
I seem to recall reading something about someone setting the coordinates and yaw and pitch then sending a packet. something about a look12 packet or similar name. The packet was sent to the client to update it.
Does anyone know about this sort of thing? Im still trying to set the yaw and pitch of the player with server-side mod code.
I bet you could find the right packet if you opened up the net.minecraft.network.packet package
Here’s something interesting I found while messing around, though, that will probably do what you need:
I found code on the net like this
Minecraft mc = Minecraft.getMinecraft();
mc.getSendQueue().addToSendQueue(new Packet12PlayerLook(yaw, pitch, onGround));
The red part it cannot resolve.
This was exciting and terrible.
In single player your code works very well!
import java.io.File;
import java.util.List;
I was concerned about using EntityPlayerMP in single player mode but it seems to work.