mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Add world handling (and fall to ground)
- World is now properly parsed and stored from chunk data - Block changes are also handled and world updated accordingly - Added ground checking, the player will move down to reach the ground - Performance tweaking in Protocol18, using lists instead of arrays - Fix player look not properly skipped causing invalid location after teleport
This commit is contained in:
parent
2e4544fc5a
commit
cb00c28b6e
10 changed files with 661 additions and 91 deletions
|
|
@ -46,6 +46,72 @@ namespace MinecraftClient.Mapping
|
|||
Z = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The X index of the corresponding chunk in the world
|
||||
/// </summary>
|
||||
public int ChunkX
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((int)X) / Chunk.SizeX;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Y index of the corresponding chunk in the world
|
||||
/// </summary>
|
||||
public int ChunkY
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((int)Y) / Chunk.SizeY;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Z index of the corresponding chunk in the world
|
||||
/// </summary>
|
||||
public int ChunkZ
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((int)Z) / Chunk.SizeY;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The X index of the corresponding block in the corresponding chunk of the world
|
||||
/// </summary>
|
||||
public int ChunkBlockX
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((int)X) % Chunk.SizeX;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Y index of the corresponding block in the corresponding chunk of the world
|
||||
/// </summary>
|
||||
public int ChunkBlockY
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((int)Y) % Chunk.SizeY;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Z index of the corresponding block in the corresponding chunk of the world
|
||||
/// </summary>
|
||||
public int ChunkBlockZ
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((int)Z) % Chunk.SizeZ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compare two locations. Locations are equals if the integer part of their coordinates are equals.
|
||||
/// </summary>
|
||||
|
|
@ -155,5 +221,14 @@ namespace MinecraftClient.Mapping
|
|||
| (((int)Y) & ~((~0) << 13)) << 13
|
||||
| (((int)Z) & ~((~0) << 06)) << 00;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert the location into a string representation
|
||||
/// </summary>
|
||||
/// <returns>String representation of the location</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("X:{0} Y:{1} Z:{2}", X, Y, Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue