mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-25 14:17:29 -04:00
Core: Fix /tp not working when target player is outside map.
This commit is contained in:
parent
192b9a14e6
commit
b9f083969f
@ -370,15 +370,6 @@ namespace MCGalaxy {
|
||||
|
||||
/// <summary> Sends a packet indicating an absolute position + orientation change for an enity. </summary>
|
||||
public void SendPos(byte id, ushort x, ushort y, ushort z, byte rotx, byte roty) {
|
||||
if ( x < 0 ) x = 32;
|
||||
if ( y < 0 ) y = 32;
|
||||
if ( z < 0 ) z = 32;
|
||||
if ( x > level.Width * 32 ) x = (ushort)( level.Width * 32 - 32 );
|
||||
if ( z > level.Length * 32 ) z = (ushort)( level.Length * 32 - 32 );
|
||||
if ( x > 32767 ) x = 32730;
|
||||
if ( y > 32767 ) y = 32730;
|
||||
if ( z > 32767 ) z = 32730;
|
||||
|
||||
pos = new ushort[3] { x, y, z };
|
||||
rot = new byte[2] { rotx, roty };
|
||||
|
||||
|
@ -306,7 +306,7 @@ namespace MCGalaxy {
|
||||
bool movedY = Math.Abs((short)y - (short)pos[1]) > 40; // moved more than 1.25 blocks vertically
|
||||
bool movedZ = Math.Abs((short)z - (short)pos[2]) > 4; // moved more than 0.125 blocks horizontally
|
||||
if (movedX || movedY || movedZ) {
|
||||
SendPos(Entities.SelfID, pos[0], pos[1], pos[2], rotx, roty);
|
||||
SendPos(Entities.SelfID, pos[0], pos[1], pos[2], rotx, roty);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user