Core: Fix /tp not working when target player is outside map.

This commit is contained in:
UnknownShadow200 2016-11-20 17:18:17 +11:00
parent 192b9a14e6
commit b9f083969f
2 changed files with 1 additions and 10 deletions

View File

@ -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 };

View File

@ -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;
}