#Teleport player without changing pitch and yaw
1 messages · Page 1 of 1 (latest)
server only ticks 20 times a second, so no matter what you won't get the perfect lag-less teleport
that's because they use different mechanics
the command goes directly into minecraft code and just changes xyz
the skript has to go through bukkit/paper api, which requires a pitch/yaw to be given
you could use reflect to call mc code directly, but that's annoying and no fun to do, digging through code and obfuscation and stuff
hmmm
actually, have you tried force teleport?
it might be async that's causing the 'lag-back'
though i kind of doubt it
done, same thing
didnt know force teleport was a thing
The keyword 'force' indicates this effect will not be delayed,
which may cause lag spikes or server crashes when using this effect to teleport entities to unloaded chunks.
Description of the force keyword
force also seems paper exclusive
sadly lag back effects are probably your best option as the other option
would be using the location() function and setting it when teleporting ex:
set {_loc} to player's location
teleport player to location((x-coord of {_loc}),(y-coord of {_loc}),(z-coord of {_loc}),(world of {_loc}),(yaw of player),(pitch of player))
That code alone isn't clean to look at and the extra () are forced as a means to make sure you don't crash your server when you reload the file
how is that any different than just using {_loc} alone
{_loc} already has the pitch and yaw of the player
loc would use the yaw and pitch at the time of setting it
he wants to avoid the change if teleport takes a bit and getting set back
well yes but you're setting it literally the line above
the lagback comes from the fact that the client and server have slightly different ideas about the player's pitch/yaw at any given moment
the native mc commadn i believe only sends updates to xyz to the client, while using teleport through skript sends updates to xyz and yaw/pitch
i think i might have found a solution
using skript-packet, im sending a play_server_position packet to the player and it seems to be working fine, no yaw or pitch changes
yeah na after testing with the 2 both sun the same for the most part
my version personally feels a bit smoother but nothing really changes
yeah that's the native version
forgot you can just send the packet instead of dealing w/ nms
heres the code im using to test the teleport:
if "%field 5 of event-packet%" is "[Y_ROT, X_ROT]":
set {tpflags} to field 5 of event-packet
on rightclick:
set {_testpacket} to new play_server_position packet
set field 0 of {_testpacket} to 0
set field 1 of {_testpacket} to 0
set field 2 of {_testpacket} to 0
set field 3 of {_testpacket} to 0
set field 4 of {_testpacket} to 0
set field 5 of {_testpacket} to {tpflags}
set field 7 of {_testpacket} to false
send packet {_testpacket} to player```