diff --git a/ClassicalSharp/Network/Enums.cs b/ClassicalSharp/Network/Enums.cs index a876fae7b..fee60ec22 100644 --- a/ClassicalSharp/Network/Enums.cs +++ b/ClassicalSharp/Network/Enums.cs @@ -39,6 +39,8 @@ namespace ClassicalSharp { CpeHackControl = 32, CpeExtAddEntity2 = 33, CpePlayerClick = 34, + CpeDefineBlock = 35, + CpeDefineLiquid = 36, } public enum CpeMessage { diff --git a/ClassicalSharp/Network/NetworkProcessor.cs b/ClassicalSharp/Network/NetworkProcessor.cs index 4c6fbef12..dd660fcb1 100644 --- a/ClassicalSharp/Network/NetworkProcessor.cs +++ b/ClassicalSharp/Network/NetworkProcessor.cs @@ -116,7 +116,7 @@ namespace ClassicalSharp { readonly int[] packetSizes = { 131, 1, 1, 1028, 7, 9, 8, 74, 10, 7, 5, 4, 2, 66, 65, 2, 67, 69, 3, 2, 3, 134, 196, 130, 3, - 8, 86, 2, 4, 66, 69, 2, 8, 138, + 8, 86, 2, 4, 66, 69, 2, 8, 138, 0, 76, 78, }; static string[] clientExtensions = { @@ -638,6 +638,31 @@ namespace ClassicalSharp { AddEntity( entityId, displayName, skinName, true ); } break; + case PacketId.CpeDefineBlock: + case PacketId.CpeDefineLiquid: + { + byte block = reader.ReadUInt8(); + string name = reader.ReadAsciiString(); + byte solidity = reader.ReadUInt8(); + byte movementSpeed = reader.ReadUInt8(); + byte topTexId = reader.ReadUInt8(); + byte sidesTexId = reader.ReadUInt8(); + byte bottomTexId = reader.ReadUInt8(); + reader.ReadUInt8(); // opacity hint, but we ignore this. + bool transmitsLight = reader.ReadUInt8() != 0; + reader.ReadUInt8(); // walk sound, but we ignore this. + + if( opcode == (byte)PacketId.CpeDefineBlock ) { + byte shape = reader.ReadUInt8(); + byte blockDraw = reader.ReadUInt8(); + } else { + byte fogDensity = reader.ReadUInt8(); + byte fogR = reader.ReadUInt8(); + byte fogG = reader.ReadUInt8(); + byte fogB = reader.ReadUInt8(); + } + } break; + default: throw new NotImplementedException( "Unsupported packet:" + (PacketId)opcode ); }