mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Enable/Disable TerrainAndMovements while logged in
Feature requested in #705
This commit is contained in:
parent
41b3f98924
commit
a6e660c974
8 changed files with 126 additions and 19 deletions
|
|
@ -35,10 +35,12 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
this.protocolversion = ProtocolVersion;
|
||||
this.handler = Handler;
|
||||
|
||||
if (Settings.TerrainAndMovements)
|
||||
if (Handler.GetTerrainEnabled())
|
||||
{
|
||||
ConsoleIO.WriteLineFormatted("§8Terrain & Movements currently not handled for that MC version.");
|
||||
Settings.TerrainAndMovements = false;
|
||||
// Re-enable terrain on next relog on a supported server version
|
||||
Handler.SetTerrainEnabled(false);
|
||||
Handler.SetTerrainEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -460,9 +460,10 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
readNextByte(packetData);
|
||||
readNextByte(packetData);
|
||||
readNextString(packetData);
|
||||
handler.OnRespawn();
|
||||
break;
|
||||
case PacketIncomingType.PlayerPositionAndLook:
|
||||
if (Settings.TerrainAndMovements)
|
||||
if (handler.GetTerrainEnabled())
|
||||
{
|
||||
double x = readNextDouble(packetData);
|
||||
double y = readNextDouble(packetData);
|
||||
|
|
@ -490,7 +491,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
break;
|
||||
case PacketIncomingType.ChunkData:
|
||||
if (Settings.TerrainAndMovements)
|
||||
if (handler.GetTerrainEnabled())
|
||||
{
|
||||
int chunkX = readNextInt(packetData);
|
||||
int chunkZ = readNextInt(packetData);
|
||||
|
|
@ -514,7 +515,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
break;
|
||||
case PacketIncomingType.MultiBlockChange:
|
||||
if (Settings.TerrainAndMovements)
|
||||
if (handler.GetTerrainEnabled())
|
||||
{
|
||||
int chunkX = readNextInt(packetData);
|
||||
int chunkZ = readNextInt(packetData);
|
||||
|
|
@ -549,7 +550,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
break;
|
||||
case PacketIncomingType.BlockChange:
|
||||
if (Settings.TerrainAndMovements)
|
||||
if (handler.GetTerrainEnabled())
|
||||
{
|
||||
if (protocolversion < MC18Version)
|
||||
{
|
||||
|
|
@ -564,7 +565,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
break;
|
||||
case PacketIncomingType.MapChunkBulk:
|
||||
if (protocolversion < MC19Version && Settings.TerrainAndMovements)
|
||||
if (protocolversion < MC19Version && handler.GetTerrainEnabled())
|
||||
{
|
||||
int chunkCount;
|
||||
bool hasSkyLight;
|
||||
|
|
@ -607,7 +608,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
}
|
||||
break;
|
||||
case PacketIncomingType.UnloadChunk:
|
||||
if (protocolversion >= MC19Version && Settings.TerrainAndMovements)
|
||||
if (protocolversion >= MC19Version && handler.GetTerrainEnabled())
|
||||
{
|
||||
int chunkX = readNextInt(packetData);
|
||||
int chunkZ = readNextInt(packetData);
|
||||
|
|
@ -1818,7 +1819,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// <returns>True if the location update was successfully sent</returns>
|
||||
public bool SendLocationUpdate(Location location, bool onGround, float? yaw = null, float? pitch = null)
|
||||
{
|
||||
if (Settings.TerrainAndMovements)
|
||||
if (handler.GetTerrainEnabled())
|
||||
{
|
||||
byte[] yawpitch = new byte[0];
|
||||
PacketOutgoingType packetType = PacketOutgoingType.PlayerPosition;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ namespace MinecraftClient.Protocol
|
|||
Dictionary<string, string> GetOnlinePlayersWithUUID();
|
||||
Location GetCurrentLocation();
|
||||
World GetWorld();
|
||||
bool GetTerrainEnabled();
|
||||
bool SetTerrainEnabled(bool enabled);
|
||||
|
||||
/// <summary>
|
||||
/// Called when a server was successfully joined
|
||||
|
|
@ -39,6 +41,11 @@ namespace MinecraftClient.Protocol
|
|||
/// <param name="isJson">TRUE if the text is JSON-Encoded</param>
|
||||
void OnTextReceived(string text, bool isJson);
|
||||
|
||||
/// <summary>
|
||||
/// Called when the player respawns, which happens on login, respawn and world change.
|
||||
/// </summary>
|
||||
void OnRespawn();
|
||||
|
||||
/// <summary>
|
||||
/// This method is called when a new player joins the game
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue