mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Make chunk loading status to be displayed using "/move" command
This commit is contained in:
parent
ff014d2912
commit
b0b45a74a0
5 changed files with 23 additions and 27 deletions
|
|
@ -17,7 +17,14 @@ namespace MinecraftClient.Commands
|
||||||
bool takeRisk = false;
|
bool takeRisk = false;
|
||||||
|
|
||||||
if (args.Count < 1)
|
if (args.Count < 1)
|
||||||
return GetCmdDescTranslated();
|
{
|
||||||
|
string desc = GetCmdDescTranslated();
|
||||||
|
|
||||||
|
if (handler.GetTerrainEnabled())
|
||||||
|
handler.Log.Info(getChunkLoadingStatus(handler.GetWorld()));
|
||||||
|
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
if (args.Contains("-f"))
|
if (args.Contains("-f"))
|
||||||
{
|
{
|
||||||
|
|
@ -88,5 +95,19 @@ namespace MinecraftClient.Commands
|
||||||
}
|
}
|
||||||
else return Translations.Get("extra.terrainandmovement_required");
|
else return Translations.Get("extra.terrainandmovement_required");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string getChunkLoadingStatus(World world)
|
||||||
|
{
|
||||||
|
double chunkLoadedRatio;
|
||||||
|
if (world.chunkCnt == 0)
|
||||||
|
chunkLoadedRatio = 0;
|
||||||
|
else
|
||||||
|
chunkLoadedRatio = (world.chunkCnt - world.chunkLoadNotCompleted) / (double)world.chunkCnt;
|
||||||
|
|
||||||
|
string status = Translations.Get("cmd.move.chunk_loading_status",
|
||||||
|
chunkLoadedRatio, world.chunkCnt - world.chunkLoadNotCompleted, world.chunkCnt);
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ namespace MinecraftClient.Mapping
|
||||||
belowFoots = location;
|
belowFoots = location;
|
||||||
belowFoots.Y = Math.Truncate(location.Y);
|
belowFoots.Y = Math.Truncate(location.Y);
|
||||||
}
|
}
|
||||||
//Console.WriteLine("IsOnGround = " + IsOnGround(world, location));
|
|
||||||
if (!IsOnGround(world, location) && !IsSwimming(world, location))
|
if (!IsOnGround(world, location) && !IsSwimming(world, location))
|
||||||
{
|
{
|
||||||
while (!IsOnGround(world, belowFoots) &&
|
while (!IsOnGround(world, belowFoots) &&
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,6 @@ namespace MinecraftClient
|
||||||
private float playerYaw;
|
private float playerYaw;
|
||||||
private float playerPitch;
|
private float playerPitch;
|
||||||
private double motionY;
|
private double motionY;
|
||||||
private int chunkLoadingStateTicks = 30; // Setting it to zero to disable chunk loading statu log
|
|
||||||
private double lastChunkLoadedRatio = 0;
|
|
||||||
|
|
||||||
private string host;
|
private string host;
|
||||||
private int port;
|
private int port;
|
||||||
|
|
@ -387,26 +385,6 @@ namespace MinecraftClient
|
||||||
taskToRun();
|
taskToRun();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (terrainAndMovementsEnabled)
|
|
||||||
{
|
|
||||||
if (chunkLoadingStateTicks <= 0)
|
|
||||||
{
|
|
||||||
chunkLoadingStateTicks = 50;
|
|
||||||
if (world.chunkCnt != 0)
|
|
||||||
{
|
|
||||||
double chunkLoadedRatio = (world.chunkCnt - world.chunkLoadNotCompleted) / (double)world.chunkCnt;
|
|
||||||
if (chunkLoadedRatio != lastChunkLoadedRatio)
|
|
||||||
{
|
|
||||||
Log.Info(string.Format("Chunk loading: {0:P} {1}/{2}",
|
|
||||||
chunkLoadedRatio, world.chunkCnt - world.chunkLoadNotCompleted, world.chunkCnt));
|
|
||||||
lastChunkLoadedRatio = chunkLoadedRatio;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
chunkLoadingStateTicks--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Connection Lost and Disconnect from Server
|
#region Connection Lost and Disconnect from Server
|
||||||
|
|
|
||||||
|
|
@ -332,10 +332,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
currentDimensionName = dataTypes.ReadNextString(packetData); // Dimension Name (World Name) - 1.16 and above
|
currentDimensionName = dataTypes.ReadNextString(packetData); // Dimension Name (World Name) - 1.16 and above
|
||||||
|
|
||||||
if (protocolversion >= MC1162Version)
|
if (protocolversion >= MC1162Version)
|
||||||
new Task(() =>
|
|
||||||
{
|
|
||||||
handler.GetWorld().SetDimension(currentDimensionName, currentDimensionType);
|
handler.GetWorld().SetDimension(currentDimensionName, currentDimensionType);
|
||||||
}).Start();
|
|
||||||
|
|
||||||
if (protocolversion >= MC115Version)
|
if (protocolversion >= MC115Version)
|
||||||
dataTypes.ReadNextLong(packetData); // Hashed world seed - 1.15 and above
|
dataTypes.ReadNextLong(packetData); // Hashed world seed - 1.15 and above
|
||||||
|
|
|
||||||
|
|
@ -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_loading_status=Chunk loading status: {0:P} - {1} out of {2} load completed.
|
||||||
cmd.move.chunk_not_loaded=The chunk where the target location resides has not yet been loaded.
|
cmd.move.chunk_not_loaded=The chunk where the target location resides has not yet been loaded.
|
||||||
|
|
||||||
# Reco
|
# Reco
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue