mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fix bugs in gravity handle
This commit is contained in:
parent
86dfd60d07
commit
357820e1c2
7 changed files with 54 additions and 7 deletions
|
|
@ -13,6 +13,8 @@ namespace MinecraftClient.Mapping
|
|||
{
|
||||
public int ColumnSize;
|
||||
|
||||
public bool FullyLoaded = false;
|
||||
|
||||
/// <summary>
|
||||
/// Blocks contained into the chunk
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -31,9 +31,11 @@ namespace MinecraftClient.Mapping
|
|||
belowFoots = location;
|
||||
belowFoots.Y = Math.Truncate(location.Y);
|
||||
}
|
||||
//Console.WriteLine("IsOnGround = " + IsOnGround(world, location));
|
||||
if (!IsOnGround(world, location) && !IsSwimming(world, location))
|
||||
{
|
||||
while (!IsOnGround(world, belowFoots) && belowFoots.Y >= 1)
|
||||
while (!IsOnGround(world, belowFoots) &&
|
||||
belowFoots.Y >= 1 + (world.GetDimension() == null ? 0 : world.GetDimension().minY))
|
||||
belowFoots = Move(belowFoots, Direction.Down);
|
||||
location = Move2Steps(location, belowFoots, ref motionY, true).Dequeue();
|
||||
}
|
||||
|
|
@ -262,6 +264,9 @@ namespace MinecraftClient.Mapping
|
|||
/// <returns>True if the specified location is on the ground</returns>
|
||||
public static bool IsOnGround(World world, Location location)
|
||||
{
|
||||
if (world.GetChunkColumn(location) == null || world.GetChunkColumn(location).FullyLoaded == false)
|
||||
return true; // avoid moving downward in a not loaded chunk
|
||||
|
||||
return world.GetBlock(Move(location, Direction.Down)).Type.IsSolid()
|
||||
&& (location.Y <= Math.Truncate(location.Y) + 0.0001);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,13 @@ namespace MinecraftClient.Mapping
|
|||
/// </summary>
|
||||
private readonly ReaderWriterLockSlim chunksLock = new ReaderWriterLockSlim();
|
||||
|
||||
/// <summary>
|
||||
/// Chunk data parsing progress
|
||||
/// </summary>
|
||||
public uint chunkCnt = 0;
|
||||
public uint chunkLoadNotCompleted = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Read, set or unload the specified chunk column
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue