mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Merge branch 'master' into 1.19.1-dev-new
This commit is contained in:
commit
71ecebedce
14 changed files with 2030 additions and 636 deletions
|
|
@ -24,7 +24,7 @@ using MinecraftClient.Protocol.Message;
|
|||
namespace MinecraftClient.Protocol.Handlers
|
||||
{
|
||||
/// <summary>
|
||||
/// Implementation for Minecraft 1.7.X+ Protocols
|
||||
/// Implementation for Minecraft 1.8.X+ Protocols
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Typical update steps for implementing protocol changes for a new Minecraft version:
|
||||
|
|
@ -96,20 +96,18 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
this.packetPalette = new PacketTypeHandler(protocolVersion, forgeInfo != null).GetTypeHandler();
|
||||
this.log = handler.GetLogger();
|
||||
this.randomGen = RandomNumberGenerator.Create();
|
||||
|
||||
if (handler.GetTerrainEnabled() && this.protocolVersion > MC_1_19_2_Version)
|
||||
if (handler.GetTerrainEnabled() && protocolVersion > MC_1_18_2_Version)
|
||||
{
|
||||
log.Error(Translations.Get("extra.terrainandmovement_disabled"));
|
||||
handler.SetTerrainEnabled(false);
|
||||
}
|
||||
|
||||
if (handler.GetInventoryEnabled() && (this.protocolVersion < MC_1_10_Version || this.protocolVersion > MC_1_18_2_Version))
|
||||
if (handler.GetInventoryEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_Version))
|
||||
{
|
||||
log.Error(Translations.Get("extra.inventory_disabled"));
|
||||
handler.SetInventoryEnabled(false);
|
||||
}
|
||||
|
||||
if (handler.GetEntityHandlingEnabled() && (this.protocolVersion < MC_1_10_Version || this.protocolVersion > MC_1_18_2_Version))
|
||||
if (handler.GetEntityHandlingEnabled() && (protocolVersion < MC_1_10_Version || protocolVersion > MC_1_19_Version))
|
||||
{
|
||||
log.Error(Translations.Get("extra.entity_disabled"));
|
||||
handler.SetEntityHandlingEnabled(false);
|
||||
|
|
@ -135,23 +133,24 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
Block.Palette = new Palette112();
|
||||
|
||||
// Entity palette
|
||||
if (this.protocolVersion >= MC_1_13_Version)
|
||||
if (protocolVersion >= MC_1_13_Version)
|
||||
{
|
||||
if (this.protocolVersion > MC_1_18_2_Version && handler.GetEntityHandlingEnabled())
|
||||
if (protocolVersion > MC_1_19_Version && handler.GetEntityHandlingEnabled())
|
||||
throw new NotImplementedException(Translations.Get("exception.palette.entity"));
|
||||
|
||||
if (this.protocolVersion >= MC_1_17_Version)
|
||||
if (protocolVersion == MC_1_19_Version)
|
||||
entityPalette = new EntityPalette119();
|
||||
else if (protocolVersion >= MC_1_17_Version)
|
||||
entityPalette = new EntityPalette117();
|
||||
else if (this.protocolVersion >= MC_1_16_2_Version)
|
||||
else if (protocolVersion >= MC_1_16_2_Version)
|
||||
entityPalette = new EntityPalette1162();
|
||||
else if (this.protocolVersion >= MC_1_16_Version)
|
||||
else if (protocolVersion >= MC_1_16_Version)
|
||||
entityPalette = new EntityPalette1161();
|
||||
else if (this.protocolVersion >= MC_1_15_Version)
|
||||
else if (protocolVersion >= MC_1_15_Version)
|
||||
entityPalette = new EntityPalette115();
|
||||
else if (protocolVersion >= MC_1_14_Version)
|
||||
entityPalette = new EntityPalette114();
|
||||
else
|
||||
entityPalette = new EntityPalette113();
|
||||
else entityPalette = new EntityPalette113();
|
||||
}
|
||||
else entityPalette = new EntityPalette112();
|
||||
|
||||
|
|
@ -161,14 +160,16 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
if (protocolVersion > MC_1_19_Version && handler.GetInventoryEnabled())
|
||||
throw new NotImplementedException(Translations.Get("exception.palette.item"));
|
||||
|
||||
if (protocolVersion >= MC_1_18_1_Version)
|
||||
if (protocolVersion == MC_1_19_Version)
|
||||
itemPalette = new ItemPalette119();
|
||||
else if (protocolVersion >= MC_1_18_1_Version)
|
||||
itemPalette = new ItemPalette118();
|
||||
else if (protocolVersion >= MC_1_17_Version)
|
||||
itemPalette = new ItemPalette117();
|
||||
else if (protocolVersion >= MC_1_16_2_Version)
|
||||
itemPalette = new ItemPalette1162();
|
||||
else
|
||||
itemPalette = new ItemPalette1161();
|
||||
if (protocolVersion >= MC_1_16_2_Version)
|
||||
itemPalette = new ItemPalette1162();
|
||||
else itemPalette = new ItemPalette1161();
|
||||
}
|
||||
else itemPalette = new ItemPalette115();
|
||||
|
||||
|
|
@ -1417,7 +1418,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
healthField = 8; // 1.14 and above
|
||||
if (protocolVersion >= MC_1_17_Version)
|
||||
healthField = 9; // 1.17 and above
|
||||
if (protocolVersion > MC_1_18_2_Version)
|
||||
if (protocolVersion > MC_1_19_Version)
|
||||
throw new NotImplementedException(Translations.Get("exception.palette.healthfield"));
|
||||
|
||||
if (metadata.ContainsKey(healthField) && metadata[healthField] != null && metadata[healthField].GetType() == typeof(float))
|
||||
|
|
@ -1887,7 +1888,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
/// Ping a Minecraft server to get information about the server
|
||||
/// </summary>
|
||||
/// <returns>True if ping was successful</returns>
|
||||
public static bool doPing(string host, int port, ref int protocolversion, ref ForgeInfo? forgeInfo)
|
||||
public static bool doPing(string host, int port, ref int protocolVersion, ref ForgeInfo? forgeInfo)
|
||||
{
|
||||
string version = "";
|
||||
TcpClient tcp = ProxyHandler.newTcpClient(host, port);
|
||||
|
|
@ -1939,12 +1940,12 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
|
||||
//Retrieve protocol version number for handling this server
|
||||
if (versionData.Properties.ContainsKey("protocol"))
|
||||
protocolversion = int.Parse(versionData.Properties["protocol"].StringValue);
|
||||
protocolVersion = int.Parse(versionData.Properties["protocol"].StringValue);
|
||||
|
||||
// Check for forge on the server.
|
||||
Protocol18Forge.ServerInfoCheckForge(jsonData, ref forgeInfo);
|
||||
|
||||
ConsoleIO.WriteLineFormatted(Translations.Get("mcc.server_protocol", version, protocolversion + (forgeInfo != null ? Translations.Get("mcc.with_forge") : "")));
|
||||
ConsoleIO.WriteLineFormatted(Translations.Get("mcc.server_protocol", version, protocolVersion + (forgeInfo != null ? Translations.Get("mcc.with_forge") : "")));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue