MC 1.14 Basic/Chat support (#703)

Implement MC 1.14 baseline protocol support
Terrain and movements not supported yet for 1.14
This commit is contained in:
ORelio 2019-04-29 00:25:00 +02:00
parent a6e660c974
commit 295d6546b8
6 changed files with 112 additions and 52 deletions

View file

@ -167,41 +167,6 @@ namespace MinecraftClient.Mapping
return false;
}
/// <summary>
/// Get a representation of the location as unsigned long
/// </summary>
/// <remarks>
/// A modulo will be applied if the location is outside the following ranges:
/// X: -33,554,432 to +33,554,431
/// Y: -2,048 to +2,047
/// Z: -33,554,432 to +33,554,431
/// </remarks>
/// <returns>Location representation as ulong</returns>
public ulong GetLong()
{
return ((((ulong)X) & 0x3FFFFFF) << 38) | ((((ulong)Y) & 0xFFF) << 26) | (((ulong)Z) & 0x3FFFFFF);
}
/// <summary>
/// Get a location from an unsigned long.
/// </summary>
/// <returns>Location represented by the ulong</returns>
public static Location FromLong(ulong location)
{
int x = (int)(location >> 38);
int y = (int)((location >> 26) & 0xFFF);
int z = (int)(location << 38 >> 38);
if (x >= 33554432)
x -= 67108864;
if (y >= 2048)
y -= 4096;
if (z >= 33554432)
z -= 67108864;
return new Location(x, y, z);
}
/// <summary>
/// Compare two locations. Locations are equals if the integer part of their coordinates are equals.
/// </summary>