avoid pathfind to an unloaded chunk | remove debug logs

This commit is contained in:
BruceChen 2022-07-23 23:10:06 +08:00
parent f9bb74a8bd
commit af574b654e
3 changed files with 4 additions and 3 deletions

View file

@ -76,7 +76,9 @@ namespace MinecraftClient.Commands
int z = int.Parse(args[2]); int z = int.Parse(args[2]);
Location goal = new Location(x, y, z); Location goal = new Location(x, y, z);
if (handler.MoveTo(goal, allowUnsafe: takeRisk)) if (handler.GetWorld().GetChunkColumn(goal) == null)
return Translations.Get("cmd.move.chunk_not_loaded");
else if (handler.MoveTo(goal, allowUnsafe: takeRisk))
return Translations.Get("cmd.move.walk", goal); return Translations.Get("cmd.move.walk", goal);
else return takeRisk ? Translations.Get("cmd.move.fail", goal) : Translations.Get("cmd.move.suggestforce", goal); else return takeRisk ? Translations.Get("cmd.move.fail", goal) : Translations.Get("cmd.move.suggestforce", goal);
} }

View file

@ -37,8 +37,6 @@ namespace MinecraftClient.Protocol.Handlers
/// <param name="cache">Cache for reading chunk data</param> /// <param name="cache">Cache for reading chunk data</param>
public void ProcessChunkColumnData(int chunkX, int chunkZ, ulong[] chunkMasks, int currentDimension, Queue<byte> cache) public void ProcessChunkColumnData(int chunkX, int chunkZ, ulong[] chunkMasks, int currentDimension, Queue<byte> cache)
{ {
byte[] mirror = new byte[cache.Count];
cache.CopyTo(mirror, 0);
int chunkColumnSize = chunkMasks.Length * 64; int chunkColumnSize = chunkMasks.Length * 64;
if (protocolversion >= Protocol18Handler.MC117Version) if (protocolversion >= Protocol18Handler.MC117Version)
{ {

View file

@ -319,6 +319,7 @@ cmd.move.fail=Failed to compute path to {0}
cmd.move.suggestforce=Failed to compute a safe path to {0}. Try -f parameter to allow unsafe movements. cmd.move.suggestforce=Failed to compute a safe path to {0}. Try -f parameter to allow unsafe movements.
cmd.move.gravity.enabled=Gravity is enabled. cmd.move.gravity.enabled=Gravity is enabled.
cmd.move.gravity.disabled=Gravity is disabled. cmd.move.gravity.disabled=Gravity is disabled.
cmd.move.chunk_not_loaded=The chunk where the target location resides has not yet been loaded.
# Reco # Reco
cmd.reco.desc=restart and reconnect to the server. cmd.reco.desc=restart and reconnect to the server.