mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 10:35:11 -04:00
Properly fix workaround for D3 server bug. (Thanks Evander)
This commit is contained in:
parent
ba3418908d
commit
ce2efa5ba9
@ -60,6 +60,7 @@ namespace ClassicalSharp.Net {
|
||||
int cpeServerExtensionsCount;
|
||||
bool sendHeldBlock, useMessageTypes;
|
||||
int envMapAppearanceVer = 2, blockDefinitionsExtVer = 2;
|
||||
bool needD3Fix;
|
||||
static string[] clientExtensions = {
|
||||
"ClickDistance", "CustomBlocks", "HeldBlock", "EmoteFix", "TextHotKey", "ExtPlayerList",
|
||||
"EnvColors", "SelectionCuboid", "BlockPermissions", "ChangeModel", "EnvMapAppearance",
|
||||
@ -70,6 +71,8 @@ namespace ClassicalSharp.Net {
|
||||
void HandleCpeExtInfo() {
|
||||
string appName = reader.ReadAsciiString();
|
||||
game.Chat.Add( "Server software: " + appName );
|
||||
if( Utils.CaselessStarts( appName, "D3 server" ) )
|
||||
needD3Fix = true;
|
||||
|
||||
// Workaround for MCGalaxy that send ExtEntry sync but ExtInfoAsync. This means
|
||||
// ExtEntry may sometimes arrive before ExtInfo, and thus we have to use += instead of =
|
||||
|
@ -44,6 +44,7 @@ namespace ClassicalSharp.Net {
|
||||
gzippedMap = new FixedBufferStream( reader.buffer );
|
||||
envMapAppearanceVer = 2;
|
||||
blockDefinitionsExtVer = 2;
|
||||
needD3Fix = false;
|
||||
|
||||
Disconnected = false;
|
||||
receivedFirstPosition = false;
|
||||
@ -82,7 +83,8 @@ namespace ClassicalSharp.Net {
|
||||
while( (reader.size - reader.index) > 0 ) {
|
||||
byte opcode = reader.buffer[reader.index];
|
||||
// Workaround for older D3 servers which wrote one byte too many for HackControl packets.
|
||||
if( opcode == 0xFF && lastOpcode == PacketId.CpeHackControl ) {
|
||||
if( needD3Fix && lastOpcode == PacketId.CpeHackControl && (opcode == 0x00 || opcode == 0xFF) ) {
|
||||
Utils.LogDebug( "Skipping invalid HackControl byte from D3 server." );
|
||||
reader.Skip( 1 );
|
||||
player.physics.jumpVel = 0.42f; // assume default jump height
|
||||
player.physics.serverJumpVel = player.physics.jumpVel;
|
||||
|
Loading…
x
Reference in New Issue
Block a user