mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 18:45:23 -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;
|
int cpeServerExtensionsCount;
|
||||||
bool sendHeldBlock, useMessageTypes;
|
bool sendHeldBlock, useMessageTypes;
|
||||||
int envMapAppearanceVer = 2, blockDefinitionsExtVer = 2;
|
int envMapAppearanceVer = 2, blockDefinitionsExtVer = 2;
|
||||||
|
bool needD3Fix;
|
||||||
static string[] clientExtensions = {
|
static string[] clientExtensions = {
|
||||||
"ClickDistance", "CustomBlocks", "HeldBlock", "EmoteFix", "TextHotKey", "ExtPlayerList",
|
"ClickDistance", "CustomBlocks", "HeldBlock", "EmoteFix", "TextHotKey", "ExtPlayerList",
|
||||||
"EnvColors", "SelectionCuboid", "BlockPermissions", "ChangeModel", "EnvMapAppearance",
|
"EnvColors", "SelectionCuboid", "BlockPermissions", "ChangeModel", "EnvMapAppearance",
|
||||||
@ -70,6 +71,8 @@ namespace ClassicalSharp.Net {
|
|||||||
void HandleCpeExtInfo() {
|
void HandleCpeExtInfo() {
|
||||||
string appName = reader.ReadAsciiString();
|
string appName = reader.ReadAsciiString();
|
||||||
game.Chat.Add( "Server software: " + appName );
|
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
|
// 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 =
|
// 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 );
|
gzippedMap = new FixedBufferStream( reader.buffer );
|
||||||
envMapAppearanceVer = 2;
|
envMapAppearanceVer = 2;
|
||||||
blockDefinitionsExtVer = 2;
|
blockDefinitionsExtVer = 2;
|
||||||
|
needD3Fix = false;
|
||||||
|
|
||||||
Disconnected = false;
|
Disconnected = false;
|
||||||
receivedFirstPosition = false;
|
receivedFirstPosition = false;
|
||||||
@ -82,7 +83,8 @@ namespace ClassicalSharp.Net {
|
|||||||
while( (reader.size - reader.index) > 0 ) {
|
while( (reader.size - reader.index) > 0 ) {
|
||||||
byte opcode = reader.buffer[reader.index];
|
byte opcode = reader.buffer[reader.index];
|
||||||
// Workaround for older D3 servers which wrote one byte too many for HackControl packets.
|
// 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 );
|
reader.Skip( 1 );
|
||||||
player.physics.jumpVel = 0.42f; // assume default jump height
|
player.physics.jumpVel = 0.42f; // assume default jump height
|
||||||
player.physics.serverJumpVel = player.physics.jumpVel;
|
player.physics.serverJumpVel = player.physics.jumpVel;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user